1# This file was written by Yao Qi <qiyao@cn.ibm.com>. 2 3set testfile "count-record" 4set srcfile ${testfile}.c 5set binfile ${testfile} 6 7verbose "compiling source file now....." 8# Build the shared libraries this test case needs. 9if { [ 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. 14ltrace_options "-c" 15 16# Run PUT for ltrace. 17set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile] 18 19# Check the output of this program. 20verbose "ltrace runtest output: $exec_output\n" 21if [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 48set pattern " 1 rmdir" 49ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 50set pattern " 1 fopen" 51ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 52set pattern " 2 remove" 53ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 54set pattern " 1 mkdir" 55ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 56set pattern " 1 fseek" 57ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 58set pattern " 1 fwrite" 59ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 60set pattern " 1 fclose" 61ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 62set pattern " 1 rename" 63ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 64set pattern " 1 symlink" 65ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 66set pattern " 1 chdir" 67ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 68set pattern " 1 access" 69ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 70set pattern " 1 getcwd" 71ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 72set pattern " 1 fread" 73ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 74 75