set test "rep_ret" # This test is only for i386 and x86_64 # Test 32-on-64 when available switch -regexp $::tcl_platform(machine) { {^i\d86$} { set arches [list "-default"] } {^x86_64$} { set arches [list "-m64" "-m32"]} default { unsupported "$test"; return } } foreach arch $arches { set exe ${test}${arch} verbose "testing $exe" set test_flags "additional_flags=-g" set test_flags "$test_flags additional_flags=-fomit-frame-pointer" if {$arch != "-default"} { set test_flags "$test_flags additional_flags=$arch" } set res [target_compile $srcdir/$subdir/$test.c $exe executable "$test_flags"] if { $res != "" } { verbose "target_compile $exe failed: $res" 2 fail "${test}.c compile ${arch}" untested "$exe" return } else { pass "${test}.c compile ${arch}" } if {[installtest_p] && [uprobes_p]} { set ok 0 set warn 0 spawn stap -e {probe process(@1).function("*") { println(probefunc()) }} ./$exe -c ./$exe # We have two cases for main below to handle the possibility of main not being the first # line being printed out (but only one of the two will ever fire, so the count is still 3) # The test however does still ensure that main is followed by rep_ret then by repnz_ret. expect { -re {\r\nmain\r\n} { incr ok; exp_continue } -re {^main\r\n} { incr ok; exp_continue } -re {^rep_ret\r\n} { incr ok; exp_continue } -re {^repnz_ret\r\n} { incr ok; exp_continue } -re {^WARNING: Number of errors: 0, skipped probes: [^\r\n]*\r\n} { incr warn; exp_continue } timeout { fail "$exe (timeout)" } eof { } } catch { close }; catch { wait } if {$ok == 3 && $warn == 0} { pass "$exe" } else { fail "$exe ($ok, $warn)" } } else { untested "$exe" } catch {exec rm -f $exe} }