From aafa73c47325185ed733da387c9649d934f6529c Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 1 Dec 2024 21:46:29 -0500 Subject: Test Python code with bild --test I had forgotten to add this feature, apparently, so bild --test just didn't do the test part. --- Omni/Bild.hs | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'Omni/Bild.hs') 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) -- cgit v1.2.3