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] Decrease number of threads used by goroutines.go test (take 2)


On Tue, Mar 08, 2011 at 08:04:23AM -0800, Ian Lance Taylor wrote:
> I don't really care what environment variable we use, I just want some
> way to run the full test, without having DejaGNU silently change the
> test on me.  It's perfectly reasonable to have the default check ulimit,
> I just want some way to not check it.

Ok, here is an updated patch which uses both proposed env vars:

GCCGO_RUN_ALL_TESTS=1 makes it fail for me as before (i.e. 10000 threads)

GCC_TEST_RUN_EXPENSIVE=1 makes it run with max($[`ulimit -u`/4], 10000)
threads on Linux native, 10000 everywhere else

by default it is run just with 64 threads

2011-03-08  Jakub Jelinek  <jakub@redhat.com>

	* go.test/go-test.exp: For goroutines.go test if GCCGO_RUN_ALL_TESTS
	is not set in the environment, pass 64 as first argument when not
	running expensive tests or pass max($[`ulimit -u`/4], 10000) on
	Linux native.

--- gcc/testsuite/go.test/go-test.exp.jj	2011-01-15 11:26:32.000000000 +0100
+++ gcc/testsuite/go.test/go-test.exp	2011-03-08 13:23:36.078402148 +0100
@@ -265,6 +265,27 @@ proc go-gc-tests { } {
 	    verbose -log "$test: go_execute_args is $go_execute_args"
 	    set index [string last " $progargs" $test_line]
 	    set test_line [string replace $test_line $index end]
+	} elseif { [string match "*go.test/test/chan/goroutines.go" $test] \
+		   && [getenv GCCGO_RUN_ALL_TESTS] == "" } {
+	    # goroutines.go spawns by default 10000 threads, which is too much
+	    # for many OSes.
+	    if { [getenv GCC_TEST_RUN_EXPENSIVE] == "" } {
+		set go_execute_args 64
+	    } elseif { [ishost "*-linux*" ] && ![is_remote host] && ![is_remote target] } {
+		# On Linux when using low ulimit -u limit, use maximum of
+		# a quarter of that limit and 10000 even when running expensive
+		# tests, otherwise parallel tests might fail after fork failures.
+		set nproc [lindex [remote_exec host {sh -c ulimit\ -u}] 1]
+		if { [string is integer -strict $nproc] } {
+			set nproc [expr $nproc / 4]
+			if { $nproc > 10000 } { set nproc 10000 }
+			if { $nproc < 16 } { set nproc 16 }
+			set go_execute_args $nproc
+		}
+	    }
+	    if { "$go_execute_args" != "" } {
+		verbose -log "$test: go_execute_args is $go_execute_args"
+	    }
 	}
 
 	if { $test_line == "// \$G \$D/\$F\.go && \$L \$F\.\$A && \./\$A\.out >tmp.go &&" \


	Jakub


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