Commit a4d3fa91 authored by Valentin Reis's avatar Valentin Reis
Browse files

shellTest + singularity test.

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