Skip to content

Commit

Permalink
[fbcode_macros[sh_test] change labels into remote_execution attribute
Browse files Browse the repository at this point in the history
Test Plan:
CI

checked several target and their attributes before and after the change.
1.
before
```
10:23:36 0|[[email protected]]:/data/users/kuki/fbsource/fbcode (856d0843b)💜 buck2 targets //antlir/vm/tests:python-remote-execution -A | grep capabili

...
    "labels":{"__type":"concat","items":[["disabled","vmtest","heavyweight","use-testpilot-adapter","tpx:list-format-migration:json","test-framework=8:vmtest","vmtest_python","antlir_macros","antlir__internal","buck","dev","clang","platform010","x86_64","buck_sh","supports_remote_execution","re_opts_capabilities={\"platform\":\"mtia\",\"codename\":\"freya\"}","re_remote_cache_enabled=False"],...
    "remote_execution":{"capabilities":{"codename":"freya","platform":"mtia"},"remote_cache_enabled":false,"use_case":null},
```
after:
```
10:28:05 0|[[email protected]]:/data/users/kuki/fbsource/fbcode (dc24fdba8)💜 buck2 targets //antlir/vm/tests:python-remote-execution -A | grep capabili
...
    "labels":{"__type":"concat","items":[["supports_remote_execution","re_opts_capabilities={\"platform\":\"mtia\", \"codename\":\"freya\"}","disabled","vmtest","heavyweight","use-testpilot-adapter","tpx:list-format-migration:json","test-framework=8:vmtest","vmtest_python","antlir_macros","antlir__internal","buck","dev","clang","platform010","x86_64","buck_sh"],...
    "remote_execution":{"capabilities":{"codename":"freya","platform":"mtia"},"use_case":null},
```

2.
before:
```
10:42:45 0|[[email protected]]:/data/users/kuki/fbsource/fbcode (086cc3cf8)💜 buck2 targets //hphp/test:verify_slow_interp_jit_re -A | grep capa
...
    "labels":{"__type":"concat","items":[["buck","dev","clang","platform010","x86_64","custom","custom-type-json","fbcode_macros","hphp-test","tpx-test-type:hphp-test","long_running","run_as_bundle","tpx:experimental-shard-size-for-bundle=3","re_opts_capabilities={\"platform\": \"linux-remote-execution\"}","re_opts_use_case=hhvm_test","re_remote_cache_enabled=false","supports_remote_execution","buck2_run_from_project_root"],...,
    "remote_execution":{"capabilities":{"platform":"linux-remote-execution"},"remote_cache_enabled":false,"use_case":"hhvm_test"},
```
after:
```
10:46:47 0|[[email protected]]:/data/users/kuki/fbsource/fbcode (2027d6fe0)💜 buck2 targets //hphp/test:verify_slow_interp_jit_re -A | grep capa
...
    "labels":{"__type":"concat","items":[["buck","dev","clang","platform010","x86_64","custom","custom-type-json","fbcode_macros","hphp-test","tpx-test-type:hphp-test","long_running","run_as_bundle","tpx:experimental-shard-size-for-bundle=3","buck2_run_from_project_root"],...,"re_remote_cache_enabled=False"]]},
    "remote_execution":{"capabilities":{"platform":"linux-remote-execution"},"remote_cache_enabled":false,"use_case":"hhvm_test"},
```

Reviewed By: markisaa

Differential Revision: D50178914

fbshipit-source-id: 3e910ef461e7ab19ece4c9d29704f1b27e00dde6
  • Loading branch information
annakukliansky authored and facebook-github-bot committed Oct 12, 2023
1 parent 8831b73 commit bf6f178
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions antlir/bzl/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ _PYTHON_UNITTEST_KWARGS = _make_rule_kwargs_dict(
"tags",
"visibility",
"supports_static_listing",
"remote_execution",
],
)

Expand Down
10 changes: 1 addition & 9 deletions antlir/vm/bzl/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ with the options allowed there. The key differences with

load("@bazel_skylib//lib:new_sets.bzl", "sets")
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@fbcode_macros//build_defs/lib:re_test_utils.bzl", "re_test_utils")
load("@fbsource//tools/build_defs/buck2:is_buck2.bzl", "is_buck2")
load("//antlir/bzl:build_defs.bzl", "add_test_framework_label", "buck_sh_test", "cpp_unittest", "python_unittest", "rust_unittest")
load("//antlir/bzl:constants.bzl", "REPO_CFG")
load("//antlir/bzl:image_unittest_helpers.bzl", helpers = "image_unittest_helpers")
Expand Down Expand Up @@ -196,12 +194,6 @@ def _vm_unittest(
vm_opts = vm_opts,
)

# NOTE: We could put this code in buck_sh_test itself, but that has much wider impact.
# It's safer to start off just doing a local change for antlir.
re_attrs = {}
if is_buck2():
re_test_utils.set_re_info(re_attrs, wrapper_labels)

# FIXME: We use a bunch of genrules to generate trampoline scripts that
# don't specify their runtime dependencies (because they can't:
# https://fburl.com/workplace/ljtl2dv3) To support remote execution of
Expand Down Expand Up @@ -249,7 +241,7 @@ def _vm_unittest(
env = {"BUCK_BASE_BINARY": "$(location :{})".format(actual_test_binary)},
antlir_rule = "user-facing",
deps = deps,
**re_attrs
remote_execution = kwargs["remote_execution"] if "remote_execution" in kwargs else None,
)

def _vm_cpp_unittest(
Expand Down
7 changes: 5 additions & 2 deletions antlir/vm/tests/BUCK
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@fbcode_macros//build_defs/lib:re_test_utils.bzl", "re_test_utils")
load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature")
load("//antlir/antlir2/bzl/image:defs.bzl", antlir2_image = "image")
load("//antlir/antlir2/bzl/package:defs.bzl", antlir2_package = "package")
Expand Down Expand Up @@ -263,11 +264,13 @@ vm.python_unittest(
"test_vm_boot.py",
],
labels = [
"supports_remote_execution",
're_opts_capabilities={"platform":"mtia", "codename":"freya"}',
# FIXME(@pdel): Need some more work to get RE test execution for antlir1 vmtests.
"disabled",
],
remote_execution = re_test_utils.remote_execution(
codename = "freya",
platform = "mtia",
),
vm_opts = vm.types.opts.new(
disk = vm.types.disk.root(
layer = ":vmtest-custom-layer",
Expand Down

0 comments on commit bf6f178

Please sign in to comment.