Message ID | 20140911075123.GN17454@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Thu, Sep 11, 2014 at 09:51:23AM +0200, Jakub Jelinek wrote: > I can't find how to query the -jN value passed to make check by the user > though, both $(MFLAGS) and $(MAKEFLAGS) only contain something like > --jobserver-fds=3,5 -j from which it is not possible to find out how many > goals would be the upper reasonable limit. Running too many goals would > waste time (once scheduled, the goal would only wildcard all the test, and > for all of them find in the *-parallel directory the test has been run > already), running too few could prevent good parallelization. After a little googling, it seems there is no way to do that :(, unless one e.g. attempts to find the command line of the topmost parent make and scan it through ps or something. There is an option to touch say *-parallel/finished file once any of the check-parallel-gcc-{1,2,...} goals is done (because when it finishes, it means all the tests for the particular check-$lang that are parallelizable have either finished, or at least touched their file) and not start runtest at all if finished already exists, but guess it would be still undesirable to have tens of thousands of goals by default, so perhaps we could go with say 128 subgoals by default and have some env var to override it, so on the really highly parallel boxes you'd specify make -j512 -k check GCC_TEST_PARALLEL_SLOTS=512 or similar. Jakub
--- gcc/testsuite/lib/gcc-defs.exp.jj 2014-09-01 09:43:28.000000000 +0200 +++ gcc/testsuite/lib/gcc-defs.exp 2014-09-11 08:37:43.871943270 +0200 @@ -188,6 +188,30 @@ if { [info procs runtest_file_p] == "" } } } +if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \ + && [info procs runtest_file_p] != [list] \ + && [info procs gcc_parallelize_saved_runtest_file_p] == [list] } then { + rename runtest_file_p gcc_parallelize_saved_runtest_file_p + global gcc_runtest_parallelize_counter + + set gcc_runtest_parallelize_counter 0 + proc runtest_file_p { runtests testcase } { + global gcc_runtest_parallelize_counter + if ![gcc_parallelize_saved_runtest_file_p $runtests $testcase] { + return 0 + } + + set dir [getenv GCC_RUNTEST_PARALLELIZE_DIR] + set path $dir/$gcc_runtest_parallelize_counter + set gcc_runtest_parallelize_counter [expr {$gcc_runtest_parallelize_counter + 1}] + if {![catch {open $path {RDWR CREAT EXCL} 0600} fd]} { + close $fd + return 1 + } + return 0 + } +} + # Like dg-options, but adds to the default options rather than replacing them. proc dg-additional-options { args } {