Skip to contentSkip to conversation

open_posix_testsuite: Fix recursive build

PATCH New Petr Vorel 3 participants 4 messages Apr 5, 2017 – Apr 10, 2017

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/2 open_posix_testsuite: Fix recursive build

TODO: Fix make install. This fixes only compile issues, there are still some data files missing.

---
 testcases/open_posix_testsuite/Makefile            | 46 +++++++++++-----------
 testcases/open_posix_testsuite/Makefile.linux      |  2 +-
 .../scripts/generate-makefiles.sh                  |  2 +-
 3 files changed, 25 insertions(+), 25 deletions(-)
testcases/open_posix_testsuite/Makefile +23 -23
index 0601fa648..21917ae07 100644
@@ -24,9 +24,9 @@ BUILD_MAKE=		env $(BUILD_MAKE_ENV) $(MAKE)
 
 TEST_MAKE=		env $(TEST_MAKE_ENV) $(MAKE) -k
 
-top_srcdir?=		.
+open_posix_srcdir := $(if $(top_srcdir),$(top_srcdir)/testcases/open_posix_testsuite,$(abspath .))
 
-prefix?=		`$(top_srcdir)/scripts/print_prefix.sh`
+prefix?=		`$(open_posix_srcdir)/scripts/print_prefix.sh`
 
 datadir?=		$(prefix)/share
 
@@ -35,13 +35,13 @@ exec_prefix?=		$(prefix)
 all: conformance-all functional-all stress-all tools-all
 
 ifeq ($(shell uname -s), Linux)
-include Makefile.linux
+include $(open_posix_srcdir)/Makefile.linux
 endif
 
 clean: $(CRITICAL_MAKEFILE)
 	@rm -f $(LOGFILE)*
 	@for dir in $(SUBDIRS) tools; do \
-	    $(MAKE) -C $$dir clean >/dev/null; \
+	    $(MAKE) -C $(open_posix_srcdir)/$$dir clean >/dev/null; \
 	done
 
 distclean: distclean-makefiles
@@ -49,12 +49,12 @@ distclean: distclean-makefiles
 # Clean out all of the generated Makefiles.
 distclean-makefiles:
 	@for dir in $(SUBDIRS); do \
-		$(MAKE) -C $$dir $@; \
+		$(MAKE) -C $(open_posix_srcdir)/$$dir $@; \
 	done
 
 generate-makefiles: distclean-makefiles
-	@env top_srcdir=$(top_srcdir) \
-	    $(top_srcdir)/scripts/generate-makefiles.sh
+	@env top_srcdir=$(open_posix_srcdir) \
+	    $(open_posix_srcdir)/scripts/generate-makefiles.sh
 
 install: bin-install conformance-install functional-install stress-install
 
@@ -63,47 +63,47 @@ test: conformance-test functional-test stress-test
 # Test build and execution targets.
 conformance-all: $(CRITICAL_MAKEFILE)
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(BUILD_MAKE) -C conformance -j1 all
+	@$(BUILD_MAKE) -C $(open_posix_srcdir)/conformance -j1 all
 
 conformance-install:
-	@$(MAKE) -C conformance install
+	@$(MAKE) -C $(open_posix_srcdir)/conformance install
 
 conformance-test:
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(TEST_MAKE) -C conformance test
+	@$(TEST_MAKE) -C $(open_posix_srcdir)/conformance test
 
 functional-all: $(CRITICAL_MAKEFILE)
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(BUILD_MAKE) -C functional -j1 all
+	@$(BUILD_MAKE) -C $(open_posix_srcdir)/functional -j1 all
 
 functional-install:
-	@$(MAKE) -C functional install
+	@$(MAKE) -C $(open_posix_srcdir)/functional install
 
 functional-test:
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(TEST_MAKE) -C functional test
+	@$(TEST_MAKE) -C $(open_posix_srcdir)/functional test
 
 stress-all: $(CRITICAL_MAKEFILE)
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(BUILD_MAKE) -C stress -j1 all
+	@$(BUILD_MAKE) -C $(open_posix_srcdir)/stress -j1 all
 
 stress-install:
