diff options
Diffstat (limited to 'runsc/test')
-rw-r--r-- | runsc/test/BUILD | 0 | ||||
-rw-r--r-- | runsc/test/build_defs.bzl | 19 | ||||
-rw-r--r-- | runsc/test/image/BUILD | 5 | ||||
-rw-r--r-- | runsc/test/integration/BUILD | 5 | ||||
-rw-r--r-- | runsc/test/testutil/docker.go | 8 |
5 files changed, 32 insertions, 5 deletions
diff --git a/runsc/test/BUILD b/runsc/test/BUILD new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/runsc/test/BUILD diff --git a/runsc/test/build_defs.bzl b/runsc/test/build_defs.bzl new file mode 100644 index 000000000..ac28cc037 --- /dev/null +++ b/runsc/test/build_defs.bzl @@ -0,0 +1,19 @@ +"""Defines a rule for runsc test targets.""" + +load("@io_bazel_rules_go//go:def.bzl", _go_test = "go_test") + +# runtime_test is a macro that will create targets to run the given test target +# with different runtime options. +def runtime_test(**kwargs): + """Runs the given test target with different runtime options.""" + name = kwargs["name"] + _go_test(**kwargs) + kwargs["name"] = name + "_hostnet" + kwargs["args"] = ["--runtime-type=hostnet"] + _go_test(**kwargs) + kwargs["name"] = name + "_kvm" + kwargs["args"] = ["--runtime-type=kvm"] + _go_test(**kwargs) + kwargs["name"] = name + "_overlay" + kwargs["args"] = ["--runtime-type=overlay"] + _go_test(**kwargs) diff --git a/runsc/test/image/BUILD b/runsc/test/image/BUILD index f3ceccb69..58758fde5 100644 --- a/runsc/test/image/BUILD +++ b/runsc/test/image/BUILD @@ -1,8 +1,9 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("//runsc/test:build_defs.bzl", "runtime_test") package(licenses = ["notice"]) -go_test( +runtime_test( name = "image_test", size = "large", srcs = [ diff --git a/runsc/test/integration/BUILD b/runsc/test/integration/BUILD index 45cfd98ba..12065617c 100644 --- a/runsc/test/integration/BUILD +++ b/runsc/test/integration/BUILD @@ -1,8 +1,9 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("//runsc/test:build_defs.bzl", "runtime_test") package(licenses = ["notice"]) -go_test( +runtime_test( name = "integration_test", size = "large", srcs = [ diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go index 81f5a9ef0..b20f8e783 100644 --- a/runsc/test/testutil/docker.go +++ b/runsc/test/testutil/docker.go @@ -15,6 +15,7 @@ package testutil import ( + "flag" "fmt" "io/ioutil" "log" @@ -30,10 +31,15 @@ import ( "github.com/kr/pty" ) +var runtimeType = flag.String("runtime-type", "", "specify which runtime to use: kvm, hostnet, overlay") + func getRuntime() string { r, ok := os.LookupEnv("RUNSC_RUNTIME") if !ok { - return "runsc-test" + r = "runsc-test" + } + if *runtimeType != "" { + r += "-" + *runtimeType } return r } |