Skip to contentSkip to conversation

testcases.mk: Fix libs/ path for out-of-tree build

PATCH New Cyril Hrubis 4 participants 7 messages Apr 30, 2019 – May 1, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 testcases.mk: Fix libs/ path for out-of-tree build

The path to the Makefile was not correct for the out-of-tree build because it was pointing to the build directory rather than to the source directory.

Apparently this also caused random failures for out-of-tree build. For some reason when building syscalls/set_mempolicy/ testcases the rebuild of the libltpnuma.a library is triggered for out-of-tree build for about 10% of the cases on massively parallel build. Which as far as I can tell shouldn't happen since we build everything in the libs/ directory as a prerequisite of the testcases/ directory. So there is likely some strange race condition happening and while this does not fix the actual race it makes it quite harmless since the target was already build and the make in the libs/libltpnuma/ directory will be no-op.

CC Petr Vorel <[email protected]>
CC Jan Stancek <[email protected]>
---
 include/mk/testcases.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/mk/testcases.mk +1 -1
index 131854ec7..684655fbf 100644
@@ -49,7 +49,7 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach
 MAKE_DEPS += $(LTPLIBS_FILES)
 
 $(LTPLIBS_FILES): $(LTPLIBS_DIRS)
-	$(MAKE) -C "$^" -f "$^/Makefile" all
+	$(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all
 
 LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
 
Signature · 1 line
2.19.2
#2 lore raw

PATCH 1/2 testcases.mk: Fix libs/ path for out-of-tree build

Quoted 5 lines · Cyril Hrubis

Hi!
Both pushed, thanks.

Thank you for fixing this Cyril!
Take care,
-Enji

#3 lore raw

PATCH 1/2 testcases.mk: Fix libs/ path for out-of-tree build

In reply to Cyril Hrubis

----- Original Message -----

Quoted 14 lines

The path to the Makefile was not correct for the out-of-tree build because it was pointing to the build directory rather than to the source directory.

Apparently this also caused random failures for out-of-tree build. For some reason when building syscalls/set_mempolicy/ testcases the rebuild of the libltpnuma.a library is triggered for out-of-tree build for about 10% of the cases on massively parallel build. Which as far as I can tell shouldn't happen since we build everything in the libs/ directory as a prerequisite of the testcases/ directory. So there is likely some strange race condition happening and while this does not fix the actual race it makes it quite harmless since the target was already build and the make in the libs/libltpnuma/ directory will be no-op.

Quoted 3 lines
CC Petr Vorel <[email protected]>
CC Jan Stancek <[email protected]>
Quoted 23 lines
---
 include/mk/testcases.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/mk/testcases.mk +0 -0
index 131854ec7..684655fbf 100644
@@ -49,7 +49,7 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix

$(abs_top_builddir)/libs/, $(foreach
MAKE_DEPS += $(LTPLIBS_FILES)

$(LTPLIBS_FILES): $(LTPLIBS_DIRS)

include/mk/testcases.mk +1 -1
-	$(MAKE) -C "$^" -f "$^/Makefile" all
+	$(MAKE) -C "$^" -f "$(subst

$(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all

LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))

--
2.19.2

#4 lore raw

PATCH 1/2 testcases.mk: Fix libs/ path for out-of-tree build

In reply to Cyril Hrubis

Hi,

Quoted 14 lines

The path to the Makefile was not correct for the out-of-tree build because it was pointing to the build directory rather than to the source directory.

Apparently this also caused random failures for out-of-tree build. For some reason when building syscalls/set_mempolicy/ testcases the rebuild of the libltpnuma.a library is triggered for out-of-tree build for about 10% of the cases on massively parallel build. Which as far as I can tell shouldn't happen since we build everything in the libs/ directory as a prerequisite of the testcases/ directory. So there is likely some strange race condition happening and while this does not fix the actual race it makes it quite harmless since the target was already build and the make in the libs/libltpnuma/ directory will be no-op.

Quoted 4 lines
CC Petr Vorel <[email protected]>
CC Jan Stancek <[email protected]>

---

On 32 core machine, running for several hours (now 66 builds without failure).

Kind regards,
Petr

Quoted 15 lines
 include/mk/testcases.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/mk/testcases.mk +1 -1
index 131854ec7..684655fbf 100644
@@ -49,7 +49,7 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach
 MAKE_DEPS += $(LTPLIBS_FILES)
 
 $(LTPLIBS_FILES): $(LTPLIBS_DIRS)
-	$(MAKE) -C "$^" -f "$^/Makefile" all
+	$(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all
 
 LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
#5 lore raw

PATCH 2/2 Makefile: Fix target redefinition

In reply to Cyril Hrubis

There is no need to add a rule for the libs directory because there is a generic rule for directory creation already. All we need to do is to make the libs-all target depend on the directory path, which we do already so that the directory is created before we attempt to execute make there.

Fixes 17a5b0fb63bf65eff433bdee3bf5f73826a50e0f
CC Petr Vorel <[email protected]>
CC Jan Stancek <[email protected]>
---
 Makefile | 3 ---
 1 file changed, 3 deletions(-)
Makefile +0 -3
index c46d050ce..768ca4606 100644
@@ -102,9 +102,6 @@ $(sort $(addprefix $(abs_top_builddir)/,$(BOOTSTRAP_TARGETS)) $(INSTALL_DIR) $(D
 ## Pattern based subtarget rules.
 lib-install: lib-all
 
-$(abs_top_builddir)/libs:
-	mkdir -m 00755 -p "$@"
-
 libs-all: $(abs_top_builddir)/libs
 
 $(MAKE_TARGETS) include-all lib-all libs-all:
Signature · 1 line
2.19.2
#6 lore raw

PATCH 2/2 Makefile: Fix target redefinition

Hi,

Quoted 6 lines

There is no need to add a rule for the libs directory because there is a generic rule for directory creation already. All we need to do is to make the libs-all target depend on the directory path, which we do already so that the directory is created before we attempt to execute make there.

Quoted 6 lines
Fixes 17a5b0fb63bf65eff433bdee3bf5f73826a50e0f
CC Petr Vorel <[email protected]>
CC Jan Stancek <[email protected]>

---

The same as previous patch (testing both together).

Kind regards,
Petr

Quoted 17 lines
 Makefile | 3 ---
 1 file changed, 3 deletions(-)
Makefile +0 -3
index c46d050ce..768ca4606 100644
@@ -102,9 +102,6 @@ $(sort $(addprefix $(abs_top_builddir)/,$(BOOTSTRAP_TARGETS)) $(INSTALL_DIR) $(D
 ## Pattern based subtarget rules.
 lib-install: lib-all
 
-$(abs_top_builddir)/libs:
-	mkdir -m 00755 -p "$@"
-
 libs-all: $(abs_top_builddir)/libs
 
 $(MAKE_TARGETS) include-all lib-all libs-all: