X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f5162efc3578d0420e869e3fcbda46454a855909..844ff7cc1dc1c93a29b7ad8eca2987b987cf89e6:/lib/crunchrun/executor_test.go diff --git a/lib/crunchrun/executor_test.go b/lib/crunchrun/executor_test.go index 0f9901d6a1..3301a6e63b 100644 --- a/lib/crunchrun/executor_test.go +++ b/lib/crunchrun/executor_test.go @@ -80,12 +80,29 @@ func (s *executorSuite) TearDownTest(c *C) { } func (s *executorSuite) TestExecTrivialContainer(c *C) { + c.Logf("Using container runtime: %s", s.executor.Runtime()) s.spec.Command = []string{"echo", "ok"} s.checkRun(c, 0) c.Check(s.stdout.String(), Equals, "ok\n") c.Check(s.stderr.String(), Equals, "") } +func (s *executorSuite) TestExitStatus(c *C) { + s.spec.Command = []string{"false"} + s.checkRun(c, 1) +} + +func (s *executorSuite) TestSignalExitStatus(c *C) { + if _, isdocker := s.executor.(*dockerExecutor); isdocker { + // It's not quite this easy to make busybox kill + // itself in docker where it's pid 1. + c.Skip("kill -9 $$ doesn't work on busybox with pid=1 in docker") + return + } + s.spec.Command = []string{"sh", "-c", "kill -9 $$"} + s.checkRun(c, 0x80+9) +} + func (s *executorSuite) TestExecStop(c *C) { s.spec.Command = []string{"sh", "-c", "sleep 10; echo ok"} err := s.executor.Create(s.spec) @@ -120,8 +137,10 @@ func (s *executorSuite) TestExecCleanEnv(c *C) { // docker sets these by itself case "LD_LIBRARY_PATH", "SINGULARITY_NAME", "PWD", "LANG", "SHLVL", "SINGULARITY_INIT", "SINGULARITY_CONTAINER": // singularity sets these by itself (cf. https://sylabs.io/guides/3.5/user-guide/environment_and_metadata.html) - case "PROMPT_COMMAND", "PS1", "SINGULARITY_APPNAME": - // singularity also sets these by itself (as of v3.5.2) + case "SINGULARITY_APPNAME": + // singularity also sets this by itself (v3.5.2, but not v3.7.4) + case "PROMPT_COMMAND", "PS1", "SINGULARITY_BIND", "SINGULARITY_COMMAND", "SINGULARITY_ENVIRONMENT": + // singularity also sets these by itself (v3.7.4) default: got[kv[0]] = kv[1] }