1 # This file was written by Yao Qi <qiyao (at) cn.ibm.com>. 2 3 set testfile "signals" 4 set srcfile ${testfile}.c 5 set binfile ${testfile} 6 7 8 verbose "compiling source file now....." 9 # Build the shared libraries this test case needs. 10 if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } { 11 send_user "Testcase compile failed, so all tests in this file will automatically fail\n." 12 } 13 14 # set options for ltrace. 15 ltrace_options "-L" 16 17 # Run PUT for ltarce. 18 set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile] 19 20 # Check the output of this program. 21 verbose "ltrace runtest output: $exec_output\n" 22 if [regexp {ELF from incompatible architecture} $exec_output] { 23 fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" 24 return 25 } elseif [ regexp {Couldn't get .hash data} $exec_output ] { 26 fail "Couldn't get .hash data!" 27 return 28 } 29 30 # Extract LOOP from source file. 31 set fd [ open $srcdir/$subdir/$srcfile r] 32 while { [gets $fd line] >= 0 } { 33 regexp {define LOOP.*([0-9]+)} $line match count 34 } 35 close $fd 36 37 # Verify the output of ltrace by checking the number of SIGUSR1 in signal.ltrace 38 set pattern "SIGUSR1" 39 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern $count 40