1 # This file is part of ltrace. 2 # Copyright (C) 2012 Petr Machata, Red Hat Inc. 3 # 4 # This program is free software; you can redistribute it and/or 5 # modify it under the terms of the GNU General Public License as 6 # published by the Free Software Foundation; either version 2 of the 7 # License, or (at your option) any later version. 8 # 9 # This program is distributed in the hope that it will be useful, but 10 # WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 # General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with this program; if not, write to the Free Software 16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 # 02110-1301 USA 18 19 set testfile "branch_func" 20 set srcfile ${testfile}.c 21 set binfile ${testfile} 22 23 if [get_compiler_info $binfile] { 24 return -1 25 } 26 27 verbose "compiling source file now....." 28 if { [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable {debug} ] != "" } { 29 send_user "Testcase compile failed, so all tests in this file will automatically fail\n." 30 } 31 32 # set options for ltrace. 33 ltrace_options "-x" "func1" "-x" "func2" "-x" "func3" 34 35 # Run PUT for ltarce. 36 set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile] 37 38 # Check the output of this program. 39 verbose "ltrace runtest output: $exec_output\n" 40 if [regexp {ELF from incompatible architecture} $exec_output] { 41 fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" 42 return 43 } elseif [ regexp {Couldn't get .hash data} $exec_output ] { 44 fail "Couldn't get .hash data!" 45 return 46 } 47 48 set pattern "func1(.*unfinished" 49 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100 50 set pattern "func2(.*unfinished" 51 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100 52 set pattern "func3(.*)" 53 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100 54 set pattern "func2.resumed" 55 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100 56 set pattern "func1.resumed" 57 ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100 58