Run some of Haddock's tests in the testsuite
authorAlec Theriault <alec.theriault@gmail.com>
Tue, 5 Feb 2019 06:06:07 +0000 (22:06 -0800)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Sun, 17 Feb 2019 03:55:16 +0000 (22:55 -0500)
The 4 main testsuites in Haddock don't have many dependencies, but are
regularly broken in small ways by changes to the GHC AST or the GHC API.
The main gotcha is that we'll have to make sure that `haddock-test` and
the test suite don't add modules without modifying this test. Then again,
if that happens, the test will fail and someone will noticed.

testsuite/tests/haddock/haddock_testsuite/Makefile [new file with mode: 0644]
testsuite/tests/haddock/haddock_testsuite/all.T [new file with mode: 0644]
utils/haddock

diff --git a/testsuite/tests/haddock/haddock_testsuite/Makefile b/testsuite/tests/haddock/haddock_testsuite/Makefile
new file mode 100644 (file)
index 0000000..59a4a17
--- /dev/null
@@ -0,0 +1,70 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Remark: these should be synced up with the testsuites listed in `utils/haddock/haddock.cabal`
+# See #16206
+
+
+# Corresponds to files in the `haddock-test` package
+haddockTest=$(TOP)/../utils/haddock/haddock-test/src/Test/Haddock.hs \
+                                               $(TOP)/../utils/haddock/haddock-test/src/Test/Haddock/Config.hs \
+                                               $(TOP)/../utils/haddock/haddock-test/src/Test/Haddock/Utils.hs \
+                                               $(TOP)/../utils/haddock/haddock-test/src/Test/Haddock/Xhtml.hs \
+                                               $(TOP)/../utils/haddock/haddock-test/src/Test/Haddock/Process.hs
+
+# Corresponds to the `html-test` testsuite
+.PHONY: htmlTest
+htmlTest:
+       '$(TEST_HC)' \
+               -odir . \
+               -package Cabal \
+               -o html-test \
+               $(haddockTest) \
+               $(TOP)/../utils/haddock/html-test/Main.hs
+       ./html-test \
+               --ghc-path=$(TEST_HC) \
+               --haddock-path=$(HADDOCK) \
+               --haddock-stdout=haddock-out.log
+
+# Corresponds to the `latex-test` testsuite
+.PHONY: latexTest
+latexTest:
+       '$(TEST_HC)' \
+               -odir . \
+               -package Cabal \
+               -o latex-test \
+               $(haddockTest) \
+               $(TOP)/../utils/haddock/latex-test/Main.hs
+       ./latex-test \
+               --ghc-path=$(TEST_HC) \
+               --haddock-path=$(HADDOCK) \
+               --haddock-stdout=haddock-out.log
+
+# Corresponds to the `hoogle-test` testsuite
+.PHONY: hoogleTest
+hoogleTest:
+       '$(TEST_HC)' \
+               -odir . \
+               -package Cabal \
+               -o hoogle-test \
+               $(haddockTest) \
+               $(TOP)/../utils/haddock/hoogle-test/Main.hs
+       ./hoogle-test \
+               --ghc-path=$(TEST_HC) \
+               --haddock-path=$(HADDOCK) \
+               --haddock-stdout=haddock-out.log
+
+# Corresponds to the `hypsrc-test` testsuite
+.PHONY: hypsrcTest
+hypsrcTest:
+       '$(TEST_HC)' \
+               -odir . \
+               -package Cabal \
+               -o hypsrc-test \
+               $(haddockTest) \
+               $(TOP)/../utils/haddock/hypsrc-test/Main.hs
+       ./hypsrc-test \
+               --ghc-path=$(TEST_HC) \
+               --haddock-path=$(HADDOCK) \
+               --haddock-stdout=haddock-out.log
diff --git a/testsuite/tests/haddock/haddock_testsuite/all.T b/testsuite/tests/haddock/haddock_testsuite/all.T
new file mode 100644 (file)
index 0000000..1aa387b
--- /dev/null
@@ -0,0 +1,19 @@
+test('haddockHtmlTest',
+     [ignore_stdout, unless(in_tree_compiler(), skip), req_haddock],
+     makefile_test,
+     ['htmlTest'])
+
+test('haddockLatexTest',
+     [ignore_stdout, unless(in_tree_compiler(), skip), req_haddock],
+     makefile_test,
+     ['latexTest'])
+
+test('haddockHoogleTest',
+     [ignore_stdout, unless(in_tree_compiler(), skip), req_haddock],
+     makefile_test,
+     ['hoogleTest'])
+
+test('haddockHypsrcTest',
+     [ignore_stdout, unless(in_tree_compiler(), skip), req_haddock],
+     makefile_test,
+     ['hypsrcTest'])
index 3ee6526..33cdd81 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 3ee6526d4ae7bf4deb7cd1caf24b3d7355573576
+Subproject commit 33cdd810e4222b92bc22f7f5b7196fc97fd3cea6