-	@$(MAKE) -C stress install
+	@$(MAKE) -C $(open_posix_srcdir)/stress install
 
 stress-test:
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(TEST_MAKE) -C stress test
+	@$(TEST_MAKE) -C $(open_posix_srcdir)/stress test
 
 # Tools build and install targets.
 bin-install:
-	@$(MAKE) -C bin install
+	@$(MAKE) -C $(open_posix_srcdir)/bin install
 
 tools-all:
-	@$(MAKE) -C tools all
+	@$(MAKE) -C $(open_posix_srcdir)/tools all top_srcdir=$(open_posix_srcdir)
 
 $(CRITICAL_MAKEFILE): \
-    $(top_srcdir)/scripts/generate-makefiles.sh	\
-    $(top_srcdir)/CFLAGS			\
-    $(top_srcdir)/LDFLAGS			\
-    $(top_srcdir)/LDLIBS
-	@$(MAKE) generate-makefiles
+    $(open_posix_srcdir)/scripts/generate-makefiles.sh	\
+    $(open_posix_srcdir)/CFLAGS			\
+    $(open_posix_srcdir)/LDFLAGS			\
+    $(open_posix_srcdir)/LDLIBS
+	@$(MAKE) -f $(open_posix_srcdir)/Makefile generate-makefiles
testcases/open_posix_testsuite/Makefile.linux +1 -1
index 77e20a958..adef565a8 100644
@@ -8,7 +8,7 @@ cmd_disable = @set -e; \
 
 BROKEN :=
 
