blob: c2d3aeb00f059033ab8cd9cb940244218ef808d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# This file was written by Yao Qi <qiyao@cn.ibm.com>.
set testfile "demangle"
set srcfile ${testfile}.cpp
set binfile ${testfile}
set libfile "demangle-lib"
set libsrc $srcdir/$subdir/$libfile.cpp
set lib_sl $objdir/$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 $objdir/$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 $objdir/$subdir $objdir/$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 ${objdir}/${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 ${objdir}/${subdir}/${testfile}.ltrace $sub_fun
} else {
# Verify class member functions without SPACE.
ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $fun
}
}
}
close $fd
|