summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/utrace_syscall_args.exp
blob: e3c90191c4cc7ccd1131ccdcba826c21aea4e69d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Utrace system call argument tests.

set flags ""
set srcpath "$srcdir/$subdir/utrace_syscall_args.c"
set exepath "[pwd]/utrace_syscall_args"
set stppath "$srcdir/$subdir/utrace_syscall_args.stp"

set output_string "mmap\\(\[0-9\]+\\)\\(0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+\\) = 0x\[0-9a-f]+\r\nmunmap\\(\[0-9\]+\\)\\(0x\[0-9a-f]+, 0x\[0-9a-f]+\\) = 0x\[0-9a-f]+\r\nclose\\(\[0-9\]+\\)\\(0x\[0-9a-f]+\\) = 0x\[0-9a-f]+\r\ndup\\(\[0-9\]+\\)\\(0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+\\) = 0x\[0-9a-f]+\r\nbad_syscall\\(-?\[0-9\]+\\)\\(0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+, 0x\[0-9a-f]+\\) = 0x\[0-9a-f]+\r\nsystemtap test success\r\n"

# For first pass, force 64-bit compilation for 64-bit systems.  Add
# any other 64-bit architecture you want tested below.
#
# To find tcl's platform name for your machine, run the following:
# echo "puts $::tcl_platform(machine)" | tclsh

switch -regexp $::tcl_platform(machine) {
    ^ia64$ {
	set do_64_bit_pass 1
	set flags "" 
    }
    ^(x86_64|ppc64|s390x)$ { 
	set do_64_bit_pass 1
	set flags "additional_flags=-m64"
    }
    default {
	set do_64_bit_pass 0
    }
}

if {$do_64_bit_pass} {
    set testname "64_BIT_UTRACE_SYSCALL_ARGS"
    if {![installtest_p]} { untested $testname; continue }
    if {![utrace_p]} { untested $testname; continue }
    send_log "Testing ${testname}\n"

    # Compile our test program.
    set res [target_compile $srcpath $exepath executable $flags]
    if { $res != "" } {
	verbose "target_compile for $exepath failed: $res" 2
	send_log "$testname: unable to compile $srcpath\n"
	untested $testname       
	return
    }

    # Run the test.
    stap_run $testname no_load $output_string -g $stppath -c $exepath

    catch {exec rm -f $exepath foobar}
}
	
# The second pass is for systems that support 32-bit executables
# (either exclusively or in addition to 64-bit executables).
set do_32_bit_pass 1    
switch -regexp $::tcl_platform(machine) {
    ^(x86_64|ppc64)$ {
	set flags "additional_flags=-m32"
    }
    ^s390x$ {
	set flags "additional_flags=-m31"
    }
    ^ia64$ {
	set do_32_bit_pass 0
    }
}

if {$do_32_bit_pass} {
    set testname "32_BIT_UTRACE_SYSCALL_ARGS"
    if {![installtest_p]} { untested $testname; continue }
    if {![utrace_p]} { untested $testname; continue }
    send_log "Testing ${testname}\n"

    # Compile our test program
    set res [target_compile $srcpath $exepath executable $flags]
    if { $res != "" } {
	verbose "target_compile for $exepath failed: $res" 2
	send_log "$testname: unable to compile $srcpath\n"
	untested $testname       
	return
    }

    stap_run $testname no_load $output_string -g $stppath -c $exepath

    catch {exec rm -f $exepath foobar}
}