summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact/tests/defs.bzl
diff options
context:
space:
mode:
authorEyal Soha <eyalsoha@google.com>2020-04-23 08:34:42 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-23 08:36:19 -0700
commita2925a079fa04ff4c891016a0eea1818bdb2cf4b (patch)
treeb6c38c910e35f75e1eacf66c34f422d799caed69 /test/packetimpact/tests/defs.bzl
parente69a871c7bd4e4859b0acd8b875171f3ebbaec29 (diff)
Run failing packetimpact test and expect failure.
This will make it easier to notice if a code change causes an existing test to pass. PiperOrigin-RevId: 308057978
Diffstat (limited to 'test/packetimpact/tests/defs.bzl')
-rw-r--r--test/packetimpact/tests/defs.bzl35
1 files changed, 27 insertions, 8 deletions
diff --git a/test/packetimpact/tests/defs.bzl b/test/packetimpact/tests/defs.bzl
index 8c0d058b2..27c5de375 100644
--- a/test/packetimpact/tests/defs.bzl
+++ b/test/packetimpact/tests/defs.bzl
@@ -59,7 +59,11 @@ _packetimpact_test = rule(
PACKETIMPACT_TAGS = ["local", "manual"]
-def packetimpact_linux_test(name, testbench_binary, **kwargs):
+def packetimpact_linux_test(
+ name,
+ testbench_binary,
+ expect_failure = False,
+ **kwargs):
"""Add a packetimpact test on linux.
Args:
@@ -67,28 +71,37 @@ def packetimpact_linux_test(name, testbench_binary, **kwargs):
testbench_binary: the testbench binary
**kwargs: all the other args, forwarded to _packetimpact_test
"""
+ expect_failure_flag = ["--expect_failure"] if expect_failure else []
_packetimpact_test(
name = name + "_linux_test",
testbench_binary = testbench_binary,
- flags = ["--dut_platform", "linux"],
+ flags = ["--dut_platform", "linux"] + expect_failure_flag,
tags = PACKETIMPACT_TAGS + ["packetimpact"],
**kwargs
)
-def packetimpact_netstack_test(name, testbench_binary, **kwargs):
+def packetimpact_netstack_test(
+ name,
+ testbench_binary,
+ expect_failure = False,
+ **kwargs):
"""Add a packetimpact test on netstack.
Args:
name: name of the test
testbench_binary: the testbench binary
+ expect_failure: the test must fail
**kwargs: all the other args, forwarded to _packetimpact_test
"""
+ expect_failure_flag = []
+ if expect_failure:
+ expect_failure_flag = ["--expect_failure"]
_packetimpact_test(
name = name + "_netstack_test",
testbench_binary = testbench_binary,
# This is the default runtime unless
# "--test_arg=--runtime=OTHER_RUNTIME" is used to override the value.
- flags = ["--dut_platform", "netstack", "--runtime=runsc-d"],
+ flags = ["--dut_platform", "netstack", "--runtime=runsc-d"] + expect_failure_flag,
tags = PACKETIMPACT_TAGS + ["packetimpact"],
**kwargs
)
@@ -112,7 +125,13 @@ def packetimpact_go_test(name, size = "small", pure = True, linux = True, netsta
tags = PACKETIMPACT_TAGS,
**kwargs
)
- if linux:
- packetimpact_linux_test(name = name, testbench_binary = testbench_binary)
- if netstack:
- packetimpact_netstack_test(name = name, testbench_binary = testbench_binary)
+ packetimpact_linux_test(
+ name = name,
+ expect_failure = not linux,
+ testbench_binary = testbench_binary,
+ )
+ packetimpact_netstack_test(
+ name = name,
+ expect_failure = not netstack,
+ testbench_binary = testbench_binary,
+ )