-kver_cmp = $(shell $(top_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
+kver_cmp = $(shell $(open_posix_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
 ifeq ($(kver_cmp), 1)
 BROKEN += t_sigaction_16-1
 endif
testcases/open_posix_testsuite/scripts/generate-makefiles.sh +1 -1
index 67a60c8cb..d50d517ae 100755
@@ -22,7 +22,7 @@ generate_locate_test_makefile() {
 
 	echo "Generating $maketype Makefiles"
 
-	locate-test --$maketype | sed -e 's,^./,,g' > make-gen.$maketype
+	locate-test --$maketype $top_srcdir | sed -e 's,^./,,g' > make-gen.$maketype
 
 	generate_makefiles make-gen.$maketype $*
 
Signature · 1 line
2.12.0
author
#1 lore raw

PATCH 2/2 travis: Add out-of-tree build

---
 .travis.yml | 11 +++++++++-
 build.sh    | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100755 build.sh
.travis.yml +10 -1
index d937f9dcf..d030cc796 100644
@@ -10,6 +10,15 @@ matrix:
                   packages: ['gcc-4.6']
 
         - os: linux
+          compiler: gcc-4.6
+          addons:
+              apt:
+                  sources: ['ubuntu-toolchain-r-test']
+                  packages: ['gcc-4.6']
+          env:
+              OUT_OF_TREE=true
+
+        - os: linux
           compiler: gcc-4.7
           addons:
               apt:
@@ -72,4 +81,4 @@ notifications:
     email:
         secure: "b/xcA/K5OyQvPPnd0PRahTH5LJu8lgz8goGHvhXpHo+ZPsPgTDXNFo5cX9fSOkMuFKeoW8iGl0wOgK2+ptc8mbYDw277K4RFIHRHeV/KIoE1EzjQnEFiL8J0oHCAvDj12o0AXeriTyY9gICXKbR31Br6Zh5eKViDJe2OAGeHeDU="
 
-script: make autotools && ./configure --prefix $HOME/ltp --with-open-posix-testsuite --with-realtime-testsuite && make -j$(getconf _NPROCESSORS_ONLN) && make -j$(getconf _NPROCESSORS_ONLN) install
+script: ./build.sh $OUT_OF_TREE
build.sh new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.12.0
#2 lore raw

PATCH 1/2 open_posix_testsuite: Fix recursive build

In reply to Petr Vorel

Hi!

testcases/open_posix_testsuite/Makefile BUILD_MAKE= env $(BUILD_MAKE_ENV) $(MAKE) · line 27

Quoted 2 lines
testcases/open_posix_testsuite/Makefile +1 -1
-top_srcdir?=		.
+open_posix_srcdir := $(if $(top_srcdir),$(top_srcdir)/testcases/open_posix_testsuite,$(abspath .))

I wonder if we want to be consistent with the rest of the LTP buildsystem define the top_srcdir ?= ../.. here so that we could use it below in both cases when the make is executed in the open posix directory or from the top level Makefile.

Then we could define the open_posix_srcdir := $(top_srcdir)/testcases/open_posix_testsuite

Quoted 24 lines
testcases/open_posix_testsuite/Makefile +3 -3
-prefix?=		`$(top_srcdir)/scripts/print_prefix.sh`
+prefix?=		`$(open_posix_srcdir)/scripts/print_prefix.sh`
 
 datadir?=		$(prefix)/share
@@ -35,13 +35,13 @@ exec_prefix?=		$(prefix)
 all: conformance-all functional-all stress-all tools-all
 
 ifeq ($(shell uname -s), Linux)
-include Makefile.linux
+include $(open_posix_srcdir)/Makefile.linux
 endif
 
 clean: $(CRITICAL_MAKEFILE)
 	@rm -f $(LOGFILE)*
 	@for dir in $(SUBDIRS) tools; do \
-	    $(MAKE) -C $$dir clean >/dev/null; \
+	    $(MAKE) -C $(open_posix_srcdir)/$$dir clean >/dev/null; \
 	done
 
 distclean: distclean-makefiles
@@ -49,12 +49,12 @@ distclean: distclean-makefiles
 # Clean out all of the generated Makefiles.
 distclean-makefiles:

testcases/open_posix_testsuite/Makefile distclean: distclean-makefiles · line 57

Quoted 10 lines
testcases/open_posix_testsuite/Makefile +3 -3
 	@for dir in $(SUBDIRS); do \
-		$(MAKE) -C $$dir $@; \
+		$(MAKE) -C $(open_posix_srcdir)/$$dir $@; \
 	done
 
 generate-makefiles: distclean-makefiles
-	@env top_srcdir=$(top_srcdir) \
-	    $(top_srcdir)/scripts/generate-makefiles.sh
+	@env top_srcdir=$(open_posix_srcdir) \
+	    $(open_posix_srcdir)/scripts/generate-makefiles.sh

Thinking of this, we still put the generated makefiles into the source directory. I wonder if it's a good idea to even try to put the makefiles into the build directory and overcomplicate the already overcomplicated makefile generator.

And don't forget that the generate-makefile.sh script needs to get a path to the config-openposix.mk which is located in the build directory under include/mk/ otherwise the top level CFLAGS are not propagated.

Looks like this is really can of worms...

Quoted 98 lines
testcases/open_posix_testsuite/Makefile +16 -16
 install: bin-install conformance-install functional-install stress-install
 
@@ -63,47 +63,47 @@ test: conformance-test functional-test stress-test
 # Test build and execution targets.
 conformance-all: $(CRITICAL_MAKEFILE)
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(BUILD_MAKE) -C conformance -j1 all
+	@$(BUILD_MAKE) -C $(open_posix_srcdir)/conformance -j1 all
 
 conformance-install:
-	@$(MAKE) -C conformance install
+	@$(MAKE) -C $(open_posix_srcdir)/conformance install
 
 conformance-test:
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(TEST_MAKE) -C conformance test
+	@$(TEST_MAKE) -C $(open_posix_srcdir)/conformance test
 
 functional-all: $(CRITICAL_MAKEFILE)
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(BUILD_MAKE) -C functional -j1 all
+	@$(BUILD_MAKE) -C $(open_posix_srcdir)/functional -j1 all
 
 functional-install:
-	@$(MAKE) -C functional install
+	@$(MAKE) -C $(open_posix_srcdir)/functional install
 
 functional-test:
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(TEST_MAKE) -C functional test
+	@$(TEST_MAKE) -C $(open_posix_srcdir)/functional test
 
 stress-all: $(CRITICAL_MAKEFILE)
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(BUILD_MAKE) -C stress -j1 all
+	@$(BUILD_MAKE) -C $(open_posix_srcdir)/stress -j1 all
 
 stress-install:
-	@$(MAKE) -C stress install
+	@$(MAKE) -C $(open_posix_srcdir)/stress install
 
 stress-test:
 	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
-	@$(TEST_MAKE) -C stress test
+	@$(TEST_MAKE) -C $(open_posix_srcdir)/stress test
 
 # Tools build and install targets.
 bin-install:
-	@$(MAKE) -C bin install
+	@$(MAKE) -C $(open_posix_srcdir)/bin install
 
 tools-all:
-	@$(MAKE) -C tools all
+	@$(MAKE) -C $(open_posix_srcdir)/tools all top_srcdir=$(open_posix_srcdir)
 
 $(CRITICAL_MAKEFILE): \
-    $(top_srcdir)/scripts/generate-makefiles.sh	\
-    $(top_srcdir)/CFLAGS			\
-    $(top_srcdir)/LDFLAGS			\
-    $(top_srcdir)/LDLIBS
-	@$(MAKE) generate-makefiles
+    $(open_posix_srcdir)/scripts/generate-makefiles.sh	\
+    $(open_posix_srcdir)/CFLAGS			\
+    $(open_posix_srcdir)/LDFLAGS			\
+    $(open_posix_srcdir)/LDLIBS
+	@$(MAKE) -f $(open_posix_srcdir)/Makefile generate-makefiles
testcases/open_posix_testsuite/Makefile.linux +1 -1
index 77e20a958..adef565a8 100644
@@ -8,7 +8,7 @@ cmd_disable = @set -e; \
 
 BROKEN :=
 
-kver_cmp = $(shell $(top_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
+kver_cmp = $(shell $(open_posix_srcdir)/scripts/tst_kvercmp.sh 2 6 22)
 ifeq ($(kver_cmp), 1)
 BROKEN += t_sigaction_16-1
 endif
testcases/open_posix_testsuite/scripts/generate-makefiles.sh +1 -1
index 67a60c8cb..d50d517ae 100755
@@ -22,7 +22,7 @@ generate_locate_test_makefile() {
 
 	echo "Generating $maketype Makefiles"
 
-	locate-test --$maketype | sed -e 's,^./,,g' > make-gen.$maketype
+	locate-test --$maketype $top_srcdir | sed -e 's,^./,,g' > make-gen.$maketype
 
 	generate_makefiles make-gen.$maketype $*
 
Signature · 5 lines
2.12.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/2 open_posix_testsuite: Fix recursive build

Quoted 1 line · Cyril Hrubis

Hi!

Hallo,

Quoted 7 lines

testcases/open_posix_testsuite/Makefile BUILD_MAKE= env $(BUILD_MAKE_ENV) $(MAKE) · line 27

Quoted 2 lines
testcases/open_posix_testsuite/Makefile +1 -1
-top_srcdir?=		.
+open_posix_srcdir := $(if $(top_srcdir),$(top_srcdir)/testcases/open_posix_testsuite,$(abspath .))

I wonder if we want to be consistent with the rest of the LTP buildsystem define the top_srcdir ?= ../.. here so that we could use it below in both cases when the make is executed in the open posix directory or from the top level Makefile.

The important part is the use of abspath somewhere, these variables are referenced also from processes running in different subdirs.

This is quite visible in the automatically generated makefiles.

Quoted 11 lines

testcases/open_posix_testsuite/scripts/generate-makefiles.sh generate_locate_test_makefile() { · line 26

Quoted 11 lines
testcases/open_posix_testsuite/scripts/generate-makefiles.sh +1 -1
index 67a60c8cb..d50d517ae 100755
@@ -22,7 +22,7 @@ generate_locate_test_makefile() {
 
 	echo "Generating $maketype Makefiles"
 
-	locate-test --$maketype | sed -e 's,^./,,g' > make-gen.$maketype
+	locate-test --$maketype $top_srcdir | sed -e 's,^./,,g' > make-gen.$maketype
 	generate_makefiles make-gen.$maketype $*

I had great troubles in enabling this step

Domenico

Signature · 1 line
3B10 0CA1 8674 ACBA B4FE  FCD2 CE5B CF17 9960 DE13