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