[Libsysio-commit] HEAD: libsysio/tests test_all.pl test_copy.pl
Brought to you by:
lward
From: Sonja T. <so...@us...> - 2004-05-05 19:05:47
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24293/tests Modified Files: test_all.pl test_copy.pl Log Message: More test fixes: -- Don't remove the tmp directory if a test failed, to allow for someone to investigate the failure. Perhaps this should be a switch??? -- In test_copy.pl, check the output status of comparison to distinguish between the case where the two files differ and the case where the comparison command returned some failure Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- test_all.pl 3 May 2004 21:07:13 -0000 1.11 +++ test_all.pl 5 May 2004 19:05:36 -0000 1.12 @@ -204,7 +204,8 @@ if ($res ne "strided IO test successful" print "$failures tests failed and $success tests succeeded\n"; -# cleanup +# cleanup -- only if no failures +if ($failures == 0) { if ($use_system == 1) { system(`rm -rf $cwd/tmp_dir`); } else { @@ -215,4 +216,5 @@ if ($use_system == 1) { exit 1; } } +} exit $failures; Index: test_copy.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- test_copy.pl 3 May 2004 21:07:13 -0000 1.7 +++ test_copy.pl 5 May 2004 19:05:37 -0000 1.8 @@ -172,9 +172,16 @@ sub process_cmd helper::send_cmd($cmdfh, $outfh, "close", $cmdstr); } if ($src ne "/dev/stdin") { - my $cmpres = system("cmp -s $src $dest"); - if ($cmpres != 0) { + my $cmd = "cmp $src $dest " . '2>&1'; + my $cmpstr = qx($cmd); + my $exitval = $? >> 8; + if ($exitval != 0) { + if ($exitval == 1) { print STDOUT "ERROR! File $src differs from $dest\n"; + print STDOUT "Comparison returned $cmpstr"; + } else { + print STDOUT "ERROR! File comparison failed with msg $cmpstr"; + } exit 1; } } |