Micro Benchmarks: multiples runtimes (#268)

* Micro benchmarks: use container.Runtime to kill container

Signed-off-by: Julio Montes <julio.montes@intel.com>

* Micro benchmarks: add support for multiples runtimes

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2016-06-16 16:39:19 -05:00 committed by Michael Crosby
parent 2d2dfab85a
commit 0227e9fb94
3 changed files with 13 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}