mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-05-19 00:41:07 +02:00
60 lines
1.5 KiB
Plaintext
Executable File
60 lines
1.5 KiB
Plaintext
Executable File
#!/p/bin/perl5.000 -w
|
|
|
|
$join = '/usr/bin/join';
|
|
$join = 'join';
|
|
$test = 0;
|
|
$| = 1;
|
|
|
|
print ":\nerrors=0\n";
|
|
$expected = '';
|
|
$flags = '';
|
|
|
|
while (<>)
|
|
{
|
|
next if (/^\s*#/);
|
|
|
|
$test++;
|
|
chop;
|
|
$prog = '($test_name, $flags,$f1,$f2,$expected,$e_ret_code) = ' . $_ . ';';
|
|
eval $prog;
|
|
$in1 = "t$test_name.1";
|
|
$in2 = "t$test_name.2";
|
|
$exp_name = 't' . $test_name . '.exp';
|
|
$out = "t$test_name.out";
|
|
|
|
open(IN, ">$in1") || die "Couldn't open $in1 for writing.\n";
|
|
print IN $f1;
|
|
close(IN);
|
|
open(IN, ">$in2") || die "Couldn't open $in2 for writing.\n";
|
|
print IN $f2;
|
|
close(IN);
|
|
open(EXP, ">$exp_name")
|
|
|| die "Couldn't open $exp_name for writing.\n";
|
|
print EXP $expected;
|
|
close(EXP);
|
|
$cmd = "$join $flags $in1 $in2 > $out";
|
|
print <<EOF ;
|
|
$cmd 2> /dev/null
|
|
code=\$?
|
|
if test \$code != $e_ret_code ; then
|
|
echo Test $test_name failed: join return code \$code differs from expected value $e_ret_code 1>&2
|
|
errors=`expr \$errors + 1`
|
|
else
|
|
cmp $out $exp_name
|
|
case \$? in
|
|
0) if test "\$verbose" ; then echo passed $test_name; fi ;; # equal files
|
|
1) echo Test $test_name failed: files $out and $exp_name differ 1>&2;
|
|
errors=`expr \$errors + 1` ;;
|
|
2) echo Test $test_name may have failed. 1>&2;
|
|
echo The command \"cmp $out $exp_name\" failed. 1>&2 ;
|
|
errors=`expr \$errors + 1` ;;
|
|
esac
|
|
fi
|
|
EOF
|
|
}
|
|
print <<EOF2 ;
|
|
if test \$errors -gt 0 ; then
|
|
echo Failed \$errors tests. 1>&2
|
|
fi
|
|
EOF2
|