diff mbox

[testsuite] : Fix detection of -j make argument

Message ID CAFULd4bk9HLkQtAqkOtVpyHwUuJCjb7y43EsX54szSP048x6sw@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 22, 2016, 12:25 p.m. UTC
Hello!

New makes (e.g. GNU Make 4.2.1) pass -j argument in MFLAGS is a
different way. While older makes pass only "-j", newer makes pass e.g.
"-j4" when -j is specified on the command line. The detection of "-j"
make argument doesn't work in the later case.

Attached patch reworks this functionality to detect -j correctly in all cases.

gcc/ChangeLog

2016-11-22  Uros Bizjak  <ubizjak@gmail.com>

    * Makefile.in ($(lang_checks_parallelized)): Fix detection
    of -j argument.

gcc/ada/ChangeLog

2016-11-22  Uros Bizjak  <ubizjak@gmail.com>

    * gcc-interface/Make-lang.in (check-acats): Fix detection
    of -j argument.

libstdc++-v3/ChangeLog

2016-11-22  Uros Bizjak  <ubizjak@gmail.com>

    * testsuite/Makefile.am
    (check-DEJAGNU $(check_DEJAGNU_normal_targets)):Fix detection
    of -j argument.
    * testsuite/Makefile.in: Regenereate.

Patch was bootstrapped and regression tested on x86_64-linux-gnu with
"GNU Make 4.2.1" and "GNU Make 3.81". Ada was not checked, but the
change is consistent with other changes.

OK for mainline SVN and release branches?

Uros.

Comments

Jonathan Wakely Nov. 22, 2016, 1:30 p.m. UTC | #1
On 22/11/16 13:25 +0100, Uros Bizjak wrote:
>OK for mainline SVN and release branches?

Yes, the libstdc++ parts are ok, thanks.
Jeff Law Nov. 22, 2016, 3:09 p.m. UTC | #2
On 11/22/2016 05:25 AM, Uros Bizjak wrote:
> Hello!
>
> New makes (e.g. GNU Make 4.2.1) pass -j argument in MFLAGS is a
> different way. While older makes pass only "-j", newer makes pass e.g.
> "-j4" when -j is specified on the command line. The detection of "-j"
> make argument doesn't work in the later case.
>
> Attached patch reworks this functionality to detect -j correctly in all cases.
>
> gcc/ChangeLog
>
> 2016-11-22  Uros Bizjak  <ubizjak@gmail.com>
>
>     * Makefile.in ($(lang_checks_parallelized)): Fix detection
>     of -j argument.
>
> gcc/ada/ChangeLog
>
> 2016-11-22  Uros Bizjak  <ubizjak@gmail.com>
>
>     * gcc-interface/Make-lang.in (check-acats): Fix detection
>     of -j argument.
>
> libstdc++-v3/ChangeLog
>
> 2016-11-22  Uros Bizjak  <ubizjak@gmail.com>
>
>     * testsuite/Makefile.am
>     (check-DEJAGNU $(check_DEJAGNU_normal_targets)):Fix detection
>     of -j argument.
>     * testsuite/Makefile.in: Regenereate.
>
> Patch was bootstrapped and regression tested on x86_64-linux-gnu with
> "GNU Make 4.2.1" and "GNU Make 3.81". Ada was not checked, but the
> change is consistent with other changes.
>
> OK for mainline SVN and release branches?
OK on the rest of the bits, for the trunk and any release branches.

jeff
Marc Glisse Nov. 22, 2016, 3:54 p.m. UTC | #3
On Tue, 22 Nov 2016, Uros Bizjak wrote:

> New makes (e.g. GNU Make 4.2.1) pass -j argument in MFLAGS is a
> different way. While older makes pass only "-j", newer makes pass e.g.
> "-j4" when -j is specified on the command line. The detection of "-j"
> make argument doesn't work in the later case.
>
> Attached patch reworks this functionality to detect -j correctly in all cases.

