# This file was written by Yao Qi . set testfile "demangle" set srcfile ${testfile}.cpp set binfile ${testfile} set libfile "demangle-lib" set libsrc $srcdir/$subdir/$libfile.cpp set lib_sl $srcdir/$subdir/lib$testfile.so verbose "compiling source file now....." if [get_compiler_info $binfile "c++"] { return -1 } verbose "compiling source file now....." if { [ltrace_compile_shlib $libsrc $lib_sl [list debug c++]] != "" || [ltrace_compile $srcdir/$subdir/$srcfile $srcdir/$subdir/$binfile executable [list debug shlib=$lib_sl c++] ] != ""} { send_user "Testcase compile failed, so all tests in this file will automatically fail.\n" } # set options for ltrace. ltrace_options "-C" # Run PUT for ltrace. set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile] # Check the output of this program. verbose "ltrace runtest output: $exec_output\n" if [regexp {ELF from incompatible architecture} $exec_output] { fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" return } elseif [ regexp {Couldn't get .hash data} $exec_output ] { fail "Couldn't get .hash data!" return } # read function declarations from demangle.cpp and verify them in demangle.ltrace. set fd [ open $srcdir/$subdir/$srcfile r] while { [gets $fd line] >= 0 } { if [regexp {extern (double|float|void|char|int|short|long|void \*|void \*\*) ([^ ])\(} $line match type fun] { ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $fun } } close $fd #read member fucntions of classs from demangle-lib.cpp and verify them in demagle.ltrace. set fd [ open $srcdir/$subdir/$testfile-lib.cpp r] while { [gets $fd line] >= 0 } { if [ regexp {((myclass|nested)::[^\(]*)\(} $line match fun] { # For Debug purpose. verbose "fun = $fun" # Extract new/delete for remove extra SPACE in $fun, for example, # $fun = "myclass::operator delete" will confuse ltrace_verify_output if it # was an argument to it. if [regexp {(new|delete)} $fun match sub_fun] { ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $sub_fun } else { # Verify class member functions without SPACE. ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $fun } } } close $fd