Remove legacy packetimpact runner

Fixes #6835

PiperOrigin-RevId: 416179261
This commit is contained in:
Zeling Feng
2021-12-13 18:05:42 -08:00
committed by gVisor bot
parent ef0119d3d0
commit f5482c508c
5 changed files with 20 additions and 770 deletions
+1 -27
View File
@@ -1,42 +1,16 @@
load("//tools:defs.bzl", "bzl_library", "go_binary", "go_library", "go_test")
load("//tools:defs.bzl", "bzl_library", "go_binary")
package(
default_visibility = ["//test/packetimpact:__subpackages__"],
licenses = ["notice"],
)
go_test(
name = "packetimpact_test",
srcs = [
"packetimpact_test.go",
],
tags = [
# Not intended to be run directly.
"local",
"manual",
],
deps = [":runner"],
)
bzl_library(
name = "defs_bzl",
srcs = ["defs.bzl"],
visibility = ["//test/packetimpact:__subpackages__"],
)
go_library(
name = "runner",
testonly = True,
srcs = ["dut.go"],
visibility = ["//test/packetimpact:__subpackages__"],
deps = [
"//pkg/test/dockerutil",
"//test/packetimpact/netdevs",
"//test/packetimpact/testbench",
"@com_github_docker_docker//api/types/mount:go_default_library",
],
)
go_binary(
name = "main",
testonly = True,
+19 -47
View File
@@ -82,7 +82,6 @@ def packetimpact_native_test(
name,
testbench_binary,
expect_failure = False,
legacy_runner = False,
**kwargs):
"""Add a native packetimpact test.
@@ -90,34 +89,23 @@ def packetimpact_native_test(
name: name of the test
testbench_binary: the testbench binary
expect_failure: the test must fail
legacy_runner: use the legacy docker runner
**kwargs: all the other args, forwarded to _packetimpact_test
"""
expect_failure_flag = ["--expect_failure"] if expect_failure else []
if legacy_runner:
_packetimpact_test(
name = name + "_native_test",
testbench_binary = testbench_binary,
flags = ["--native"] + expect_failure_flag,
tags = PACKETIMPACT_TAGS,
**kwargs
)
else:
_packetimpact_test(
test_runner = "//test/packetimpact/runner:main",
name = name + "_native_test",
testbench_binary = testbench_binary,
flags = expect_failure_flag + ["--variant", "native"],
dut_binary = "//test/packetimpact/dut/native",
tags = PACKETIMPACT_TAGS,
**kwargs
)
_packetimpact_test(
test_runner = "//test/packetimpact/runner:main",
name = name + "_native_test",
testbench_binary = testbench_binary,
flags = expect_failure_flag + ["--variant", "native"],
dut_binary = "//test/packetimpact/dut/native",
tags = PACKETIMPACT_TAGS,
**kwargs
)
def packetimpact_netstack_test(
name,
testbench_binary,
expect_failure = False,
legacy_runner = False,
**kwargs):
"""Add a packetimpact test on netstack.
@@ -125,34 +113,22 @@ def packetimpact_netstack_test(
name: name of the test
testbench_binary: the testbench binary
expect_failure: the test must fail
legacy_runner: use the legacy docker runner
**kwargs: all the other args, forwarded to _packetimpact_test
"""
expect_failure_flag = []
if expect_failure:
expect_failure_flag = ["--expect_failure"]
if legacy_runner:
_packetimpact_test(
name = name + "_netstack_test",
testbench_binary = testbench_binary,
# Note that a distinct runtime must be provided in the form
# --test_arg=--runtime=other when invoking bazel.
flags = expect_failure_flag,
tags = PACKETIMPACT_TAGS,
**kwargs
)
else:
_packetimpact_test(
test_runner = "//test/packetimpact/runner:main",
name = name + "_netstack_test",
testbench_binary = testbench_binary,
flags = expect_failure_flag + ["--variant", "gvisor"],
dut_binary = "//test/packetimpact/dut/runsc",
tags = PACKETIMPACT_TAGS,
**kwargs
)
_packetimpact_test(
test_runner = "//test/packetimpact/runner:main",
name = name + "_netstack_test",
testbench_binary = testbench_binary,
flags = expect_failure_flag + ["--variant", "gvisor"],
dut_binary = "//test/packetimpact/dut/runsc",
tags = PACKETIMPACT_TAGS,
**kwargs
)
def packetimpact_go_test(name, expect_native_failure = False, expect_netstack_failure = False, num_duts = 1, legacy_runner = False, **kwargs):
def packetimpact_go_test(name, expect_native_failure = False, expect_netstack_failure = False, num_duts = 1, **kwargs):
"""Add packetimpact tests written in go.
Args:
@@ -160,7 +136,6 @@ def packetimpact_go_test(name, expect_native_failure = False, expect_netstack_fa
expect_native_failure: the test must fail natively
expect_netstack_failure: the test must fail for Netstack
num_duts: how many DUTs are needed for the test
legacy_runner: use the legacy docker runner
**kwargs: all the other args, forwarded to packetimpact_native_test and packetimpact_netstack_test
"""
testbench_binary = name + "_test"
@@ -169,7 +144,6 @@ def packetimpact_go_test(name, expect_native_failure = False, expect_netstack_fa
expect_failure = expect_native_failure,
num_duts = num_duts,
testbench_binary = testbench_binary,
legacy_runner = legacy_runner,
**kwargs
)
packetimpact_netstack_test(
@@ -177,7 +151,6 @@ def packetimpact_go_test(name, expect_native_failure = False, expect_netstack_fa
expect_failure = expect_netstack_failure,
num_duts = num_duts,
testbench_binary = testbench_binary,
legacy_runner = legacy_runner,
**kwargs
)
@@ -209,7 +182,6 @@ PacketimpactTestInfo = provider(
"timeout",
"expect_netstack_failure",
"num_duts",
"legacy_runner",
],
)
File diff suppressed because it is too large Load Diff
@@ -1,32 +0,0 @@
// Copyright 2020 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// The runner starts docker containers and networking for a packetimpact test.
package packetimpact_test
import (
"context"
"flag"
"testing"
"gvisor.dev/gvisor/test/packetimpact/runner"
)
func init() {
runner.RegisterFlags(flag.CommandLine)
}
func TestOne(t *testing.T) {
runner.TestWithDUT(context.Background(), t, runner.NewDockerDUT)
}
-1
View File
@@ -417,7 +417,6 @@ validate_all_tests()
name = t.name,
timeout = t.timeout if hasattr(t, "timeout") else "moderate",
expect_netstack_failure = hasattr(t, "expect_netstack_failure"),
legacy_runner = t.legacy_runner if hasattr(t, "legacy_runner") else False,
num_duts = t.num_duts if hasattr(t, "num_duts") else 1,
) for t in ALL_TESTS]