This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Adjust dg-extract-results.sh for lame awk implementations (PR testsuite/39807)


Hi!

Apparently as reported in the PR some awk implementations can't handle more
than a few concurrently opened files (or is it extremely low system limit on
number of open files?).

I've bootstrapped/regtested this on x86_64-linux and i686-linux (where I
can't reproduce it though) and Andrew said in the PR that this fixes it on
powerpc-darwin.

Ok for trunk, 4.4.1 and 4.3?

2009-04-20  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/39807
	* dg-extract-results.sh: Close open files and use >> instead of >
	to decrease number of concurrently open files from awk.

--- contrib/dg-extract-results.sh.jj	2008-10-28 10:19:58.000000000 +0100
+++ contrib/dg-extract-results.sh	2009-04-20 10:39:23.000000000 +0200
@@ -6,7 +6,7 @@
 # The resulting file can be used with test result comparison scripts for
 # results from tests that were run in parallel.  See usage() below.
 
-# Copyright (C) 2008 Free Software Foundation
+# Copyright (C) 2008, 2009 Free Software Foundation
 # Contributed by Janis Johnson <janis187@us.ibm.com>
 #
 # This file is part of GCC.
@@ -162,11 +162,13 @@ BEGIN {
   next
 }
 /^Running chapter / {
+  if (chapter) close ("${TMP}/chapter-"chapter)
   chapter=\$3
-  print > "${TMP}/chapter-"chapter
+  print >> "${TMP}/chapter-"chapter
   next
 }
 /=== acats Summary ===/ {
+  if (chapter) close ("${TMP}/chapter-"chapter)
   chapter=""
   insummary=1
   next
@@ -182,7 +184,7 @@ BEGIN {
 }
 {
   if (print_prologue) { print; next }
-  if (chapter) print > "${TMP}/chapter-"chapter
+  if (chapter) print >> "${TMP}/chapter-"chapter
 }
 END {
   system ("cat ${TMP}/chapter-*")
@@ -194,6 +196,7 @@ END {
 }
 EOF
 
+  rm -f ${TMP}/chapter-*
   $AWK -f $ACATS_AWK $SUM_FILES
   exit 0
 fi
@@ -270,6 +273,7 @@ BEGIN {
   expfileno=1
   cnt=0
   print_using=0
+  need_close=0
 }
 /^EXPFILE: / {
   expfiles[expfileno] = \$2
@@ -287,8 +291,10 @@ BEGIN {
 /^Running / {
   print_using=0
   if (variant == curvar) {
+    if (need_close) close(curfile)
     curfile="${TMP}/list"expfilesr[\$2]
     expfileseen[\$2]=expfileseen[\$2] + 1
+    need_close=0
     testname="00"
     next
   }
@@ -303,11 +309,12 @@ BEGIN {
 /^$/ { if ("$MODE" == "sum") next }
 { if (variant == curvar && curfile) {
     if ("$MODE" == "sum") {
-      printf "%s %08d|", testname, cnt > curfile
+      printf "%s %08d|", testname, cnt >> curfile
       cnt = cnt + 1
     }
     filewritten[curfile]=1
-    print > curfile
+    need_close=1
+    print >> curfile
   } else
     next
 }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]