Replace shortcuts to issues by GitHub links
[hadrian.git] / src / Rules / Test.hs
1 module Rules.Test (testRules) where
2
3 import Base
4 import Expression
5 import Flavour
6 import Oracles.Flag
7 import Oracles.Setting
8 import Settings
9 import Target
10 import Utilities
11
12 -- TODO: clean up after testing
13 testRules :: Rules ()
14 testRules = do
15 "validate" ~> do
16 need inplaceLibCopyTargets
17 needBuilder $ Ghc CompileHs Stage2
18 needBuilder $ GhcPkg Update Stage1
19 needBuilder Hpc
20 -- TODO: Figure out why @needBuilder Hsc2Hs@ doesn't work.
21 -- TODO: Eliminate explicit filepaths.
22 -- See https://github.com/snowleopard/hadrian/issues/376.
23 need ["inplace/bin/hp2ps", "inplace/bin/hsc2hs"]
24 build $ target (vanillaContext Stage2 compiler) (Make "testsuite/tests") [] []
25
26 "test" ~> do
27 pkgs <- stagePackages Stage1
28 tests <- filterM doesDirectoryExist $ concat
29 [ [ pkgPath pkg -/- "tests", pkgPath pkg -/- "tests-ghc" ]
30 | pkg <- pkgs, isLibrary pkg, pkg /= rts, pkg /= libffi ]
31 windows <- windowsHost
32 top <- topDirectory
33 compiler <- builderPath $ Ghc CompileHs Stage2
34 ghcPkg <- builderPath $ GhcPkg Update Stage1
35 haddock <- builderPath (Haddock BuildPackage)
36 threads <- shakeThreads <$> getShakeOptions
37 debugged <- ghcDebugged <$> flavour
38 ghcWithNativeCodeGenInt <- fromEnum <$> ghcWithNativeCodeGen
39 ghcWithInterpreterInt <- fromEnum <$> ghcWithInterpreter
40 ghcUnregisterisedInt <- fromEnum <$> flag GhcUnregisterised
41 quietly . cmd "python2" $
42 [ "testsuite/driver/runtests.py" ]
43 ++ map ("--rootdir="++) tests ++
44 [ "-e", "windows=" ++ show windows
45 , "-e", "config.speed=2"
46 , "-e", "ghc_compiler_always_flags=" ++ show "-fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts"
47 , "-e", "ghc_with_native_codegen=" ++ show ghcWithNativeCodeGenInt
48 , "-e", "ghc_debugged=" ++ show (yesNo debugged)
49 , "-e", "ghc_with_vanilla=1" -- TODO: do we always build vanilla?
50 , "-e", "ghc_with_dynamic=0" -- TODO: support dynamic
51 , "-e", "ghc_with_profiling=0" -- TODO: support profiling
52 , "-e", "ghc_with_interpreter=" ++ show ghcWithInterpreterInt
53 , "-e", "ghc_unregisterised=" ++ show ghcUnregisterisedInt
54 , "-e", "ghc_with_threaded_rts=0" -- TODO: support threaded
55 , "-e", "ghc_with_dynamic_rts=0" -- TODO: support dynamic
56 , "-e", "ghc_dynamic_by_default=False" -- TODO: support dynamic
57 , "-e", "ghc_dynamic=0" -- TODO: support dynamic
58 , "-e", "ghc_with_llvm=0" -- TODO: support LLVM
59 , "-e", "in_tree_compiler=True" -- TODO: when is it equal to False?
60 , "-e", "clean_only=False" -- TODO: do we need to support True?
61 , "--configfile=testsuite/config/ghc"
62 , "--config", "compiler=" ++ show (top -/- compiler)
63 , "--config", "ghc_pkg=" ++ show (top -/- ghcPkg)
64 , "--config", "haddock=" ++ show (top -/- haddock)
65 , "--summary-file", "testsuite_summary.txt"
66 , "--threads=" ++ show threads
67 ]
68
69 -- , "--config", "hp2ps=" ++ quote ("hp2ps")
70 -- , "--config", "hpc=" ++ quote ("hpc")
71 -- , "--config", "gs=$(call quote_path,$(GS))"
72 -- , "--config", "timeout_prog=$(call quote_path,$(TIMEOUT_PROGRAM))"