From 3ed45d506259c5599a7f427f01952f8628c96a77 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 5 Oct 1998 04:20:33 +0000 Subject: back out last change --- tests/mk-script | 76 +++++++++------------------------------------------------ 1 file changed, 12 insertions(+), 64 deletions(-) (limited to 'tests/mk-script') diff --git a/tests/mk-script b/tests/mk-script index 579e373be..0f360ac30 100755 --- a/tests/mk-script +++ b/tests/mk-script @@ -15,19 +15,6 @@ use Test; my $srcdir = '.'; -my $sh_copy_args_from_srcdir = <<\EOF; -new_filename_args= -for arg in $filename_args; do - if test -r $arg; then - basename_arg=`echo $arg|sed 's,.*/,,'` - test -f $basename_arg || cp -a $arg . - arg=$basename_arg - fi - new_filename_args="$new_filename_args $arg" -done -filename_args=$new_filename_args -EOF - sub validate { my %seen; @@ -48,14 +35,6 @@ sub validate } } -sub write_file ($$) -{ - my ($filename, $file_contents) = @_; - open F, ">$filename" || die "$0: $filename: $!\n"; - print F $file_contents; - close F || die "$0: $filename: $!\n"; -} - # Given a spec for the input file(s) or expected output file of a single # test, create a file for any string. A file is created for each literal # string -- not for named files. Whether a perl `string' is treated as @@ -64,10 +43,7 @@ sub write_file ($$) # the top level variable to the actual string literal. # If $SPEC is a literal Perl string (not a reference), then treat $SPEC # as the contents of a file. -# If $SPEC is a reference to an empty hash, then there are no inputs. -# If $SPEC is a reference to a nonempty hash, then it must have a single -# key/value pair (both strings) where the key is the name of the file and -# the value is contents desired for that file. +# If $SPEC is a hash reference, then there are no inputs. # If $SPEC is an array reference, consider each element of the array. # If the element is a string reference, treat the string as the name of # an existing file. Otherwise, the element must be a string and is treated @@ -89,30 +65,15 @@ sub spec_to_list ($$$) my @explicit_file; my @maint_gen_file; my @content_string; - my %file_content_pair; - # SPEC is a hash reference. + # If SPEC is a hash reference, return empty lists. if (ref $spec eq 'HASH') { assert ($type eq $In); - if (keys %$spec == 0) - { - # It's an empty hash; return empty lists. - } - else - { - # Currently we don't support lists of FILE,CONTENT pairs. - assert (keys %$spec == 1); - my ($filename, $file_contents) = each %$spec; - $file_content_pair{$filename} = $file_contents; - write_file $filename, $file_contents; - push @maint_gen_file, $filename; - } - return { - EXPLICIT => \@explicit_file, - MAINT_GEN => \@maint_gen_file - }; + EXPLICIT => \@explicit_file, + MAINT_GEN => \@maint_gen_file + }; } if (ref $spec) @@ -154,7 +115,9 @@ sub spec_to_list ($$$) my $suffix = (@content_string > 1 ? $i : ''); my $maint_gen_file = "$test_name$type$suffix"; push (@maint_gen_file, $maint_gen_file); - write_file "$srcdir/$maint_gen_file", $file_contents; + open (F, ">$srcdir/$maint_gen_file") || die "$0: $maint_gen_file: $!\n"; + print F $file_contents; + close (F) || die "$0: $maint_gen_file: $!\n"; ++$i; } @@ -241,9 +204,6 @@ sub wrap my %e = map {$_ => 1} @exp; @exp = sort keys %e; - %e = map {$_ => 1} @maint; - @maint = sort keys %e; - my $len = 77; print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n"; print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n"; @@ -254,7 +214,7 @@ sub wrap print <