# This file was written by Yao Qi <qiyao@cn.ibm.com>.

set testfile "trace-clone"
set srcfile ${testfile}.c
set binfile ${testfile}


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

ltrace_options "-f"
set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]

#check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
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 {Operation not permitted} $exec_output ] {
        fail "Operation not permitted, see testrun.log for details!"
        return
} elseif [ regexp {killed by SIGKILL} $exec_output ] {
        fail "killed by SIGKILL!"
        return
}



set pattern "clone"
ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1