Hello,

I didn't read the patch, but do you think this also fixes PR 53155 ?
Jonathan Wakely Nov. 22, 2016, 4:21 p.m. UTC | #4
On 22/11/16 16:54 +0100, Marc Glisse wrote:
>On Tue, 22 Nov 2016, Uros Bizjak wrote:
>
>>New makes (e.g. GNU Make 4.2.1) pass -j argument in MFLAGS is a
>>different way. While older makes pass only "-j", newer makes pass e.g.
>>"-j4" when -j is specified on the command line. The detection of "-j"
>>make argument doesn't work in the later case.
>>
>>Attached patch reworks this functionality to detect -j correctly in all cases.
>
>Hello,
>
>I didn't read the patch, but do you think this also fixes PR 53155 ?

No, probably not, as it only changes the "-j N" case, not the "-j"
case in your PR, which doesn't match because the -j gets combined with
other make flags.
Uros Bizjak Nov. 22, 2016, 4:48 p.m. UTC | #5
On Tue, Nov 22, 2016 at 4:54 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Tue, 22 Nov 2016, Uros Bizjak wrote:
>
>> New makes (e.g. GNU Make 4.2.1) pass -j argument in MFLAGS is a
>> different way. While older makes pass only "-j", newer makes pass e.g.
>> "-j4" when -j is specified on the command line. The detection of "-j"
>> make argument doesn't work in the later case.
>>
>> Attached patch reworks this functionality to detect -j correctly in all
>> cases.
>
>
> Hello,
>
> I didn't read the patch, but do you think this also fixes PR 53155 ?

 Looking at the PR, I don't think so - but I did test my patch with
CentOS 5.11 (with make 3.81) and detection worked there without
problems.

Maybe MAKEFLAGS should be used instead of MFLAGS, since docs mentions
that MFLAGS is intended for historical compatibility?

[1] https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html

Uros.
diff mbox

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7ecd1e4..d1acede 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3914,7 +3914,7 @@  check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
 # testsuites like objc or go.
 $(lang_checks_parallelized): check-% : site.exp
 	-rm -rf $(TESTSUITEDIR)/$*-parallel
-	@if [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
+	@if [ -n "$(filter -j%, $(MFLAGS))" ]; then \
 	  test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR) || true; \
 	  test -d $(TESTSUITEDIR)/$*-parallel || mkdir $(TESTSUITEDIR)/$*-parallel || true; \
 	  GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/$(TESTSUITEDIR)/$(check_p_tool)-parallel ; \
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index b5d1f0e..eb0489b 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -890,7 +890,7 @@  check-acats:
 	@test -d $(ACATSDIR) || mkdir -p $(ACATSDIR); \
 	rootme=`${PWD_COMMAND}`; export rootme; \
 	EXPECT=$(EXPECT); export EXPECT; \
-	if [ -z "$(CHAPTERS)" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; \
+	if [ -z "$(CHAPTERS)" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; \
 	then \
 	  rm -rf $(ACATSDIR)-parallel; \
 	  mkdir $(ACATSDIR)-parallel; \
diff --git a/libstdc++-v3/testsuite/Makefile.am b/libstdc++-v3/testsuite/Makefile.am
index af57d0b..65848f0 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -117,7 +117,7 @@  $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
 	$(if $*,@)AR="$(AR)"; export AR; \
 	RANLIB="$(RANLIB)"; export RANLIB; \
-	if [ -z "$*" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
+	if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
 	  rm -rf normal-parallel || true; \
 	  mkdir normal-parallel; \
 	  $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index b37758b..1cdf4b8 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -598,7 +598,7 @@  $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
 	$(if $*,@)AR="$(AR)"; export AR; \
 	RANLIB="$(RANLIB)"; export RANLIB; \
-	if [ -z "$*" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
+	if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
 	  rm -rf normal-parallel || true; \
 	  mkdir normal-parallel; \
 	  $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \