libdl-simple.exp revision bce43dc15fcd84068182c696a366f5ffb4b2e06d
1set testfile "libdl-simple"
2set srcfile ${testfile}.c
3set binfile ${testfile}
4set libfile "libdl-simple-lib"
5set libsrc $srcdir/$subdir/$libfile.c
6set lib_sl $objdir/$subdir/lib$testfile.so
7
8verbose "compiling source file now....."
9if [get_compiler_info $binfile ""] {
10	return -1
11}
12
13# Build the shared libraries this test case needs.
14if  { [ltrace_compile_shlib $libsrc $lib_sl [debug]] != ""
15      || [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug shlib=-ldl} ] != "" } {
16     send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
17}
18
19# set options for ltrace.
20ltrace_options "-x" "test_libdl"
21
22# Run PUT for ltrace.
23set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
24verbose "ltrace runtest output: $exec_output\n"
25
26# Check the output of this program.
27if [regexp {ELF from incompatible architecture} $exec_output] {
28	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
29	return
30} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
31	fail "Couldn't get .hash data!"
32	return
33}
34
35set pattern "test_libdl@liblibdl-simple.so"
36ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
37