trace-clone.exp revision aee093126654f722523b47848a0c5449e39cf4bb
1# This file was written by Yao Qi <qiyao@cn.ibm.com>.
2
3set testfile "trace-clone"
4set srcfile ${testfile}.c
5set binfile ${testfile}
6
7
8verbose "compiling source file now....."
9# Build the shared libraries this test case needs.
10if  { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
11     send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
12}
13global LTRACE
14
15#Run PUT for ltrace.
16spawn $LTRACE -f $srcdir/$subdir/$binfile
17set timeout 4
18expect timeout  {
19        fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!"
20        return
21}
22
23catch "exec $LTRACE -f $srcdir/$subdir/$binfile" exec_output
24# Save the output
25ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace
26
27#check the output of this program.
28verbose "ltrace runtest output: $exec_output\n"
29if [regexp {ELF from incompatible architecture} $exec_output] {
30	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
31	return
32} elseif [ regexp {Operation not permitted} $exec_output ] {
33        fail "Operation not permitted, see testrun.log for details!"
34        return
35} elseif [ regexp {killed by SIGKILL} $exec_output ] {
36        fail "killed by SIGKILL!"
37        return
38}
39
40
41
42set pattern "clone"
43ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
44
45