451 |
$status = "ok ($tests_passed passed)"; |
$status = "ok ($tests_passed passed)"; |
452 |
for ($i = $num_of_tmpfiles; $i; $i--) |
for ($i = $num_of_tmpfiles; $i; $i--) |
453 |
{ |
{ |
454 |
&delete ($tmp_filename . &num_suffix ($i) ); |
&rmfiles ($tmp_filename . &num_suffix ($i) ); |
455 |
} |
} |
456 |
|
|
457 |
for ($i = $num_of_logfiles ? $num_of_logfiles : 1; $i; $i--) |
for ($i = $num_of_logfiles ? $num_of_logfiles : 1; $i; $i--) |
458 |
{ |
{ |
459 |
&delete ($log_filename . &num_suffix ($i) ); |
&rmfiles ($log_filename . &num_suffix ($i) ); |
460 |
&delete ($base_filename . &num_suffix ($i) ); |
&rmfiles ($base_filename . &num_suffix ($i) ); |
461 |
} |
} |
462 |
} |
} |
463 |
elsif ($code > 0) { |
elsif ($code > 0) { |
500 |
# If the keep flag is not set, this subroutine deletes all filenames that |
# If the keep flag is not set, this subroutine deletes all filenames that |
501 |
# are sent to it. |
# are sent to it. |
502 |
|
|
503 |
sub delete |
sub rmfiles |
504 |
{ |
{ |
505 |
local(@files) = @_; |
local(@files) = @_; |
506 |
|
|
611 |
sub compare_output |
sub compare_output |
612 |
{ |
{ |
613 |
local($answer,$logfile) = @_; |
local($answer,$logfile) = @_; |
614 |
local($slurp); |
local($slurp, $answer_matched) = ('', 0); |
615 |
|
|
616 |
print "Comparing Output ........ " if $debug; |
print "Comparing Output ........ " if $debug; |
617 |
|
|
624 |
|
|
625 |
++$tests_run; |
++$tests_run; |
626 |
|
|
627 |
if ($slurp eq $answer && $test_passed) |
if ($slurp eq $answer) { |
628 |
|
$answer_matched = 1; |
629 |
|
} else { |
630 |
|
# See if it is a slash or CRLF problem |
631 |
|
local ($answer_mod) = $answer; |
632 |
|
|
633 |
|
$answer_mod =~ tr,\\,/,; |
634 |
|
$answer_mod =~ s,\r\n,\n,gs; |
635 |
|
|
636 |
|
$slurp =~ tr,\\,/,; |
637 |
|
$slurp =~ s,\r\n,\n,gs; |
638 |
|
|
639 |
|
$answer_matched = ($slurp eq $answer_mod); |
640 |
|
} |
641 |
|
|
642 |
|
if ($answer_matched && $test_passed) |
643 |
{ |
{ |
644 |
print "ok\n" if $debug; |
print "ok\n" if $debug; |
645 |
++$tests_passed; |
++$tests_passed; |
646 |
return 1; |
return 1; |
647 |
} |
} |
648 |
|
|
649 |
if ($slurp ne $answer) { |
if (! $answer_matched) { |
650 |
print "DIFFERENT OUTPUT\n" if $debug; |
print "DIFFERENT OUTPUT\n" if $debug; |
651 |
|
|
652 |
&create_file (&get_basefile, $answer); |
&create_file (&get_basefile, $answer); |
654 |
print "\nCreating Difference File ...\n" if $debug; |
print "\nCreating Difference File ...\n" if $debug; |
655 |
|
|
656 |
# Create the difference file |
# Create the difference file |
657 |
|
|
658 |
local($command) = "diff -c " . &get_basefile . " " . $logfile; |
local($command) = "diff -c " . &get_basefile . " " . $logfile; |
659 |
&run_command_with_output(&get_difffile,$command); |
&run_command_with_output(&get_difffile,$command); |
|
|
|
660 |
} |
} |
661 |
|
|
662 |
$suite_passed = 0; |
$suite_passed = 0; |
744 |
{ |
{ |
745 |
local ($code); |
local ($code); |
746 |
|
|
747 |
if ($debug) |
print "\nrun_command: @_\n" if $debug; |
748 |
{ |
$code = system @_; |
749 |
print "\nrun_command: @_\n"; |
print "run_command: \"@_\" returned $code.\n" if $debug; |
|
$code = system @_; |
|
|
print "run_command: \"@_\" returned $code.\n"; |
|
|
return $code; |
|
|
} |
|
750 |
|
|
751 |
return system @_; |
return $code; |
752 |
} |
} |
753 |
|
|
754 |
# run one command (passed as a list of arg 0 - n, with arg 0 being the |
# run one command (passed as a list of arg 0 - n, with arg 0 being the |
764 |
&attach_default_output ($filename); |
&attach_default_output ($filename); |
765 |
$code = system @_; |
$code = system @_; |
766 |
&detach_default_output; |
&detach_default_output; |
767 |
if ($debug) |
|
768 |
{ |
print "run_command_with_output: '@_' returned $code.\n" if $debug; |
|
print "run_command_with_output: \"@_\" returned $code.\n"; |
|
|
} |
|
769 |
|
|
770 |
return $code; |
return $code; |
771 |
} |
} |