summaryrefslogtreecommitdiff
path: root/testsuite/ltrace.main/main.exp
blob: ca66debe8d4eaf7715e842fc3a642774b29496f3 (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
# This file was written by Yao Qi <qiyao@cn.ibm.com>.

set testfile "main"
set srcfile ${testfile}.c
set binfile ${testfile}
set libfile "main-lib"
set libsrc $srcdir/$subdir/$libfile.c
set lib_sl $srcdir/$subdir/lib$testfile.so


if [get_compiler_info $binfile] {
  return -1
}

verbose "compiling source file now....."
if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != "" 
  || [ltrace_compile $srcdir/$subdir/$srcfile $srcdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
  send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}

# set options for ltrace.
ltrace_options "-l" "$srcdir/$subdir/libmain.so"

# Run PUT for ltarce.
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
}

# Verify the output by checking numbers of print in main.ltrace.
set pattern "print"
ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 10