]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: avoid spurious failure (line too long in awk)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 26 Feb 2012 12:31:00 +0000 (13:31 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 26 Feb 2012 12:31:49 +0000 (13:31 +0100)
* tests/parallel-tests-many.test: Use perl, not awk, to write the
Makefile.am with (deliberately) overly long TESTS content, as some
inferior awk implementations (e.g., Solaris 10 /usr/bin/awk) are
unable to handle the long lines used there and die with errors like:
"awk: string too long near line 5".

tests/parallel-tests-many.test

index 752ba15a432b9bff80bd1b08ed382f80e6dfa47b..a09dbe518ee19ae220e16898e222bd953bad7d5c 100755 (executable)
@@ -87,14 +87,28 @@ END
 
 setup_data ()
 {
-  awk "
-    BEGIN {
-      print \"TESTS = \\\\\"
-      for (i = 1; i < $count; i = i + 1)
-        print \"  $deepdir/$tname-\" i \".test \\\\\"
-      print \"  $deepdir/$tname-\" i \".test\"
-    }
-  " > list-of-tests.am || Exit 99
+  # Use perl, not awk, to avoid errors like "awk: string too long"
+  # (seen e.g. with Solaris 10 /usr/bin/awk).
+  count=$count deepdir=$deepdir tname=$tname $PERL -e '
+    use warnings FATAL => "all";
+    use strict;
+    print "TESTS = \\\n";
+    my $i = 0;
+    while (++$i)
+      {
+        print "  $ENV{deepdir}/$ENV{tname}-$i.test";
+        if ($i >= $ENV{count})
+          {
+            print "\n";
+            last;
+          }
+        else
+          {
+            print " \\\n";
+          }
+      }
+  ' > list-of-tests.am || Exit 99
+  sed 20q list-of-tests.am || Exit 99 # For debugging.
   $AUTOMAKE Makefile \
     || framework_failure_ "unexpected automake failure"
   ./config.status Makefile \