mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Automated rollback of changelist 321647645
PiperOrigin-RevId: 321808673
This commit is contained in:
+7
-51
@@ -1,82 +1,38 @@
|
||||
load("//test/runtimes:defs.bzl", "exclude_test", "runtime_test")
|
||||
load("//test/runtimes:defs.bzl", "runtime_test")
|
||||
|
||||
package(licenses = ["notice"])
|
||||
|
||||
go_binary(
|
||||
name = "runner",
|
||||
testonly = 1,
|
||||
srcs = ["runner.go"],
|
||||
visibility = ["//test/runtimes:__pkg__"],
|
||||
deps = [
|
||||
"//pkg/log",
|
||||
"//pkg/test/dockerutil",
|
||||
"//pkg/test/testutil",
|
||||
],
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "go1.12",
|
||||
exclude_file = "exclude/go1.12.csv",
|
||||
exclude_file = "exclude_go1.12.csv",
|
||||
lang = "go",
|
||||
shard_count = 5,
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "java11",
|
||||
exclude_file = "exclude/java11.csv",
|
||||
exclude_file = "exclude_java11.csv",
|
||||
lang = "java",
|
||||
shard_count = 5,
|
||||
shard_count = 10,
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "nodejs12.4.0",
|
||||
exclude_file = "exclude/nodejs12.4.0.csv",
|
||||
exclude_file = "exclude_nodejs12.4.0.csv",
|
||||
lang = "nodejs",
|
||||
shard_count = 5,
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "php7.3.6",
|
||||
exclude_file = "exclude/php7.3.6.csv",
|
||||
exclude_file = "exclude_php7.3.6.csv",
|
||||
lang = "php",
|
||||
shard_count = 5,
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "python3.7.3",
|
||||
exclude_file = "exclude/python3.7.3.csv",
|
||||
exclude_file = "exclude_python3.7.3.csv",
|
||||
lang = "python",
|
||||
shard_count = 5,
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "exclude_test",
|
||||
size = "small",
|
||||
srcs = ["exclude_test.go"],
|
||||
library = ":runner",
|
||||
)
|
||||
|
||||
exclude_test(
|
||||
name = "go",
|
||||
exclude_file = "exclude/go1.12.csv",
|
||||
)
|
||||
|
||||
exclude_test(
|
||||
name = "java",
|
||||
exclude_file = "exclude/java11.csv",
|
||||
)
|
||||
|
||||
exclude_test(
|
||||
name = "nodejs",
|
||||
exclude_file = "exclude/nodejs12.4.0.csv",
|
||||
)
|
||||
|
||||
exclude_test(
|
||||
name = "php",
|
||||
exclude_file = "exclude/php7.3.6.csv",
|
||||
)
|
||||
|
||||
exclude_test(
|
||||
name = "python",
|
||||
exclude_file = "exclude/python3.7.3.csv",
|
||||
)
|
||||
|
||||
+58
-21
@@ -2,32 +2,69 @@
|
||||
|
||||
load("//tools:defs.bzl", "go_test")
|
||||
|
||||
def runtime_test(name, lang, exclude_file, **kwargs):
|
||||
go_test(
|
||||
name = name,
|
||||
srcs = ["runner.go"],
|
||||
args = [
|
||||
"--lang",
|
||||
lang,
|
||||
"--image",
|
||||
name, # Resolved as images/runtimes/%s.
|
||||
def _runtime_test_impl(ctx):
|
||||
# Construct arguments.
|
||||
args = [
|
||||
"--lang",
|
||||
ctx.attr.lang,
|
||||
"--image",
|
||||
ctx.attr.image,
|
||||
]
|
||||
if ctx.attr.exclude_file:
|
||||
args += [
|
||||
"--exclude_file",
|
||||
"test/runtimes/" + exclude_file,
|
||||
],
|
||||
data = [
|
||||
exclude_file,
|
||||
"//test/runtimes/proctor",
|
||||
],
|
||||
defines_main = 1,
|
||||
ctx.files.exclude_file[0].short_path,
|
||||
]
|
||||
|
||||
# Build a runner.
|
||||
runner = ctx.actions.declare_file("%s-executer" % ctx.label.name)
|
||||
runner_content = "\n".join([
|
||||
"#!/bin/bash",
|
||||
"%s %s $@\n" % (ctx.files._runner[0].short_path, " ".join(args)),
|
||||
])
|
||||
ctx.actions.write(runner, runner_content, is_executable = True)
|
||||
|
||||
# Return the runner.
|
||||
return [DefaultInfo(
|
||||
executable = runner,
|
||||
runfiles = ctx.runfiles(
|
||||
files = ctx.files._runner + ctx.files.exclude_file + ctx.files._proctor,
|
||||
collect_default = True,
|
||||
collect_data = True,
|
||||
),
|
||||
)]
|
||||
|
||||
_runtime_test = rule(
|
||||
implementation = _runtime_test_impl,
|
||||
attrs = {
|
||||
"image": attr.string(
|
||||
mandatory = False,
|
||||
),
|
||||
"lang": attr.string(
|
||||
mandatory = True,
|
||||
),
|
||||
"exclude_file": attr.label(
|
||||
mandatory = False,
|
||||
allow_single_file = True,
|
||||
),
|
||||
"_runner": attr.label(
|
||||
default = "//test/runtimes/runner:runner",
|
||||
),
|
||||
"_proctor": attr.label(
|
||||
default = "//test/runtimes/proctor:proctor",
|
||||
),
|
||||
},
|
||||
test = True,
|
||||
)
|
||||
|
||||
def runtime_test(name, **kwargs):
|
||||
_runtime_test(
|
||||
name = name,
|
||||
image = name, # Resolved as images/runtimes/%s.
|
||||
tags = [
|
||||
"local",
|
||||
"manual",
|
||||
],
|
||||
deps = [
|
||||
"//pkg/log",
|
||||
"//pkg/test/dockerutil",
|
||||
"//pkg/test/testutil",
|
||||
],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
load("//tools:defs.bzl", "go_binary", "go_test")
|
||||
|
||||
package(licenses = ["notice"])
|
||||
|
||||
go_binary(
|
||||
name = "runner",
|
||||
testonly = 1,
|
||||
srcs = ["main.go"],
|
||||
visibility = ["//test/runtimes:__pkg__"],
|
||||
deps = [
|
||||
"//pkg/log",
|
||||
"//pkg/test/dockerutil",
|
||||
"//pkg/test/testutil",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "exclude_test",
|
||||
size = "small",
|
||||
srcs = ["exclude_test.go"],
|
||||
library = ":runner",
|
||||
)
|
||||
@@ -26,7 +26,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
// Test that the exclude file parses without error.
|
||||
func TestExcludeList(t *testing.T) {
|
||||
func TestExcludelist(t *testing.T) {
|
||||
ex, err := getExcludes()
|
||||
if err != nil {
|
||||
t.Fatalf("error parsing exclude file: %v", err)
|
||||
@@ -99,7 +99,7 @@ func getTests(ctx context.Context, d *dockerutil.Container, excludes map[string]
|
||||
// Get a list of all tests in the image.
|
||||
list, err := d.Exec(ctx, dockerutil.ExecOpts{}, "/proctor/proctor", "--runtime", *lang, "--list")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("docker exec failed: %v\nlogs: %s", err, list)
|
||||
return nil, fmt.Errorf("docker exec failed: %v", err)
|
||||
}
|
||||
|
||||
// Calculate a subset of tests to run corresponding to the current
|
||||
@@ -166,11 +166,7 @@ func getExcludes() (map[string]struct{}, error) {
|
||||
if *excludeFile == "" {
|
||||
return excludes, nil
|
||||
}
|
||||
path, err := testutil.FindFile(*excludeFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
f, err := os.Open(path)
|
||||
f, err := os.Open(*excludeFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
Reference in New Issue
Block a user