File: setjmp.exp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (60 lines) | stat: -rw-r--r-- 1,615 bytes parent folder | download | duplicates (8)
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
set test "setjmp"
set ::result_string {hit longjmp_target}

foreach variant [list "" "-DSIGJMP" "-DUNDERJMP"] {
    foreach flags [list "" "-O" "-O -D_FORTIFY_SOURCE=2"] {

	set this_test "$test $variant $flags"

	set testprog [regsub { } "setjmp.exe${variant}${flags}" ""]
	set test_flags "additional_flags=-g"
	foreach arg "$variant $flags" {
	    set test_flags "$test_flags additional_flags=$arg"
	}

	set res [target_compile $srcdir/$subdir/$test.c $testprog executable \
		     "$test_flags"]
	if {$res != ""} {
	    verbose "target_compile failed: $res" 2
	    fail "compiling $test.c $variant $flags"
	    untested $this_test
	    continue
	} else {
	    pass "compiling $test.c $variant $flags"
	}

	if {[catch \
		 {exec stap -l "process(\"/lib*/libc.so.*\").mark(\"*jmp*\")" \
		      2>@1} res]} {
	    if {[lindex $::errorCode 0] eq "CHILDSTATUS"} {
		set status [lindex $::errorCode 2]
		if {$status == 1} {
		    verbose -log "stap -l check found no libc probes" 1
		    untested $this_test
		    continue
		}
	    }
	    verbose -log "stap -l failed: $res"
	    fail "stap -l check for libc probes"
	    untested $this_test
	    continue
	} else {
	    verbose -log "stap -l yields: $res"
	    if {$res == ""} {
		verbose -log "stap -l check found no libc probes" 1
		untested $this_test
		continue
	    }
	}

	if {[installtest_p] && [utrace_p] && [uprobes_p]} {
	    stap_run3 $this_test -w --ldd $srcdir/$subdir/$test.stp \
		$testprog ./$testprog -c ./$testprog
	} else {
	    untested $this_test
	}
    }
}
if { $verbose == 0 } {
    catch { eval [list exec /bin/rm -f] [glob "setjmp.exe*"] }
}