Commit a4d3fa91 authored by Valentin Reis's avatar Valentin Reis

shellTest + singularity test.

parent 0ea6332d
Pipeline #7351 passed with stages
in 53 seconds
......@@ -53,7 +53,7 @@ data NixStaticInOut = Both Text
| SimpleTarget Text
| StringArg Text
| Target Text deriving (Eq)
data NixCommand = NixBuild | NixShell | NixTest deriving (Eq)
data NixCommand = NixBuild | NixShell | NixTest | NixShellTest deriving (Eq)
instance Default ArgsCommon where
def = ArgsCommon
......@@ -211,6 +211,7 @@ nixStatic = src <> both <> simpletarget <> target <> stringA
, "testHello"
, "testListen"
, "testPerfwrapper"
, "testSingularity"
, "testPower"
, "testSTREAM"
, "testAMG"
......
......@@ -81,15 +81,24 @@ main = SIO.hSetBuffering SIO.stdout SIO.NoBuffering
<> command
"test"
(info (wrap NixTest <$> targetParser <*> commonParser)
(progDesc "Enter an argo-compatible nix-shell")
(progDesc "run a dhrun test")
)
<> command
"test-shell"
(info
(wrap NixShellTest <$> targetParser <*> commonParser)
(progDesc
"Enter an argo-compatible nix-shell for a dhrun test target"
)
)
<> help "Type of operation to run."
)
toCommand :: NixCommand -> Text
toCommand NixBuild = "nix-build"
toCommand NixTest = "nix-build"
toCommand NixShell = "nix-shell"
toCommand NixBuild = "nix-build"
toCommand NixTest = "nix-build"
toCommand NixShell = "nix-shell"
toCommand NixShellTest = "nix-shell"
targetParser :: Parser Text
targetParser = strArgument
......@@ -188,7 +197,10 @@ setupSystem target sa = do
passVars <- getVars ["PATH", "NIX_PATH", "NIX_SSL_CERT_FILE"]
let envVars =
[("XDG_CACHE_HOME", varXDG_CACHE_HOME), ("TMPDIR", varTMPDIR),("NIX_REMOTE","")]
[ ("XDG_CACHE_HOME", varXDG_CACHE_HOME)
, ("TMPDIR" , varTMPDIR)
, ("NIX_REMOTE" , "")
]
++ passVars
nodeosVar <- if isTarget target
......@@ -261,7 +273,8 @@ wrap :: NixCommand -> Text -> ArgsCommon -> IO ()
wrap nixCommand target sa@ArgsCommon {..} = do
when (verbosity == Verbose) $ print sa
(envVars, tmpDir) <- setupSystem
(if nixCommand == NixTest then "testGeneric" else target)
(if nixCommand `elem` [NixTest, NixShellTest] then "testGeneric" else target
)
sa
when (verbosity == Verbose) $ print envVars
case nixCommand of
......@@ -270,6 +283,8 @@ wrap nixCommand target sa@ArgsCommon {..} = do
NixTest -> rpv (toS nixc) (fmap toS arglistTest) envVars >>= \case
(ExitSuccess , _) -> copySuccess "/tmp/papa"
(ExitFailure _, _) -> copyFailure (toS tmpDir) >> die "build failed."
NixShellTest ->
executeFile (toS nixc) True (fmap toS arglistTest) (Just $ evC envVars)
NixBuild -> rpv (toS nixc) (fmap toS arglist) envVars >>= \case
(ExitSuccess , _) -> copySuccess "/tmp/papa"
(ExitFailure _, _) -> copyFailure (toS tmpDir) >> die "build failed."
......@@ -289,7 +304,6 @@ wrap nixCommand target sa@ArgsCommon {..} = do
rpv "cp" ["--no-preserve=mode", "-r", source, "./nixtmpdir"] [] >>= \case
(ExitFailure _, _) -> die "failed copying the failed build dir."
(ExitSuccess , _) -> return ()
rpv "chmod" ["-R", "+w", "./nixtmpdir"] [] >>= \case
(ExitFailure _, _) -> die "failed changing perms on the failure dir."
(ExitSuccess , _) -> return ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment