Blob Blame History Raw
set testfile "libdl-simple"
set srcfile ${testfile}.c
set binfile ${testfile}
set libfile "libdl-simple-lib"
set libsrc $srcdir/$subdir/$libfile.c
set lib_sl $objdir/$subdir/lib$testfile.so

verbose "compiling source file now....."
if [get_compiler_info $binfile ""] {
	return -1
}

# Build the shared libraries this test case needs.
if  { [ltrace_compile_shlib $libsrc $lib_sl [debug]] != ""
      || [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug shlib=-ldl} ] != "" } {
     send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}

# set options for ltrace.
ltrace_options "-x" "test_libdl"

# Run PUT for ltrace.
set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
verbose "ltrace runtest output: $exec_output\n"

# Check the output of this program.
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
}

set pattern "test_libdl@liblibdl-simple.so"
ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1