Home | History | Annotate | Download | only in ltrace.minor
      1 # This file was written by Yao Qi <qiyao (at) cn.ibm.com>.
      2 
      3 set testfile "trace-fork"
      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 ltrace_options "-f"
     15 set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
     16 
     17 #check the output of this program.
     18 verbose "ltrace runtest output: $exec_output\n"
     19 if [regexp {ELF from incompatible architecture} $exec_output] {
     20 	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
     21 	return
     22 } elseif [ regexp {Couldn't get .hash data} $exec_output ] {
     23 	fail "Couldn't get .hash data!"
     24 	return
     25 }
     26 
     27 if [ regexp {Cannot attach} $exec_output ] {
     28 	fail "Couldn't attach to forked process!"
     29 	return
     30 }
     31 
     32 set pattern {^[0-9]* fork}
     33 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
     34 
     35 set pattern {^[0-9]* printf}
     36 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
     37 
     38 set pattern {^[0-9]* puts}
     39 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
     40 
     41 set pattern {^[0-9]* wait}
     42 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
     43 
     44 set pattern {^[0-9]* sleep}
     45 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
     46