on master help sign in
Hook the new test infrastructure to cabal
5186d6cgpyh
.travis.yml+3−3
@@ -102,7 +102,7 @@ before_script:
102script:
102script:
103###
103###
104 - echo 'Configure...' && echo -en 'travis_fold:start:script.configure\\r'
104 - echo 'Configure...' && echo -en 'travis_fold:start:script.configure\\r'
105− - cabal configure -f FFI -f CI
105+ - cabal configure -f FFI -f CI --enable-tests
106 - echo -en 'travis_fold:end:script.configure\\r'
106 - echo -en 'travis_fold:end:script.configure\\r'
107###
107###
108 - echo 'Build...' && echo -en 'travis_fold:start:script.build\\r'
108 - echo 'Build...' && echo -en 'travis_fold:start:script.build\\r'
@@ -125,8 +125,8 @@ script:
125###
125###
126 - echo 'Tests...' && echo -en 'travis_fold:start:script.tests\\r'
126 - echo 'Tests...' && echo -en 'travis_fold:start:script.tests\\r'
127 - for test in $TESTS; do
127 - for test in $TESTS; do
128− echo "make -j2 $test";
128+ echo "make TEST-JOBS=2 $test";
129− make -j2 $test;
129+ travis_wait make TEST-JOBS=2 $test;
130 done
130 done
131 - echo -en 'travis_fold:end:script.tests\\r'
131 - echo -en 'travis_fold:end:script.tests\\r'
132###
132###
Makefile+17−5
@@ -1,10 +1,15 @@
1−.PHONY: build configure doc install linecount nodefault pinstall lib_clean relib fast test_c test lib_doc lib_doc_clean user_doc_html user_doc_pdf user_docs
1+.PHONY: build configure doc install linecount nodefault pinstall lib_clean relib fast test_js test_c test test_clean lib_doc lib_doc_clean user_doc_html user_doc_pdf user_docs
2+
3+ARGS=
4+TEST-JOBS=
5+TEST-ARGS=
2
6
3include config.mk
7include config.mk
4-include custom.mk
8-include custom.mk
5
9
6ifdef CI
10ifdef CI
7CABALFLAGS += -f CI
11CABALFLAGS += -f CI
12+TEST-ARGS += --color always
8endif
13endif
9
14
10install:
15install:
@@ -20,13 +25,20 @@ build: dist/setup-config
20test: doc test_c
25test: doc test_c
21
26
22test_c:
27test_c:
23− echo "test_c not supported"
28+ $(CABAL) test $(ARGS) --test-options \
29+ "$(TEST-ARGS) --rerun-update +RTS -N$(TEST-JOBS) -RTS"
24
30
25test_js:
31test_js:
26− echo "test_js not supported"
32+ $(CABAL) test $(ARGS) --test-options \
33+ "$(TEST-ARGS) --node --rerun-update +RTS -N$(TEST-JOBS) -RTS"
34+
35+test_update:
36+ $(CABAL) test $(ARGS) --test-options \
37+ "$(TEST-ARGS) --accept +RTS -N$(TEST-JOBS) -RTS"
27
38
28−test_timed:
39+test_clean:
29− echo "test_timed not supported"
40+ rm -f test/*~
41+ rm -f test/*/output
30
42
31lib_clean:
43lib_clean:
32 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris RTS=../../dist/build/rts/libidris_rts clean
44 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris RTS=../../dist/build/rts/libidris_rts clean
Setup.hs+29
@@ -263,6 +263,30 @@ idrisInstall verbosity copy pkg local = unless (execOnly (configFlags local)) $
263 makeInstall src target =
263 makeInstall src target =
264 make verbosity [ "-C", src, "install" , "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local]
264 make verbosity [ "-C", src, "install" , "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local]
265
265
266+-- -----------------------------------------------------------------------------
267+-- Test
268+
269+-- FIXME: We use the __GLASGOW_HASKELL__ macro because MIN_VERSION_cabal seems
270+-- to be broken !
271+
272+-- There are two "dataDir" in cabal, and they don't relate to each other.
273+-- When fetching modules, idris uses the second path (in the pkg record),
274+-- which by default is the root folder of the project.
275+-- We want it to be the install directory where we put the idris libraries.
276+fixPkg pkg target = pkg { dataDir = target }
277+
278+-- The "Args" argument of the testHooks has been added in cabal 1.22.0,
279+-- and should therefore be ignored for prior versions.
280+#if __GLASGOW_HASKELL__ < 710
281+originalTestHook _ = testHook simpleUserHooks
282+#else
283+originalTestHook = testHook simpleUserHooks
284+#endif
285+
286+idrisTestHook args pkg local hooks flags = do
287+ let target = datadir $ L.absoluteInstallDirs pkg local NoCopyDest
288+ originalTestHook args (fixPkg pkg target) local hooks flags
289+
266-- -----------------------------------------------------------------------------
290-- -----------------------------------------------------------------------------
267-- Main
291-- Main
268
292
@@ -281,4 +305,9 @@ main = defaultMainWithHooks $ simpleUserHooks
281 NoCopyDest pkg local
305 NoCopyDest pkg local
282 , preSDist = idrisPreSDist
306 , preSDist = idrisPreSDist
283 , postSDist = idrisPostSDist
307 , postSDist = idrisPostSDist
308+#if __GLASGOW_HASKELL__ < 710
309+ , testHook = idrisTestHook ()
310+#else
311+ , testHook = idrisTestHook
312+#endif
284 }
313 }
config.mk+4−2
@@ -14,9 +14,11 @@ CABAL :=cabal
14# Any flags defined here which alter the RTS API must also be added to src/IRTS/CodegenC.hs
14# Any flags defined here which alter the RTS API must also be added to src/IRTS/CodegenC.hs
15CFLAGS :=-O2 -Wall -DHAS_PTHREAD -DIDRIS_ENABLE_STATS $(CFLAGS)
15CFLAGS :=-O2 -Wall -DHAS_PTHREAD -DIDRIS_ENABLE_STATS $(CFLAGS)
16
16
17−#CABALFLAGS :=
17+# CABALFLAGS :=
18+CABALFLAGS += --enable-tests
18## Disable building of Effects
19## Disable building of Effects
19−#CABALFLAGS :=-f NoEffects
20+#CABALFLAGS :=-f NoEffects $(CABALFLAGS)
21+
20
22
21ifneq (, $(findstring bsd, $(MACHINE)))
23ifneq (, $(findstring bsd, $(MACHINE)))
22 GMP_INCLUDE_DIR :=
24 GMP_INCLUDE_DIR :=