trace-exec.exp revision aee093126654f722523b47848a0c5449e39cf4bb
1set testfile "trace-exec" 2set srcfile ${testfile}.c 3set binfile ${testfile} 4 5verbose "compiling first source file now....." 6if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } { 7 send_user "Testcase compile failed, so all tests in this file will automatically fail.\n" 8} 9 10verbose "compiling second source file now....." 11if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}1.c" "${srcdir}/${subdir}/${binfile}1" executable {debug} ] != "" } { 12 send_user "Testcase compile failed, so all tests in this file will automatically fail.\n" 13} 14 15global LTRACE 16set exec_output "" 17 18#Run PUT for ltrace. 19spawn $LTRACE $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1 20set timeout 4 21expect timeout { 22 fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!" 23 return 24} 25 26catch "exec $LTRACE $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1" exec_output 27 28#check the output of this program. 29verbose "ltrace runtest output: $exec_output\n" 30if [regexp {ELF from incompatible architecture} $exec_output] { 31 fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" 32 return 33} elseif [ regexp {Couldn't get .hash data} $exec_output ] { 34 fail "Couldn't get .hash data!" 35 return 36} 37 38ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace 39 40# execl from first binary 41ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {"^execl"} 1 42# puts from second binary 43ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {"^puts"} 1 44# assume glibc and see we really trace both binaries 45ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {"^__libc_start_main"} 2 46