Changeset 1989 in kBuild for vendor/gnumake/current/tests/test_driver.pl
- Timestamp:
- Oct 28, 2008 11:02:45 PM (16 years ago)
- File:
-
- 1 edited
-
vendor/gnumake/current/tests/test_driver.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/tests/test_driver.pl
r900 r1989 7 7 # 8 8 # Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 9 # 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.9 # 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 10 10 # This file is part of GNU Make. 11 11 # 12 # GNU Make is free software; you can redistribute it and/or modify it under the 13 # terms of the GNU General Public License as published by the Free Software 14 # Foundation; either version 2, or (at your option) any later version. 12 # GNU Make is free software; you can redistribute it and/or modify it under 13 # the terms of the GNU General Public License as published by the Free Software 14 # Foundation; either version 3 of the License, or (at your option) any later 15 # version. 15 16 # 16 17 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY 17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details. 18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 20 # details. 19 21 # 20 22 # You should have received a copy of the GNU General Public License along with 21 # GNU Make; see the file COPYING. If not, write to the Free Software 22 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23 # this program. If not, see <http://www.gnu.org/licenses/>. 23 24 24 25 … … 29 30 # variables and then calls &toplevel, which does all the real work. 30 31 31 # $Id: test_driver.pl,v 1.2 1 2007/03/20 03:02:26psmith Exp $32 # $Id: test_driver.pl,v 1.24 2007/11/04 21:54:02 psmith Exp $ 32 33 33 34 … … 48 49 # Yeesh. This whole test environment is such a hack! 49 50 $test_passed = 1; 51 52 53 # Timeout in seconds. If the test takes longer than this we'll fail it. 54 $test_timeout = 5; 50 55 51 56 … … 657 662 } else { 658 663 # See if it is a slash or CRLF problem 659 local ($answer_mod ) = $answer;664 local ($answer_mod, $slurp_mod) = ($answer, $slurp); 660 665 661 666 $answer_mod =~ tr,\\,/,; 662 667 $answer_mod =~ s,\r\n,\n,gs; 663 668 664 $slurp =~ tr,\\,/,; 665 $slurp =~ s,\r\n,\n,gs; 666 667 $answer_matched = ($slurp eq $answer_mod); 669 $slurp_mod =~ tr,\\,/,; 670 $slurp_mod =~ s,\r\n,\n,gs; 671 672 $answer_matched = ($slurp_mod eq $answer_mod); 673 674 # If it still doesn't match, see if the answer might be a regex. 675 if (!$answer_matched && $answer =~ m,^/(.+)/$,) { 676 $answer_matched = ($slurp =~ /$1/); 677 if (!$answer_matched && $answer_mod =~ m,^/(.+)/$,) { 678 $answer_matched = ($slurp_mod =~ /$1/); 679 } 680 } 668 681 } 669 682 … … 766 779 } 767 780 768 # run one command (passed as a list of arg 0 - n), returning 0 on success 769 # and nonzero on failure. 770 771 sub run_command 772 { 773 local ($code); 781 # This runs a command without any debugging info. 782 sub _run_command 783 { 784 my $code; 774 785 775 786 # We reset this before every invocation. On Windows I think there is only … … 778 789 resetENV(); 779 790 791 eval { 792 local $SIG{ALRM} = sub { die "timeout\n"; }; 793 alarm $test_timeout; 794 $code = system @_; 795 alarm 0; 796 }; 797 if ($@) { 798 # The eval failed. If it wasn't SIGALRM then die. 799 $@ eq "timeout\n" or die; 800 801 # Timed out. Resend the alarm to our process group to kill the children. 802 $SIG{ALRM} = 'IGNORE'; 803 kill -14, $$; 804 $code = 14; 805 } 806 807 return $code; 808 } 809 810 # run one command (passed as a list of arg 0 - n), returning 0 on success 811 # and nonzero on failure. 812 813 sub run_command 814 { 780 815 print "\nrun_command: @_\n" if $debug; 781 $code = system @_;782 print "run_command : \"@_\"returned $code.\n" if $debug;816 my $code = _run_command(@_); 817 print "run_command returned $code.\n" if $debug; 783 818 784 819 return $code; … … 792 827 sub run_command_with_output 793 828 { 794 local ($filename) = shift; 795 local ($code); 796 797 # We reset this before every invocation. On Windows I think there is only 798 # one environment, not one per process, so I think that variables set in 799 # test scripts might leak into subsequent tests if this isn't reset--??? 800 resetENV(); 801 829 my $filename = shift; 830 831 print "\nrun_command_with_output($filename): @_\n" if $debug; 802 832 &attach_default_output ($filename); 803 $code = system @_;833 my $code = _run_command(@_); 804 834 &detach_default_output; 805 806 print "run_command_with_output: '@_' returned $code.\n" if $debug; 835 print "run_command_with_output returned $code.\n" if $debug; 807 836 808 837 return $code;
Note:
See TracChangeset
for help on using the changeset viewer.

