trace-exec.exp revision 68621dbd097284a7a60318815399503c24518f12
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" "${objdir}/${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" "${objdir}/${subdir}/${binfile}1" executable {debug} ] != "" } {
12     send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
13}
14
15ltrace_args "$objdir/$subdir/${testfile}1"
16set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$testfile]
17
18#check the output of this program.
19verbose "ltrace runtest output: $exec_output\n"
20if [regexp {ELF from incompatible architecture} $exec_output] {
21	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
22	return
23} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
24	fail "Couldn't get .hash data!"
25	return
26}
27
28# execl from first binary
29set pattern {^[0-9]* execl}
30ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
31# puts from second binary
32set pattern {^[0-9]* puts}
33ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
34# assume glibc and see we really trace both binaries
35set pattern {^[0-9]* __libc_start_main}
36ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 2
37