summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-12-18 05:29:52 +0000
committerJim Meyering <jim@meyering.net>1996-12-18 05:29:52 +0000
commit0b3d6614806f2dd7038a0906f88e79e480331ce3 (patch)
tree6b0d68b52086b3d6c83500c18821c0e2cc20faec
parent33448d128aaca6b55dd30c25d553c635887be1a0 (diff)
downloadcoreutils-0b3d6614806f2dd7038a0906f88e79e480331ce3.tar.xz
in progress...
-rw-r--r--tests/cut/mk-script.pl57
-rw-r--r--tests/head/mk-script.pl57
-rw-r--r--tests/join/mk-script.pl57
-rw-r--r--tests/ls/mk-script.pl57
4 files changed, 144 insertions, 84 deletions
diff --git a/tests/cut/mk-script.pl b/tests/cut/mk-script.pl
index ab2c6f112..e0e345274 100644
--- a/tests/cut/mk-script.pl
+++ b/tests/cut/mk-script.pl
@@ -9,6 +9,26 @@ use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use Test;
+sub validate
+{
+ my %seen;
+ my $test_vector;
+ foreach $test_vector (@Test::t)
+ {
+ my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
+ @{$test_vector};
+ assert (defined $e_ret_code && !defined $rest);
+ assert (!ref $test_name);
+ assert (!ref $flags);
+ assert (!ref $expected);
+ assert (!ref $e_ret_code);
+
+ die "$0: $.: duplicate test name \`$test_name'\n"
+ if (defined $seen{$test_name});
+ $seen{$test_name} = 1;
+ }
+}
+
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
@@ -75,8 +95,20 @@ sub spec_to_list ($$$)
{
$| = 1;
+ die "Usage: $0: program-name\n" if @ARGV != 1;
+
my $xx = $ARGV[0];
+ if ($xx eq '--list-generated')
+ {
+ validate ();
+ # FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ # Output two lists of files:
+ # MAINT_GEN -- maintainer-generated files
+ # RUN_GEN -- files created when running the tests
+ exit 0;
+ }
+
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
@@ -91,30 +123,12 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
- my %seen;
-
- my $test_vector;
-
- foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
- @{$test_vector};
- assert (defined $e_ret_code && !defined $rest);
- assert (!ref $test_name);
- assert (!ref $flags);
- assert (!ref $expected);
- assert (!ref $e_ret_code);
-
- die "$0: $.: duplicate test name \`$test_name'\n"
- if (defined $seen{$test_name});
- $seen{$test_name} = 1;
- }
-}
+validate ();
my $test_vector;
foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
+{
+ my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @{$test_vector};
my $in = spec_to_list ($in_spec, $test_name, 'in');
@@ -163,3 +177,4 @@ fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
+}
diff --git a/tests/head/mk-script.pl b/tests/head/mk-script.pl
index ab2c6f112..e0e345274 100644
--- a/tests/head/mk-script.pl
+++ b/tests/head/mk-script.pl
@@ -9,6 +9,26 @@ use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use Test;
+sub validate
+{
+ my %seen;
+ my $test_vector;
+ foreach $test_vector (@Test::t)
+ {
+ my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
+ @{$test_vector};
+ assert (defined $e_ret_code && !defined $rest);
+ assert (!ref $test_name);
+ assert (!ref $flags);
+ assert (!ref $expected);
+ assert (!ref $e_ret_code);
+
+ die "$0: $.: duplicate test name \`$test_name'\n"
+ if (defined $seen{$test_name});
+ $seen{$test_name} = 1;
+ }
+}
+
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
@@ -75,8 +95,20 @@ sub spec_to_list ($$$)
{
$| = 1;
+ die "Usage: $0: program-name\n" if @ARGV != 1;
+
my $xx = $ARGV[0];
+ if ($xx eq '--list-generated')
+ {
+ validate ();
+ # FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ # Output two lists of files:
+ # MAINT_GEN -- maintainer-generated files
+ # RUN_GEN -- files created when running the tests
+ exit 0;
+ }
+
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
@@ -91,30 +123,12 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
- my %seen;
-
- my $test_vector;
-
- foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
- @{$test_vector};
- assert (defined $e_ret_code && !defined $rest);
- assert (!ref $test_name);
- assert (!ref $flags);
- assert (!ref $expected);
- assert (!ref $e_ret_code);
-
- die "$0: $.: duplicate test name \`$test_name'\n"
- if (defined $seen{$test_name});
- $seen{$test_name} = 1;
- }
-}
+validate ();
my $test_vector;
foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
+{
+ my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @{$test_vector};
my $in = spec_to_list ($in_spec, $test_name, 'in');
@@ -163,3 +177,4 @@ fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
+}
diff --git a/tests/join/mk-script.pl b/tests/join/mk-script.pl
index ab2c6f112..e0e345274 100644
--- a/tests/join/mk-script.pl
+++ b/tests/join/mk-script.pl
@@ -9,6 +9,26 @@ use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use Test;
+sub validate
+{
+ my %seen;
+ my $test_vector;
+ foreach $test_vector (@Test::t)
+ {
+ my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
+ @{$test_vector};
+ assert (defined $e_ret_code && !defined $rest);
+ assert (!ref $test_name);
+ assert (!ref $flags);
+ assert (!ref $expected);
+ assert (!ref $e_ret_code);
+
+ die "$0: $.: duplicate test name \`$test_name'\n"
+ if (defined $seen{$test_name});
+ $seen{$test_name} = 1;
+ }
+}
+
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
@@ -75,8 +95,20 @@ sub spec_to_list ($$$)
{
$| = 1;
+ die "Usage: $0: program-name\n" if @ARGV != 1;
+
my $xx = $ARGV[0];
+ if ($xx eq '--list-generated')
+ {
+ validate ();
+ # FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ # Output two lists of files:
+ # MAINT_GEN -- maintainer-generated files
+ # RUN_GEN -- files created when running the tests
+ exit 0;
+ }
+
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
@@ -91,30 +123,12 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
- my %seen;
-
- my $test_vector;
-
- foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
- @{$test_vector};
- assert (defined $e_ret_code && !defined $rest);
- assert (!ref $test_name);
- assert (!ref $flags);
- assert (!ref $expected);
- assert (!ref $e_ret_code);
-
- die "$0: $.: duplicate test name \`$test_name'\n"
- if (defined $seen{$test_name});
- $seen{$test_name} = 1;
- }
-}
+validate ();
my $test_vector;
foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
+{
+ my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @{$test_vector};
my $in = spec_to_list ($in_spec, $test_name, 'in');
@@ -163,3 +177,4 @@ fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
+}
diff --git a/tests/ls/mk-script.pl b/tests/ls/mk-script.pl
index ab2c6f112..e0e345274 100644
--- a/tests/ls/mk-script.pl
+++ b/tests/ls/mk-script.pl
@@ -9,6 +9,26 @@ use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use Test;
+sub validate
+{
+ my %seen;
+ my $test_vector;
+ foreach $test_vector (@Test::t)
+ {
+ my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
+ @{$test_vector};
+ assert (defined $e_ret_code && !defined $rest);
+ assert (!ref $test_name);
+ assert (!ref $flags);
+ assert (!ref $expected);
+ assert (!ref $e_ret_code);
+
+ die "$0: $.: duplicate test name \`$test_name'\n"
+ if (defined $seen{$test_name});
+ $seen{$test_name} = 1;
+ }
+}
+
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
@@ -75,8 +95,20 @@ sub spec_to_list ($$$)
{
$| = 1;
+ die "Usage: $0: program-name\n" if @ARGV != 1;
+
my $xx = $ARGV[0];
+ if ($xx eq '--list-generated')
+ {
+ validate ();
+ # FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ # Output two lists of files:
+ # MAINT_GEN -- maintainer-generated files
+ # RUN_GEN -- files created when running the tests
+ exit 0;
+ }
+
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
@@ -91,30 +123,12 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
- my %seen;
-
- my $test_vector;
-
- foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
- @{$test_vector};
- assert (defined $e_ret_code && !defined $rest);
- assert (!ref $test_name);
- assert (!ref $flags);
- assert (!ref $expected);
- assert (!ref $e_ret_code);
-
- die "$0: $.: duplicate test name \`$test_name'\n"
- if (defined $seen{$test_name});
- $seen{$test_name} = 1;
- }
-}
+validate ();
my $test_vector;
foreach $test_vector (@Test::t)
- {
- my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
+{
+ my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @{$test_vector};
my $in = spec_to_list ($in_spec, $test_name, 'in');
@@ -163,3 +177,4 @@ fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
+}