automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: avoid spurious failure (line too long in awk)


From: Stefano Lattarini
Subject: [PATCH] tests: avoid spurious failure (line too long in awk)
Date: Sun, 26 Feb 2012 13:32:14 +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 |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/tests/parallel-tests-many.test b/tests/parallel-tests-many.test
index 752ba15..a09dbe5 100755
--- a/tests/parallel-tests-many.test
+++ b/tests/parallel-tests-many.test
@@ -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 \
-- 
1.7.9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]