diff --git a/Makefile b/Makefile index d666290..ea68119 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ LDFLAGS := -X github.com/docker/containerd.GitCommit=${GIT_COMMIT} ${LDFLAGS} TEST_TIMEOUT ?= 5m TEST_SUITE_TIMEOUT ?= 10m +RUNTIME ?= runc + # if this session isn't interactive, then we don't want to allocate a # TTY, which would fail, but if it is interactive, we do want to attach # so that the user can send e.g. ^C through. @@ -86,14 +88,14 @@ shell: dbuild $(DOCKER_RUN) bash test: validate install bundles-rootfs - go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test) + go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test ) -runtime=$(RUNTIME) ifneq ($(wildcard /.dockerenv), ) cd integration-test ; \ go test -check.v -check.timeout=$(TEST_TIMEOUT) timeout=$(TEST_SUITE_TIMEOUT) $(TESTFLAGS) github.com/docker/containerd/integration-test endif bench: shim validate install bundles-rootfs - go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test) + go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test) -runtime=$(RUNTIME) validate: fmt lint diff --git a/runtime/runtime_test.go b/runtime/runtime_test.go index 49b4711..7b737a5 100644 --- a/runtime/runtime_test.go +++ b/runtime/runtime_test.go @@ -9,6 +9,7 @@ import ( "syscall" "testing" "time" + "flag" utils "github.com/docker/containerd/testutils" ) @@ -16,6 +17,7 @@ import ( var ( devNull = "/dev/null" stdin io.WriteCloser + runtimeTool = flag.String("runtime", "runc", "Runtime to use for this test") ) // Create containerd state and oci bundles directory @@ -145,7 +147,7 @@ func BenchmarkBusyboxSh(b *testing.B) { Root: utils.StateDir, ID: bundleName, Bundle: filepath.Join(wd, bundlePath), - Runtime: "runc", + Runtime: *runtimeTool, Shim: "containerd-shim", Timeout: 15 * time.Second, }) @@ -165,7 +167,7 @@ func benchmarkStartContainer(b *testing.B, c Container, s Stdio, bundleName stri b.Fatalf("Error starting container %v", err) } - kill := exec.Command("runc", "kill", bundleName, "KILL") + kill := exec.Command(c.Runtime(), "kill", bundleName, "KILL") kill.Run() // wait for kill to finish. selected wait time is arbitrary diff --git a/supervisor/sort_test.go b/supervisor/sort_test.go index 74a4e08..3a419db 100644 --- a/supervisor/sort_test.go +++ b/supervisor/sort_test.go @@ -4,11 +4,16 @@ import ( "os" "sort" "testing" + "flag" "github.com/docker/containerd/runtime" "github.com/docker/containerd/specs" ) +var ( + runtimeTool = flag.String("runtime", "runc", "Runtime to use for this test") +) + type testProcess struct { id string }