tests: remove directory, tests/join/
authorJim Meyering <meyering@redhat.com>
Sat, 10 May 2008 10:11:52 +0000 (12:11 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 10 May 2008 11:35:30 +0000 (13:35 +0200)
* configure.ac (AC_CONFIG_FILES): Remove tests/join/Makefile.
* tests/misc/join: New file, with tests from...
* tests/join/Test.pm: ...here.  Remove file.
* tests/Makefile.am (SUBDIRS): Remove definition.

.gitignore
configure.ac
tests/Makefile.am
tests/misc/join [moved from tests/join/Test.pm with 83% similarity, mode: 0755]

index 02303c4..a14320b 100644 (file)
@@ -67,5 +67,3 @@ po/coreutils.pot
 po/stamp-po
 stamp-h1
 tests/*/*.log
-tests/join/Makefile.am
-tests/join/join-tests
index 2638bac..6efb2aa 100644 (file)
@@ -347,6 +347,5 @@ AC_CONFIG_FILES(
   src/Makefile
   tests/Makefile
   gnulib-tests/Makefile
-  tests/join/Makefile
   )
 AC_OUTPUT
index dec7b44..1e36325 100644 (file)
@@ -22,10 +22,6 @@ EXTRA_DIST =         \
   test-lib.sh          \
   $(pr_data)
 
-## N O T E :: Do not add more names to this list.
-## N O T E :: Even these are expected to go away.
-SUBDIRS = join
-
 root_tests =                                   \
   chown/basic                                  \
   cp/cp-a-selinux                              \
@@ -138,6 +134,7 @@ TESTS =                                             \
   misc/mktemp                                  \
   misc/arch                                    \
   misc/pr                                      \
+  misc/join                                    \
   pr/pr-tests                                  \
   misc/df-P                                    \
   misc/pwd-unreadable-parent                   \
old mode 100644 (file)
new mode 100755 (executable)
similarity index 83%
rename from tests/join/Test.pm
rename to tests/misc/join
index 74fb326..bfb0d01
@@ -1,6 +1,7 @@
-# Test "join".
+#!/bin/sh
+# Test join.
 
-# Copyright (C) 1996, 1999-2000, 2003-2004, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-package Test;
-require 5.002;
+: ${srcdir=.}
+. $top_srcdir/tests/require-perl
+
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$top_srcdir/tests -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
+require 5.003;
 use strict;
 
+# Turn off localization of executable's output.
+@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
+my $prog = 'join';
+
 my $delim = chr 0247;
 sub t_subst ($)
 {
@@ -138,7 +148,8 @@ my @tv = (
  ["a\n", "b\n"], " a b\n", 0],
 
 # FIXME: change this to ensure the diagnostic makes sense
-['invalid-j', '-j x', {}, "", 1],
+['invalid-j', '-j x', {}, "", 1,
+ "$prog: invalid field number: `x'\n"],
 
 # With ordering check, inputs in order
 ['chkodr-1', '--check-order',
@@ -160,7 +171,8 @@ my @tv = (
 
 # With check, both inputs out of order (in fact, in reverse order)
 ['chkodr-5', '--check-order',
- [" b 1\n a 2\n", " b Y\n a Z\n"], "", 1],
+ [" b 1\n a 2\n", " b Y\n a Z\n"], "", 1,
+ "$prog: File 1 is not in sorted order\n"],
 
 # Without order check, both inputs out of order and some lines
 # unpairable.  This is NOT supported by the GNU extension.  All that
@@ -174,13 +186,42 @@ my @tv = (
 # Before 6.10.143, this would mistakenly fail with the diagnostic:
 # join: File 1 is not in sorted order
 ['chkodr-7', '-12', ["2 a\n1 b\n", ""], "", 0],
-)
-;
-
-
-sub test_vector
-{
-  return @tv;
-}
-
-1;
+);
+
+# Convert the above old-style test vectors to the newer
+# format used by Coreutils.pm.
+
+my @Tests;
+foreach my $t (@tv)
+  {
+    my ($test_name, $flags, $in, $exp, $ret, $err_msg) = @$t;
+    my $new_ent = [$test_name, $flags];
+    if (!ref $in)
+      {
+        push @$new_ent, {IN=>$in};
+      }
+    elsif (ref $in eq 'HASH')
+      {
+        # ignore
+      }
+    else
+      {
+        foreach my $e (@$in)
+          {
+            push @$new_ent, {IN=>$e};
+          }
+      }
+    push @$new_ent, {OUT=>$exp};
+    $ret
+      and push @$new_ent, {EXIT=>$ret}, {ERR=>$err_msg};
+    push @Tests, $new_ent;
+  }
+
+@Tests = triple_test \@Tests;
+
+my $save_temps = $ENV{DEBUG};
+my $verbose = $ENV{VERBOSE};
+
+my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
+exit $fail;
+EOF