Skip to content

Commit c955386

Browse files
chantrafacebook-github-bot
authored andcommitted
[antlir2_vm] buck part to dump eth0 traffic
Summary: Add a `dump_eth0` attribute to `vm_test` rule that default to the value of `antlir2.dump_eth0`. To enable dumping eth0 traffic, one can either use: ``` buck2 test -c antlir2.dump_eth0=1 fbcode//target ``` Test Plan: ``` buck2 test -c antlir2.dump_eth0=1 $(kerctl vmtest-config -e everstore:GICWmAACj33BEzsFAElJ4glD5YhXbuYfAAAf) fbcode//kernel/vmtest/uname_test:uname_test-6.9-local https://www.internalfb.com/intern/testinfra/testconsole/testrun/14073748886890638/ $ fbcode/tae/testx/scripts/testx artifacts list 14073748886890638 2> /dev/null | jq . { "run_id": 14073748886890638, "test_artifacts": [ { "test_id": 562950104331417, "artifacts": [ { "name": "env.txt", "handle": "GJgHgRYNVvd5xQ8DAKkPZjWrrZsubswMAAAz", "artifact_path": "/tmp/testx-20240927-154852.992554/14073748886890638/562950104331417/env.txt", "annotation_path": "/tmp/testx-20240927-154852.992554/14073748886890638/562950104331417/env.txt.annotations" }, { "name": "console.txt", "handle": "GH7YNRUw2kXZ084BAJMIS-TOtfsJbswMAAAz", "artifact_path": "/tmp/testx-20240927-154852.992554/14073748886890638/562950104331417/console.txt", "annotation_path": "/tmp/testx-20240927-154852.992554/14073748886890638/562950104331417/console.txt.annotations" }, { "name": "eth0.pcap", "handle": "GL6PRhZ3OjpwF_oDAJUP8NSoSj9nbswMAABa", "artifact_path": "/tmp/testx-20240927-154852.992554/14073748886890638/562950104331417/eth0.pcap", "annotation_path": "/tmp/testx-20240927-154852.992554/14073748886890638/562950104331417/eth0.pcap.annotations" } ] } ] } buck2 test $(kerctl vmtest-config -e everstore:GICWmAACj33BEzsFAElJ4glD5YhXbuYfAAAf) fbcode//kernel/vmtest/uname_test:uname_test-6.9-local https://www.internalfb.com/intern/testinfra/testrun/10414574189962407 $ fbcode/tae/testx/scripts/testx artifacts list 10414574189962407 2> /dev/null | jq . { "run_id": 10414574189962407, "test_artifacts": [ { "test_id": 562950104331417, "artifacts": [ { "name": "env.txt", "handle": "GLibJQ8xunWZy-sCANZQGewLE3xFbswMAAAz", "artifact_path": "/tmp/testx-20240927-155040.778857/10414574189962407/562950104331417/env.txt", "annotation_path": "/tmp/testx-20240927-155040.778857/10414574189962407/562950104331417/env.txt.annotations" }, { "name": "console.txt", "handle": "GNBRRBZay_ponBIJAFPO18ttZcxkbswMAAAz", "artifact_path": "/tmp/testx-20240927-155040.778857/10414574189962407/562950104331417/console.txt", "annotation_path": "/tmp/testx-20240927-155040.778857/10414574189962407/562950104331417/console.txt.annotations" } ] } ] } ``` Reviewed By: wujj123456 Differential Revision: D63567998 fbshipit-source-id: 22fa78b41cb4c294d71589d5688f8214ceb6a7f7
1 parent c7c8d04 commit c955386

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

antlir/antlir2/antlir2_vm/bzl/test.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def _impl(ctx: AnalysisContext) -> list[Provider]:
4444
test_cmd = cmd_args(test_cmd, "--expect-failure")
4545
if ctx.attrs.postmortem:
4646
test_cmd = cmd_args(test_cmd, "--postmortem")
47+
if ctx.attrs.dump_eth0:
48+
test_cmd = cmd_args(test_cmd, "--dump-eth0-traffic")
49+
4750
test_cmd = cmd_args(
4851
test_cmd,
4952
ctx.attrs.test[ExternalRunnerTestInfo].test_type,
@@ -109,6 +112,10 @@ def _impl(ctx: AnalysisContext) -> list[Provider]:
109112
_vm_test = rule(
110113
impl = _impl,
111114
attrs = {
115+
"dump_eth0": attrs.bool(
116+
doc = "If true, dumps the vm's eth0 traffic to a file. The file location is dictated by testX and uploaded as part of test result",
117+
default = bool(read_config("antlir2", "dump_eth0", False)),
118+
),
112119
"expect_failure": attrs.bool(
113120
doc = "If true, VM is expected to timeout or fail early.",
114121
),

0 commit comments

Comments
 (0)