From 01c61818f9a57744a1db7764b5e23f7902c6ad66 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Mon, 29 Nov 2021 16:15:36 +0000 Subject: Fix several quoting issues in testsuite This fixes the ./validate script on my machine. I also took the step to add some linters which would catch problems like these in future. Fixes #20506 --- .gitlab/linters/check-makefiles.py | 12 ++++++++++++ testsuite/mk/test.mk | 2 +- testsuite/tests/driver/recompChangedPackage/Makefile | 4 ++-- testsuite/tests/haddock/haddock_testsuite/Makefile | 8 ++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitlab/linters/check-makefiles.py b/.gitlab/linters/check-makefiles.py index b36b073cba..5a8286c6a7 100755 --- a/.gitlab/linters/check-makefiles.py +++ b/.gitlab/linters/check-makefiles.py @@ -23,9 +23,21 @@ test_hc_quotes_linter = \ message = "Warning: $(TEST_HC) should be quoted in Makefiles.", ).add_path_filter(lambda path: path.name == 'Makefile') +ghc_pkg_quotes_linter = \ + RegexpLinter('\t\\$\\(GHC_PKG\\)', + message = "Warning: $(GHC_PKG) should be quoted in Makefiles.", + ).add_path_filter(lambda path: path.name == 'Makefile') + +haddock_quotes_linter = \ + RegexpLinter('\t\\$\\(HADDOCK\\)', + message = "Warning: $(HADDOCK) should be quoted in Makefiles.", + ).add_path_filter(lambda path: path.name == 'Makefile') + linters = [ interactive_linter, test_hc_quotes_linter, + ghc_pkg_quotes_linter, + haddock_quotes_linter ] if __name__ == '__main__': diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index bf0785116d..53f86cb9d4 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -99,7 +99,7 @@ else RUNTEST_OPTS += -e "config.leading_underscore=False" endif -GHC_PRIM_LIBDIR := $(subst library-dirs: ,,$(shell "$(GHC_PKG)" field ghc-prim library-dirs --simple-output)) +GHC_PRIM_LIBDIR := $(subst library-dirs: ,,"$(shell "$(GHC_PKG)" field ghc-prim library-dirs --simple-output)") HAVE_VANILLA := $(shell if [ -f "$(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.hi" ]; then echo YES; else echo NO; fi) HAVE_DYNAMIC := $(shell if [ -f "$(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.dyn_hi" ]; then echo YES; else echo NO; fi) HAVE_PROFILING := $(shell if [ -f "$(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.p_hi" ]; then echo YES; else echo NO; fi) diff --git a/testsuite/tests/driver/recompChangedPackage/Makefile b/testsuite/tests/driver/recompChangedPackage/Makefile index ecbf49ec03..413710290b 100644 --- a/testsuite/tests/driver/recompChangedPackage/Makefile +++ b/testsuite/tests/driver/recompChangedPackage/Makefile @@ -22,8 +22,8 @@ recompChangedPackage: # Now add PLib to q.. Main should be recompiled - $(GHC_PKG) --package-db tmp.d list - $(GHC_PKG) --package-db tmp.d unregister q-0.1.0.0 + '$(GHC_PKG)' --package-db tmp.d list + '$(GHC_PKG)' --package-db tmp.d unregister q-0.1.0.0 rm PLib.hs (cd q; cp q.cabal2 q.cabal) diff --git a/testsuite/tests/haddock/haddock_testsuite/Makefile b/testsuite/tests/haddock/haddock_testsuite/Makefile index 241371f71b..e7b234c2da 100644 --- a/testsuite/tests/haddock/haddock_testsuite/Makefile +++ b/testsuite/tests/haddock/haddock_testsuite/Makefile @@ -26,7 +26,7 @@ htmlTest: ./html-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ - --haddock-path=$(HADDOCK) \ + --haddock-path='$(HADDOCK)' \ --haddock-stdout=haddock-out.log # Corresponds to the `latex-test` testsuite @@ -42,7 +42,7 @@ latexTest: ./latex-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ - --haddock-path=$(HADDOCK) \ + --haddock-path='$(HADDOCK)' \ --haddock-stdout=haddock-out.log # Corresponds to the `hoogle-test` testsuite @@ -58,7 +58,7 @@ hoogleTest: ./hoogle-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ - --haddock-path=$(HADDOCK) \ + --haddock-path='$(HADDOCK)' \ --haddock-stdout=haddock-out.log # Corresponds to the `hypsrc-test` testsuite @@ -74,5 +74,5 @@ hypsrcTest: ./hypsrc-test \ $(ACCEPT) \ --ghc-path='$(TEST_HC)' \ - --haddock-path=$(HADDOCK) \ + --haddock-path='$(HADDOCK)' \ --haddock-stdout=haddock-out.log -- cgit v1.2.1