diff options
author | Jim Meyering <jim@meyering.net> | 1994-11-07 12:47:50 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-11-07 12:47:50 +0000 |
commit | cb4c5aaf0a1884bcae21c7d31b70864e64bb55fa (patch) | |
tree | 9dc6a5b7b0ee4449a7513c29f79f552ff01b93fc /tests/join/build-script | |
parent | 87615079293ffe40e844d1d6138572ac33967d3c (diff) | |
download | coreutils-cb4c5aaf0a1884bcae21c7d31b70864e64bb55fa.tar.xz |
Initial revision
Diffstat (limited to 'tests/join/build-script')
-rwxr-xr-x | tests/join/build-script | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/join/build-script b/tests/join/build-script new file mode 100755 index 000000000..ab064d5cb --- /dev/null +++ b/tests/join/build-script @@ -0,0 +1,59 @@ +#!/p/bin/perl5.000 -w + +$tr = '../tr +io 5'; +$tr = 'tr'; +$test = 0; +$| = 1; + +print ":\nerrors=0\n"; +$expected = ''; +$s1 = ''; +$input = ''; +$flags = ''; +$s1 = ''; + +while (<>) + { + next if (/^\s*#/); + + $test++; + chop; + $prog = '($test_name, $input,$flags,$s1,$s2,$expected,$e_ret_code) = ' . $_ . ';'; + eval $prog; + $in = "t$test_name.in"; + $exp_name = 't' . $test_name . '.exp'; + $out = "t$test_name.out"; + + open(IN, ">$in") || die "Couldn't open $in for writing.\n"; + print IN $input; + close(IN); + open(EXP, ">$exp_name") + || die "Couldn't open $exp_name for writing.\n"; + print EXP $expected; + close(EXP); + $arg2 = ($s2 ? "'$s2'" : ''); + $cmd = "$tr $flags \'$s1\' $arg2 < $in > $out"; + print <<EOF ; +$cmd 2> /dev/null +code=\$? +if test \$code != $e_ret_code ; then + echo Test $test_name failed: tr 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 |