1# This file was written by Yao Qi <qiyao@cn.ibm.com>.
2
3set testfile "main-threaded"
4set srcfile ${testfile}.c
5set binfile ${testfile}
6set libfile "main-lib"
7set libsrc $srcdir/$subdir/$libfile.c
8set lib_sl $objdir/$subdir/lib$testfile.so
9
10
11if [get_compiler_info $binfile] {
12  return -1
13}
14
15verbose "compiling source file now....."
16if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
17  || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl ldflags=-pthread] ] != ""} {
18  send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
19}
20
21# set options for ltrace.
22ltrace_options "-l" "lib$testfile.so" "-f"
23
24# Run PUT for ltarce.
25set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
26
27# Check the output of this program.
28verbose "ltrace runtest output: $exec_output\n"
29if [regexp {ELF from incompatible architecture} $exec_output] {
30	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
31	return
32} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
33	fail "Couldn't get .hash data!"
34	return
35}
36
37# Verify the output by checking numbers of print in main-threaded.ltrace.
38set pattern "print"
39ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 30
40