From 58fed57cd4f0052dbb163b60af7904668e671fec Mon Sep 17 00:00:00 2001 From: Joseph Rushton Wakeling Date: Tue, 23 Jan 2018 23:43:30 +0100 Subject: [PATCH 1/3] Allow setting rdmd_test test compilers when invoking posix.mak makefile The `posix.mak` makefile has been updated to allow the user to set a new `RDMD_TEST_COMPILERS` variable (which by default is set to the absolute path of the compiler used to build all the D tools, including rdmd). This can be used locally along the lines of: make -f posix.mak test RDMD_TEST_COMPILERS=dmd,gdmd,ldmd2 but the main point of this patch is to allow CI to start using this new multi-compiler test functionality. This will be added separately in a follow-up patch. No modifications have been made to windows makefiles, since this is not required by Travis CI. --- posix.mak | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/posix.mak b/posix.mak index 49d31dc0a6..777359ffc5 100644 --- a/posix.mak +++ b/posix.mak @@ -6,6 +6,8 @@ DRUNTIME_PATH = ../druntime PHOBOS_PATH = ../phobos DUB=dub +RDMD_TEST_COMPILERS = $(abspath $(DMD)) + WITH_DOC = no DOC = ../dlang.org @@ -110,7 +112,8 @@ test_tests_extractor: $(ROOT)/tests_extractor $< -i ./test/tests_extractor/iteration.d | diff - ./test/tests_extractor/iteration.d.ext test_rdmd: $(ROOT)/rdmd_test $(ROOT)/rdmd - $< --compiler=$(abspath $(DMD)) -m$(MODEL) + $< --compiler=$(abspath $(DMD)) -m$(MODEL) \ + --test-compilers=$(RDMD_TEST_COMPILERS) $(DMD) $(DFLAGS) -unittest -main -run rdmd.d test: test_tests_extractor test_rdmd From a42070326f40b01940efca9764dd4ee7f19ef33b Mon Sep 17 00:00:00 2001 From: Joseph Rushton Wakeling Date: Wed, 24 Jan 2018 00:02:49 +0100 Subject: [PATCH 2/3] Provide a posix.mak variable to request verbose output from rdmd_test This patch adds a new user-controllable `VERBOSE_RDMD_TEST` option to `posix.mak`, which if set to 1 causes the `test_rdmd` target to pass the `-v` flag to `rdmd_test`: make -f posix.mak test_rdmd VERBOSE_RDMD_TEST=1 This should provide an easy way for users to request verbose output from multi-compiler tests of `rdmd`. This can be helpful when tracking down exactly what `rdmd` invocation failed during testing. --- posix.mak | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/posix.mak b/posix.mak index 777359ffc5..a93eb8c73a 100644 --- a/posix.mak +++ b/posix.mak @@ -8,6 +8,12 @@ DUB=dub RDMD_TEST_COMPILERS = $(abspath $(DMD)) +VERBOSE_RDMD_TEST=0 + +ifeq ($(VERBOSE_RDMD_TEST), 1) + override VERBOSE_RDMD_TEST_FLAGS:=-v +endif + WITH_DOC = no DOC = ../dlang.org @@ -113,7 +119,8 @@ test_tests_extractor: $(ROOT)/tests_extractor test_rdmd: $(ROOT)/rdmd_test $(ROOT)/rdmd $< --compiler=$(abspath $(DMD)) -m$(MODEL) \ - --test-compilers=$(RDMD_TEST_COMPILERS) + --test-compilers=$(RDMD_TEST_COMPILERS) \ + $(VERBOSE_RDMD_TEST_FLAGS) $(DMD) $(DFLAGS) -unittest -main -run rdmd.d test: test_tests_extractor test_rdmd From cdd576dff0c30a6d5d1ac9128affd9deaf14cc86 Mon Sep 17 00:00:00 2001 From: Joseph Rushton Wakeling Date: Tue, 23 Jan 2018 23:51:47 +0100 Subject: [PATCH 3/3] Set multiple rdmd test compilers in travis.sh CI script This patch is something of a proof-of-concept for using rdmd_test's new `--test-compilers` flag to test rdmd using multiple different compilers. The `install.sh` script is used to install LDC (including the DMD-alike `ldmd2` compiler interface interface), and the `make -f posix.mak test` call is updated to specify both `dmd` and `ldmd2` as test compilers for the `rdmd_test` test suite. A little trickery with `find` is necessary to work around the problem that the install location of` ldmd2` is not added to `PATH`. The `VERBOSE_RDMD_TEST` flag is set to ensure that the Travis build logs will contain a full summary of the individual `rdmd` calls from the test suite, for each of the test compilers. This should probably not be the final form for setting up multi compiler tests, but serves as an initial stage which should at a minimum flag up issues like that observed with https://github.com/dlang/tools/pull/271. While in development it has already shown up at least one `rdmd` issue (fixed in https://github.com/dlang/tools/pull/303), so we can reasonably hope that it will prevent others from arising in the first place. --- travis.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/travis.sh b/travis.sh index 21690b7629..501a9df203 100755 --- a/travis.sh +++ b/travis.sh @@ -2,5 +2,13 @@ set -uexo pipefail -make -f posix.mak all DMD="$(which $DMD)" -make -f posix.mak test DMD="$(which $DMD)" +~/dlang/install.sh install ldc + +~/dlang/install.sh list + +LDMD2=$(find ~/dlang -type f -name "ldmd2") + +make -f posix.mak all DMD=$(which dmd) +make -f posix.mak test DMD=$(which dmd) \ + RDMD_TEST_COMPILERS=dmd,$LDMD2 \ + VERBOSE_RDMD_TEST=1