Home | History | Annotate | Download | only in ltrace.main
      1 # This file was written by Yao Qi <qiyao (at) cn.ibm.com>.
      2 
      3 set testfile "main"
      4 set srcfile ${testfile}.c
      5 set binfile ${testfile}
      6 set libfile "main-lib"
      7 set libsrc $srcdir/$subdir/$libfile.c
      8 set lib_sl $objdir/$subdir/lib$testfile.so
      9 
     10 
     11 if [get_compiler_info $binfile] {
     12   return -1
     13 }
     14 
     15 verbose "compiling source file now....."
     16 if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
     17   || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
     18   send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
     19 }
     20 
     21 # set options for ltrace.
     22 ltrace_options "-l" "libmain.so"
     23 
     24 # Run PUT for ltarce.
     25 set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
     26 
     27 # Check the output of this program.
     28 verbose "ltrace runtest output: $exec_output\n"
     29 if [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 {Couldn't get .hash data} $exec_output ] {
     33 	fail "Couldn't get .hash data!"
     34 	return
     35 }
     36 
     37 # Verify the output by checking numbers of print in main.ltrace.
     38 set pattern "print"
     39 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 10
     40