summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Bild.hs44
1 files changed, 28 insertions, 16 deletions
diff --git a/Omni/Bild.hs b/Omni/Bild.hs
index 60253c0..e6c9152 100644
--- a/Omni/Bild.hs
+++ b/Omni/Bild.hs
@@ -882,22 +882,33 @@ isSuccess Exit.ExitSuccess = True
isSuccess _ = False
test :: Bool -> Target -> IO (Exit.ExitCode, ByteString)
-test loud Target {..} = case compiler of
- Ghc -> do
- root <- Env.getEnv "CODEROOT"
- run
- <| Proc
- { loud = loud,
- cmd = root </> outToPath out,
- args = ["test"],
- ns = namespace,
- onFailure = Log.fail ["test", nschunk namespace] >> Log.br,
- onSuccess = Log.pass ["test", nschunk namespace] >> Log.br
- }
- _ ->
- Log.warn ["test", nschunk namespace, "unavailable"]
- >> Log.br
- >> pure (Exit.ExitFailure 1, mempty)
+test loud Target {..} =
+ Env.getEnv "CODEROOT"
+ +> \root -> case compiler of
+ Ghc ->
+ Proc
+ { loud = loud,
+ cmd = root </> outToPath out,
+ args = ["test"],
+ ns = namespace,
+ onFailure = Log.fail ["test", nschunk namespace] >> Log.br,
+ onSuccess = Log.pass ["test", nschunk namespace] >> Log.br
+ }
+ |> run
+ CPython ->
+ Proc
+ { loud = loud,
+ cmd = root </> outToPath out,
+ args = ["test"],
+ ns = namespace,
+ onFailure = Log.fail ["test", nschunk namespace] >> Log.br,
+ onSuccess = Log.pass ["test", nschunk namespace] >> Log.br
+ }
+ |> run
+ _ ->
+ Log.warn ["test", nschunk namespace, "unavailable"]
+ >> Log.br
+ >> pure (Exit.ExitFailure 1, mempty)
build :: Bool -> Bool -> Int -> Int -> Analysis -> IO [Exit.ExitCode]
build andTest loud jobs cpus analysis =
@@ -908,6 +919,7 @@ build andTest loud jobs cpus analysis =
Meta.Bin _ ->
Log.info ["bild", "nix", "python", nschunk namespace]
>> nixBuild loud jobs cpus target
+ +> (\r -> (isSuccess (fst r) && andTest) ?: (test loud target, pure r))
_ ->
Log.info ["bild", "nix", "python", nschunk namespace, "cannot build library"]
>> pure (Exit.ExitSuccess, mempty)