diff --git a/antlir/bzl/antlir2_shim.bzl b/antlir/bzl/antlir2_shim.bzl index 29caa540f1..0822251e9c 100644 --- a/antlir/bzl/antlir2_shim.bzl +++ b/antlir/bzl/antlir2_shim.bzl @@ -31,6 +31,9 @@ antlir2_setting = native.enum( ) if is_buck2() else _antlir2_setting_buck1 def _should_shadow(antlir2: str | bool | None) -> bool: + if not is_buck2(): + return False + if antlir2 == None and is_buck2(): package_mode = antlir2_migration.get_mode() return package_mode == antlir2_migration.mode_t("shadow") diff --git a/antlir/bzl/debuginfo.bzl b/antlir/bzl/debuginfo.bzl index 4fdf77c6d0..c846419920 100644 --- a/antlir/bzl/debuginfo.bzl +++ b/antlir/bzl/debuginfo.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/antlir2/bzl/image:defs.bzl", antlir2_image = "image") load("//antlir/bzl:flavor_helpers.bzl", "flavor_helpers") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") diff --git a/antlir/bzl/genrule/extractor/extract.bzl b/antlir/bzl/genrule/extractor/extract.bzl index 7aefcae770..30f516fca8 100644 --- a/antlir/bzl/genrule/extractor/extract.bzl +++ b/antlir/bzl/genrule/extractor/extract.bzl @@ -62,6 +62,7 @@ exported by a parent layer which also includes an extract.extract feature. load("@bazel_skylib//lib:paths.bzl", "paths") load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl:antlir2_shim.bzl", "antlir2_shim") +load("//antlir/bzl:build_defs.bzl", "is_buck2") load("//antlir/bzl:constants.bzl", "REPO_CFG") load("//antlir/bzl:image.bzl", "image") load("//antlir/bzl:sha256.bzl", "sha256_b64") @@ -92,12 +93,12 @@ def _extract( if antlir2_shim.upgrade_or_shadow_feature( name = name, antlir2 = antlir2, - fn = antlir2_feature.new, + fn = antlir2_shim.getattr_buck2(antlir2_feature, "new"), features = [ antlir2_feature.extract_from_layer( binaries = binaries, layer = source + ".antlir2", - ), + ) if is_buck2() else None, ], visibility = [], fake_buck1 = struct( diff --git a/antlir/bzl/image/package/new.bzl b/antlir/bzl/image/package/new.bzl index ec9d1370dd..b3ca6de544 100644 --- a/antlir/bzl/image/package/new.bzl +++ b/antlir/bzl/image/package/new.bzl @@ -66,7 +66,7 @@ def package_new( if antlir2_shim.upgrade_or_shadow_package( antlir2 = antlir2, name = name, - fn = antlir2_package.backward_compatible_new, + fn = antlir2_shim.getattr_buck2(antlir2_package, "backward_compatible_new"), layer = layer + ".antlir2", format = format, visibility = visibility, diff --git a/antlir/bzl/image_genrule_layer.bzl b/antlir/bzl/image_genrule_layer.bzl index 2d65ac4a28..bf8d12e23e 100644 --- a/antlir/bzl/image_genrule_layer.bzl +++ b/antlir/bzl/image_genrule_layer.bzl @@ -120,7 +120,7 @@ Optional arguments: antlir2_feature.genrule( cmd = cmd, user = user, - ), + ) if is_buck2() else None, ], implicit_antlir2 = True, fake_buck1 = struct( diff --git a/antlir/bzl/linux/busybox.bzl b/antlir/bzl/linux/busybox.bzl index 5c83743657..6604a4acce 100644 --- a/antlir/bzl/linux/busybox.bzl +++ b/antlir/bzl/linux/busybox.bzl @@ -5,7 +5,7 @@ load("@bazel_skylib//lib:new_sets.bzl", "sets") load("@bazel_skylib//lib:paths.bzl", "paths") -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") DEFAULT_APPLETS = sets.make([ diff --git a/antlir/bzl/linux/config/glibc/nsswitch.bzl b/antlir/bzl/linux/config/glibc/nsswitch.bzl index dbfa93ba6f..434ee4ad1d 100644 --- a/antlir/bzl/linux/config/glibc/nsswitch.bzl +++ b/antlir/bzl/linux/config/glibc/nsswitch.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl:sha256.bzl", "sha256_b64") load("//antlir/bzl:shape.bzl", "shape") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") diff --git a/antlir/bzl/linux/config/network/resolv.bzl b/antlir/bzl/linux/config/network/resolv.bzl index 76d625da3a..48531890af 100644 --- a/antlir/bzl/linux/config/network/resolv.bzl +++ b/antlir/bzl/linux/config/network/resolv.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl:sha256.bzl", "sha256_b64") load("//antlir/bzl:shape.bzl", "shape") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") diff --git a/antlir/bzl/linux/filesystem.bzl b/antlir/bzl/linux/filesystem.bzl index 41f23995cb..ff9b47de2a 100644 --- a/antlir/bzl/linux/filesystem.bzl +++ b/antlir/bzl/linux/filesystem.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") def _install(use_antlir2 = False): diff --git a/antlir/bzl/linux/release.bzl b/antlir/bzl/linux/release.bzl index 370562fa8c..dd961e18eb 100644 --- a/antlir/bzl/linux/release.bzl +++ b/antlir/bzl/linux/release.bzl @@ -4,7 +4,7 @@ # LICENSE file in the root directory of this source tree. load("@bazel_skylib//lib:types.bzl", "types") -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl:build_defs.bzl", "buck_genrule") load("//antlir/bzl:target_helpers.bzl", "antlir_dep", "normalize_target") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") diff --git a/antlir/bzl/linux/time.bzl b/antlir/bzl/linux/time.bzl index f0cfa87cbc..c76a608cad 100644 --- a/antlir/bzl/linux/time.bzl +++ b/antlir/bzl/linux/time.bzl @@ -4,7 +4,7 @@ # LICENSE file in the root directory of this source tree. load("@bazel_skylib//lib:paths.bzl", "paths") -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl/image/feature:defs.bzl", "feature") def _timezone(zone, timezone_dir = "/usr/share/zoneinfo", use_antlir2 = False): diff --git a/antlir/linux/vm/console/defs.bzl b/antlir/linux/vm/console/defs.bzl index d1e107ec76..67f842cf46 100644 --- a/antlir/linux/vm/console/defs.bzl +++ b/antlir/linux/vm/console/defs.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") def _autologin(use_antlir2 = False): diff --git a/antlir/linux/vm/generator/defs.bzl b/antlir/linux/vm/generator/defs.bzl index a33ca9b977..6bd1920aa3 100644 --- a/antlir/linux/vm/generator/defs.bzl +++ b/antlir/linux/vm/generator/defs.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") def _mounts(use_antlir2 = False): diff --git a/antlir/linux/vm/network/defs.bzl b/antlir/linux/vm/network/defs.bzl index 59fd5f7f5d..56412e9e43 100644 --- a/antlir/linux/vm/network/defs.bzl +++ b/antlir/linux/vm/network/defs.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl:systemd.bzl", "systemd") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") diff --git a/antlir/linux/vm/ssh/defs.bzl b/antlir/linux/vm/ssh/defs.bzl index c2a867b788..29a945e782 100644 --- a/antlir/linux/vm/ssh/defs.bzl +++ b/antlir/linux/vm/ssh/defs.bzl @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//antlir/antlir2/bzl/feature:defs.bzl", antlir2_feature = "feature") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", antlir2_feature = "feature") load("//antlir/bzl:systemd.bzl", "systemd") load("//antlir/bzl/image/feature:defs.bzl", antlir1_feature = "feature") diff --git a/antlir/rpm/dnf2buck/demo/aarch64/BUCK b/antlir/rpm/dnf2buck/demo/aarch64/BUCK deleted file mode 100644 index f06cabf0a1..0000000000 --- a/antlir/rpm/dnf2buck/demo/aarch64/BUCK +++ /dev/null @@ -1,58 +0,0 @@ -load("//antlir/rpm/dnf2buck:repo.bzl", "repo") -load("//antlir/rpm/dnf2buck:rpm.bzl", "rpm") -load("//antlir/util/testing/snapshot_test:snapshot_test.bzl", "dir_snapshot_test") - -rpm( - name = "rpm-test-cheese-1-1.aarch64.rpm", - arch = "aarch64", - epoch = 0, - release = "1", - rpm = "rpm-test-cheese-1-1.aarch64.rpm", - rpm_name = "rpm-test-cheese", - sha256 = "17be19b545c4dbcfd2176bb745841ed2c79bcb0bbacc1061ff3bbbf61b4be816", - version = "1", -) - -rpm( - name = "rpm-test-cheese-2-1.aarch64.rpm", - arch = "aarch64", - epoch = 0, - release = "1", - rpm = "rpm-test-cheese-2-1.aarch64.rpm", - rpm_name = "rpm-test-cheese", - sha256 = "b7b870c2e6b4ced9057b3ed6a79737c4a96ea871e8358416b1f9229552797db7", - version = "2", - visibility = ["//antlir/antlir2/test_images/rpms/..."], -) - -rpm( - name = "rpm-test-cheese-3-1.aarch64.rpm", - arch = "aarch64", - epoch = 0, - release = "1", - rpm = "rpm-test-cheese-3-1.aarch64.rpm", - rpm_name = "rpm-test-cheese", - sha256 = "67eee9f33c9349299cd489c1d826f8c35eebaf241e129faa5c08359c8cc37958", - version = "3", -) - -repo( - name = "test-repo", - compress = "none", - rpms = [ - ":rpm-test-cheese-1-1.aarch64.rpm", - ":rpm-test-cheese-2-1.aarch64.rpm", - ":rpm-test-cheese-3-1.aarch64.rpm", - ], - timestamp = 0, - visibility = [ - "//antlir/rpm/dnf2buck/...", - ], -) - -dir_snapshot_test( - name = "test-built-repodata", - actual = ":test-repo[repodata]", - file_modes = False, - snapshot = glob(["repodata/*"]), -) diff --git a/antlir/vm/BUCK b/antlir/vm/BUCK index 2bf3ab1c70..daae3e31d0 100644 --- a/antlir/vm/BUCK +++ b/antlir/vm/BUCK @@ -1,4 +1,4 @@ -load("//antlir/bzl:build_defs.bzl", "export_file", "python_binary", "python_library") +load("//antlir/bzl:build_defs.bzl", "export_file", "is_buck2", "python_binary", "python_library") load("//antlir/bzl:kernel_shim.bzl", "kernels") load("//antlir/vm/bzl:defs.bzl", "vm") @@ -151,7 +151,7 @@ vm.run( )], kernel = kernels.default, ), -) +) if is_buck2() else None vm.run( name = "default-5.19", @@ -163,7 +163,7 @@ vm.run( )], kernel = kernels.get("5.19"), ), -) +) if is_buck2() else None vm.run( name = "default-initrd-debug", @@ -179,7 +179,7 @@ vm.run( disk = vm.types.disk.root(), kernel = kernels.default, ), -) +) if is_buck2() else None vm.run( name = "multinics", @@ -188,4 +188,4 @@ vm.run( kernel = kernels.default, nics = 4, ), -) +) if is_buck2() else None diff --git a/antlir/vm/bzl/initrd.bzl b/antlir/vm/bzl/initrd.bzl index e2de26dccf..ce9869dda1 100644 --- a/antlir/vm/bzl/initrd.bzl +++ b/antlir/vm/bzl/initrd.bzl @@ -4,9 +4,9 @@ # LICENSE file in the root directory of this source tree. load("@bazel_skylib//lib:paths.bzl", "paths") -load("//antlir/antlir2/bzl/feature:defs.bzl", "feature") -load("//antlir/antlir2/bzl/image:defs.bzl", "image") -load("//antlir/antlir2/bzl/package:defs.bzl", "package") +load("//antlir/antlir2/bzl/feature:defs.bzl?v2_only", "feature") +load("//antlir/antlir2/bzl/image:defs.bzl?v2_only", "image") +load("//antlir/antlir2/bzl/package:defs.bzl?v2_only", "package") load("//antlir/bzl:build_defs.bzl", "get_visibility") load("//antlir/bzl:systemd.bzl", "systemd") load("//antlir/bzl:types.bzl", "types") diff --git a/antlir/vm/initrd/BUCK b/antlir/vm/initrd/BUCK index f7ed3ec6e5..9f842396c0 100644 --- a/antlir/vm/initrd/BUCK +++ b/antlir/vm/initrd/BUCK @@ -1,4 +1,4 @@ -load("//antlir/bzl:build_defs.bzl", "export_file") +load("//antlir/bzl:build_defs.bzl", "export_file", "is_buck2") load("//antlir/bzl:kernel_shim.bzl", "kernels") load("//antlir/vm/bzl:initrd.bzl", "initrd") @@ -16,4 +16,4 @@ export_file( [initrd( kernel = kernels.get(uname), visibility = ["PUBLIC"], -) for uname in kernels.all_kernels] +) for uname in kernels.all_kernels] if is_buck2() else None diff --git a/antlir/vm/tests/BUCK b/antlir/vm/tests/BUCK deleted file mode 100644 index 8c228114fd..0000000000 --- a/antlir/vm/tests/BUCK +++ /dev/null @@ -1,390 +0,0 @@ -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") -load("//antlir/bzl:build_defs.bzl", "export_file", "python_unittest", "rust_binary") -load("//antlir/bzl:image.bzl", "image") -load("//antlir/bzl:image_unittest_helpers.bzl", helpers = "image_unittest_helpers") -load("//antlir/bzl:kernel_shim.bzl", "kernels") -load("//antlir/bzl:shape.bzl", "shape") -load("//antlir/bzl:systemd.bzl", "ADMIN_ROOT", "systemd") -load("//antlir/bzl/image/feature:defs.bzl", "feature") -load("//antlir/vm/bzl:defs.bzl", "vm") -load("//antlir/vm/bzl:initrd.bzl", "initrd") -load("//metalos/os/tests:defs.bzl", "fail_unit") - -oncall("twimage") - -# Future: when we run a VM the tap device is actually created -# on the host, but this test runs inside a VM, which needs -# a tap device... Yes, this is circular, since tap devices -# are created inside of network namespaces (always), it *should* -# be ok to run this inside of a regular test instead. However, -# this needs to run as root... so really this should probably -# be run inside a container instead of a vm. -vm.python_unittest( - name = "test-tap", - srcs = ["test_tap.py"], - deps = [ - "//antlir:testlib_common", - "//antlir/vm:tap", - ], -) - -initrd( - name = "initrd-fail-metalinit", - features = [ - fail_unit("metalos-init.service"), - ], - kernel = kernels.default, -) - -python_unittest( - name = "test-vm", - srcs = [ - "test_share_generator.py", - "test_vm.py", - ], - env = { - "test-vm-initrd-fail-json": shape.do_not_cache_me_json( - vm.types.opts.new( - initrd = ":initrd-fail-metalinit", - ), - ), - "test-vm-json": shape.do_not_cache_me_json( - vm.types.opts.new( - disk = vm.types.disk.root( - # to cover the additional_scratch_mb branch in antlir/vm/share.py - disk_free_mb = 2048, - interface = "virtio-blk", - layer = ":vmtest-custom-layer", - ), - runtime = vm.types.runtime.new( - connection = vm.types.connection.new( - # Test using ssh options - options = { - "ServerAliveCountMax": "1", - "ServerAliveInterval": "1", - }, - ), - tpm = True, - ), - ), - ), - "test-vm-nvme-json": shape.do_not_cache_me_json( - vm.types.opts.new( - disk = vm.types.disk.root( - interface = "nvme", - layer = ":vmtest-custom-layer", - ), - ), - ), - "test-vm-sata-json": shape.do_not_cache_me_json( - vm.types.opts.new( - disk = vm.types.disk.root( - interface = "ide-hd", - layer = ":vmtest-custom-layer", - ), - ), - ), - "test-vm-sidecar-json": shape.do_not_cache_me_json( - vm.types.opts.new( - runtime = vm.types.runtime.new( - sidecar_services = ["/bin/sleep 3600"], - ), - ), - ), - }, - needed_coverage = [ - (100, "//antlir/vm:vm"), - (100, "//antlir/vm:share"), - (100, "//antlir/vm:guest-ssh"), - ], - resources = { - "//antlir/vm:mount-generator": "mount-generator", - }, - deps = [ - "//antlir:fs_utils", - "//antlir:testlib_common", - "//antlir:unshare", - "//antlir/vm:mount-generator", - "//antlir/vm:share", - "//antlir/vm:vm", - ], -) - -# Don't run this test directly, it should only be used within -# `:test-kernel-panic`. -vm.python_unittest( - name = "create-kernel-panic", - srcs = ["create_kernel_panic.py"], - labels = helpers.tags_to_hide_test(), - visibility = [], - vm_opts = vm.types.opts.new( - runtime = vm.types.runtime.new( - connection = vm.types.connection.new( - # Set the options such that it fails fast when - # the vm crashes. This is just to make the test - # run in a reasonable amount of time. - options = { - "ServerAliveCountMax": "1", - "ServerAliveInterval": "1", - }, - ), - ), - ), -) - -python_unittest( - name = "test-kernel-panic", - srcs = ["test_kernel_panic.py"], - resources = { - ":create-kernel-panic=vmtest": "create-kernel-panic", - }, - deps = [ - ":create-kernel-panic", - "//antlir:fs_utils", - "//antlir:testlib_common", - "//antlir/nspawn_in_subvol:common", - ], -) - -# To test initrd.break functionality override the default -# debug-shell.conf behavior. Instead of spawning a shell we'll dump some -# debug information and then halt the VM. -antlir2_image.layer( - name = "vmtest-initrd-break-custom-initrd-layer", - features = [ - # - # This override is installed into ADMIN_ROOT (/etc/systemd/system) - # because it's overriding the existing debug-shell.conf override - # in PROVIDER_ROOT (/usr/lib/systemd/system). - # - antlir2_feature.ensure_subdirs_exist( - into_dir = "/", - subdirs_to_create = ADMIN_ROOT, - ), - systemd.install_dropin( - dest = "override.conf", - install_root = ADMIN_ROOT, - source = "debug-shell-exec-override.conf", - unit = "debug-shell.service", - use_antlir2 = True, - ), - ], - parent_layer = "//antlir/vm/initrd:{}-initrd-layer".format( - kernels.default.uname, - ), -) - -antlir2_package.cpio_gz( - name = "vmtest-initrd-break-custom-initrd", - layer = ":vmtest-initrd-break-custom-initrd-layer", -) - -# Create a VM to test booting with "initrd.break" set -vm.run( - name = "vmtest-initrd-break-default", - vm_opts = vm.types.opts.new( - append = ["initrd.break"], - initrd = ":vmtest-initrd-break-custom-initrd", - runtime = vm.types.runtime.new( - connection = vm.types.connection.new( - # Set the options such that it fails fast when - # the vm crashes. This is just to make the test - # run in a reasonable amount of time. - options = { - "ServerAliveCountMax": "1", - "ServerAliveInterval": "1", - }, - ), - ), - ), -) - -# TODO(T120961487) Fix this later -# python_unittest( -# name = "test-initrd-break", -# srcs = ["test_initrd_break.py"], -# resources = { -# ":vmtest-initrd-break-default": "vmtest-initrd-break-default", -# }, -# deps = [ -# ":vmtest-initrd-break-default", -# "//antlir:fs_utils", -# "//antlir:testlib_common", -# "//antlir/nspawn_in_subvol:common", -# ], -# ) - -export_file(name = "resource.txt") - -test_env_vars = { - "dogsgo": "woof", - "kitteh": "meow", -} - -image.layer( - name = "vmtest-custom-layer", - features = [ - feature.install( - ":resource.txt", - "/etc/i_am_a_custom_rootfs", - ), - ], - parent_layer = vm.artifacts.rootfs.layer, -) - -vm.python_unittest( - name = "python", - srcs = [ - "test_basic_vm.py", - "test_vm_boot.py", - ], - env = test_env_vars, - resources = { - ":resource.txt": "resource", - }, - vm_opts = vm.types.opts.new( - cpus = 4, - disk = vm.types.disk.root( - layer = ":vmtest-custom-layer", - ), - ), - deps = [ - ":resource.txt", - "//antlir:fs_utils", - "//antlir:testlib_common", - ], -) - -vm.python_unittest( - name = "python-remote-execution", - srcs = [ - "test_vm_boot.py", - ], - labels = [ - # 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", - ), - ), - deps = [ - "//antlir:fs_utils", - "//antlir:testlib_common", - ], -) - -vm.python_unittest( - name = "python-multinics", - srcs = [ - "test_multinics_vm.py", - ], - env = test_env_vars, - resources = { - ":resource.txt": "resource", - }, - vm_opts = vm.types.opts.new( - cpus = 1, - disk = vm.types.disk.root( - layer = ":vmtest-custom-layer", - ), - nics = 4, - ), - deps = [ - ":resource.txt", - "//antlir:fs_utils", - "//antlir:testlib_common", - ], -) - -vm.cpp_unittest( - name = "cpp", - srcs = ["CppTest.cpp"], - env = test_env_vars, -) - -vm.rust_unittest( - name = "rust", - srcs = ["rust_test.rs"], - crate_root = "rust_test.rs", - env = test_env_vars, -) - -image.layer( - name = "rootfs-with-buck-runnables", - features = ["//antlir/compiler/test_images:systemd_buck_runnables"], - parent_layer = vm.artifacts.rootfs.layer, -) - -vm.python_unittest( - name = "test-buck-runnable", - srcs = ["test_buck_runnable.py"], - vm_opts = vm.types.opts.new( - disk = vm.types.disk.root(layer = ":rootfs-with-buck-runnables"), - ), - deps = [ - "//antlir:fs_utils", - "//antlir:testlib_common", - ], -) - -vm.python_unittest( - name = "test-with-kernel-devel", - srcs = ["test_kernel_devel.py"], - vm_opts = vm.types.opts.new( - devel = True, - ), - deps = [ - "//antlir:testlib_common", - ], -) - -vm.python_unittest( - name = "test-many-disks", - srcs = ["test_many_disks.py"], - vm_opts = vm.types.opts.new( - disks = [ - vm.types.disk.root(), - ] + [ - vm.types.disk.scratch( - size_mb = 16, - ), - ] * 36, - ), - deps = [ - "//antlir:fs_utils", - "//antlir:testlib_common", - ], -) - -rust_binary( - name = "sidecar", - srcs = ["sidecar.rs"], - deps = [ - "tokio", - ], -) - -vm.rust_unittest( - name = "with-sidecar", - srcs = ["test_with_sidecar.rs"], - crate_root = "test_with_sidecar.rs", - vm_opts = vm.types.opts.new( - runtime = vm.types.runtime.new( - sidecar_services = ["$(exe :sidecar)"], - ), - ), - deps = - [ - "anyhow", - "tokio", - ], -)