functional2: fix in the development shell

The functional2 test suite was broken in the development shell for two mostly
separate reasons leading to "no such file or directory" errors:

* The `BUILD_TEST_SHELL` (already containing the correct path) would always be
  set from the Meson option `build_test_shell`, even to the empty string if
  that option is not set. Skip the overwrite in this case to make the
  environment variable work again.
* Sandboxed builds would fail to find their builder `/bin/sh`, since in the
  development shell busybox is not found, so no sandbox shell gets configured.
  Use the shell from `BUILD_TEST_SHELL` instead. (How this does not break the
  old functional tests remains a mystery.)

Change-Id: I6a6a696424e8caaef3f9b68e3738bfd58ea0b056
This commit is contained in:
Alois Wohlschlager
2025-10-07 20:14:48 +00:00
committed by alois31
parent 41fab8a31c
commit 42691f0d94
3 changed files with 5 additions and 2 deletions
+2
View File
@@ -15,7 +15,9 @@ functional2_env = environment()
# set the bin dir for us to know where to find the lix binaries for our declarative path
# without leaking all of PATH or env
functional2_env.set('NIX_BIN_DIR', bindir)
if build_test_shell != ''
functional2_env.set('BUILD_TEST_SHELL', build_test_shell)
endif
functional2_env.set('system', host_system)
test(
@@ -17,7 +17,7 @@ rec {
mkDerivation = args:
derivation ({
inherit system;
builder = "/bin/sh";
builder = "@shell@";
args = ["-e" args.builder or (builtins.toFile "builder-${args.name}.sh" ''
if [ -e "$NIX_ATTRS_SH_FILE" ]; then source $NIX_ATTRS_SH_FILE; fi;
eval "$buildCommand"
+1
View File
@@ -144,6 +144,7 @@ def get_global_asset(name: str) -> Fileish:
"system": os.environ.get("system"), # noqa: SIM112 # system is actually lowercase here
# Either just the build shell or entire global path if we are darwin
"path": os.environ.get("BUILD_TEST_SHELL") or os.environ.get("PATH"),
"shell": Path(os.environ.get("BUILD_TEST_SHELL") or "/bin") / "sh",
},
)
return CopyFile(functional2_base_folder / "testlib" / "global_assets" / name)