Test.hs 3.34 KB
Newer Older
1
module Rules.Test (testRules) where
2
3
4

import Base
import Expression
Andrey Mokhov's avatar
Andrey Mokhov committed
5
import Flavour
6
import GHC
7
8
import Oracles.Flag
import Oracles.Setting
Andrey Mokhov's avatar
Andrey Mokhov committed
9
import Settings
10
import Settings.Path
Andrey Mokhov's avatar
Andrey Mokhov committed
11
import Target
12
import Utilities
13
14
15

-- TODO: clean up after testing
testRules :: Rules ()
Andrey Mokhov's avatar
Andrey Mokhov committed
16
17
testRules = do
    "validate" ~> do
18
        need inplaceLibCopyTargets
19
        needBuilder $ Ghc CompileHs Stage2
Andrey Mokhov's avatar
Andrey Mokhov committed
20
        needBuilder $ GhcPkg Update Stage1
21
        needBuilder Hpc
22
23
24
        need ["inplace/bin/hp2ps", "inplace/bin/hsc2hs"]
        -- TODO: Eliminate explicit filepaths in "need" (#376)
        -- FIXME: needBuilder Hsc2Hs doesn't work
25
        build $ target (vanillaContext Stage2 compiler) (Make "testsuite/tests") [] []
Andrey Mokhov's avatar
Andrey Mokhov committed
26

27
    "test" ~> do
28
        pkgs     <- stagePackages Stage1
29
30
31
32
33
        tests    <- filterM doesDirectoryExist $ concat
                    [ [ pkgPath pkg -/- "tests", pkgPath pkg -/- "tests-ghc" ]
                    | pkg <- pkgs, isLibrary pkg, pkg /= rts, pkg /= libffi ]
        windows  <- windowsHost
        top      <- topDirectory
34
        compiler <- builderPath $ Ghc CompileHs Stage2
Andrey Mokhov's avatar
Andrey Mokhov committed
35
        ghcPkg   <- builderPath $ GhcPkg Update Stage1
36
37
38
39
40
41
42
43
44
45
        haddock  <- builderPath Haddock
        threads  <- shakeThreads <$> getShakeOptions
        ghcWithNativeCodeGenInt <- fromEnum <$> ghcWithNativeCodeGen
        ghcWithInterpreterInt   <- fromEnum <$> ghcWithInterpreter
        ghcUnregisterisedInt    <- fromEnum <$> flag GhcUnregisterised
        quietly . cmd "python2" $
            [ "testsuite/driver/runtests.py" ]
            ++ map ("--rootdir="++) tests ++
            [ "-e", "windows=" ++ show windows
            , "-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 $ ghcDebugged flavour)
49
50
51
52
53
54
55
56
57
58
59
60
61
            , "-e", "ghc_with_vanilla=1" -- TODO: do we always build vanilla?
            , "-e", "ghc_with_dynamic=0" -- TODO: support dynamic
            , "-e", "ghc_with_profiling=0" -- TODO: support profiling
            , "-e", "ghc_with_interpreter=" ++ show ghcWithInterpreterInt
            , "-e", "ghc_unregisterised=" ++ show ghcUnregisterisedInt
            , "-e", "ghc_with_threaded_rts=0" -- TODO: support threaded
            , "-e", "ghc_with_dynamic_rts=0" -- TODO: support dynamic
            , "-e", "ghc_dynamic_by_default=False" -- TODO: support dynamic
            , "-e", "ghc_dynamic=0" -- TODO: support dynamic
            , "-e", "ghc_with_llvm=0" -- TODO: support LLVM
            , "-e", "in_tree_compiler=True" -- TODO: when is it equal to False?
            , "-e", "clean_only=False" -- TODO: do we need to support True?
            , "--configfile=testsuite/config/ghc"
62
63
64
            , "--config", "compiler=" ++ show (top -/- compiler)
            , "--config", "ghc_pkg="  ++ show (top -/- ghcPkg)
            , "--config", "haddock="  ++ show (top -/- haddock)
65
66
67
68
69
70
71
72
            , "--summary-file", "testsuite_summary.txt"
            , "--threads=" ++ show threads
            ]

            -- , "--config", "hp2ps="    ++ quote ("hp2ps")
            -- , "--config", "hpc="      ++ quote ("hpc")
            -- , "--config", "gs=$(call quote_path,$(GS))"
            -- , "--config", "timeout_prog=$(call quote_path,$(TIMEOUT_PROGRAM))"