1# This file was written by Yao Qi <qiyao@cn.ibm.com>.
2
3set testfile "signals"
4set srcfile ${testfile}.c
5set binfile ${testfile}
6
7
8verbose "compiling source file now....."
9# Build the shared libraries this test case needs.
10if  { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
11     send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
12}
13
14# set options for ltrace.
15ltrace_options "-L"
16
17# Run PUT for ltarce.
18set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
19
20# Check the output of this program.
21verbose "ltrace runtest output: $exec_output\n"
22if [regexp {ELF from incompatible architecture} $exec_output] {
23	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
24     	return
25} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
26	fail "Couldn't get .hash data!"
27	return
28}
29
30# Extract LOOP from source file.
31set fd [ open $srcdir/$subdir/$srcfile r]
32while { [gets $fd line] >= 0 } {
33	 regexp {define LOOP.*([0-9]+)} $line match count
34}
35close $fd
36
37# Verify the output of ltrace by checking the number of SIGUSR1 in signal.ltrace
38set pattern "SIGUSR1"
39ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern $count
40