scripts: Update build_sdk_subtools to use the new build paths.
Build paths have been moved out of the chroot filesystem. The
`build_sdk_subtools` script tries to be consistent with that, so ensure
it doesn't try to unpack SDK chroots to the old location.
BUG=b:277992359
TEST=./run_tests
Change-Id: Ibe42edd762d232c5cade2b4fb272ae2fae74a0c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4835401
Commit-Queue: Trent Apted <tapted@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Trent Apted <tapted@chromium.org>
diff --git a/scripts/build_sdk_subtools_unittest.py b/scripts/build_sdk_subtools_unittest.py
index 07c9ff9..b8f11d7 100644
--- a/scripts/build_sdk_subtools_unittest.py
+++ b/scripts/build_sdk_subtools_unittest.py
@@ -15,6 +15,10 @@
from chromite.service import sdk_subtools
+# The argument passed to cros_sdk to ensure the correct SDK is being used.
+SDK_CHROOT_ARG = Path("/mnt/host/source/out/build/amd64-subtools-host")
+
+
@pytest.fixture(name="outside_chroot")
def outside_chroot_fixture():
"""Mocks IsInsideChroot to be False."""
@@ -75,7 +79,7 @@
assert run_mock.call_args_list[0].args[0] == [
"cros_sdk",
"--chroot",
- "/mnt/host/source/chroot/build/amd64-subtools-host",
+ SDK_CHROOT_ARG,
"--create",
"--skip-chroot-upgrade",
]
@@ -100,7 +104,7 @@
assert build_sdk_subtools.main(["--output-dir", "/foo"]) == 42
assert outside_chroot.called
cros_sdk_cmd = run_mock.call_args_list[0].args[0]
- chroot_arg_index = cros_sdk_cmd.index("/mnt/host/source/chroot/foo")
+ chroot_arg_index = cros_sdk_cmd.index(Path("/mnt/host/source/out/foo"))
assert cros_sdk_cmd[0] == "cros_sdk"
assert cros_sdk_cmd[chroot_arg_index - 1] == "--chroot"
@@ -115,7 +119,7 @@
assert error_info.value.cmd == ["build_sdk_subtools", "--no-setup-chroot"]
assert error_info.value.chroot_args == [
"--chroot",
- "/mnt/host/source/chroot/build/amd64-subtools-host",
+ SDK_CHROOT_ARG,
]
@@ -128,7 +132,7 @@
assert outside_chroot.called
assert error_info.value.chroot_args == [
"--chroot",
- "/mnt/host/source/chroot/foo",
+ Path("/mnt/host/source/out/foo"),
]
@@ -156,7 +160,7 @@
assert sudo_run_cmd.kwargs["enter_chroot"] is True
assert sudo_run_cmd.kwargs["chroot_args"] == [
"--chroot",
- "/mnt/host/source/chroot/build/amd64-subtools-host",
+ SDK_CHROOT_ARG,
]
# Stop here: Actually running `--relaunch-for-setup` principally wants to
# mutate the SDK state as root, which is too messy as a unit test.