1 # This file was written by Yao Qi <qiyao (at) cn.ibm.com>. 2 3 set testfile "count-record" 4 set srcfile ${testfile}.c 5 set binfile ${testfile} 6 7 verbose "compiling source file now....." 8 # Build the shared libraries this test case needs. 9 if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } { 10 send_user "Testcase compile failed, so all tests in this file will automatically fail.\n" 11 } 12 13 # set options for ltrace. 14 ltrace_options "-c" 15 16 # Run PUT for ltrace. 17 set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile] 18 19 # Check the output of this program. 20 verbose "ltrace runtest output: $exec_output\n" 21 if [regexp {ELF from incompatible architecture} $exec_output] { 22 fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" 23 return 24 } elseif [ regexp {Couldn't get .hash data} $exec_output ] { 25 fail "Couldn't get .hash data!" 26 return 27 } 28 29 # 30 # This is a sample output and Verify the forth and fifth column. 31 # 32 # 13.31 0.001051 1051 1 rmdir 33 # 12.81 0.001012 1012 1 fopen 34 # 10.32 0.000815 407 2 remove 35 # 9.56 0.000755 755 1 mkdir 36 # 7.86 0.000621 621 1 fseek 37 # 6.86 0.000542 542 1 fwrite 38 # 6.60 0.000521 521 1 fclose 39 # 6.03 0.000476 476 1 rename 40 # 5.61 0.000443 443 1 symlink 41 # 5.05 0.000399 399 1 chdir 42 # 4.80 0.000379 379 1 access 43 # 4.00 0.000316 316 1 __xstat 44 # 3.81 0.000301 301 1 getcwd 45 # 3.39 0.000268 268 1 fread 46 # 47 48 set pattern " 1 rmdir" 49 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 50 set pattern " 1 fopen" 51 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 52 set pattern " 2 remove" 53 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 54 set pattern " 1 mkdir" 55 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 56 set pattern " 1 fseek" 57 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 58 set pattern " 1 fwrite" 59 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 60 set pattern " 1 fclose" 61 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 62 set pattern " 1 rename" 63 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 64 set pattern " 1 symlink" 65 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 66 set pattern " 1 chdir" 67 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 68 set pattern " 1 access" 69 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 70 set pattern " 1 getcwd" 71 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 72 set pattern " 1 fread" 73 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 74 75