This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Extend test for bash for executor-has-no-bash
ClosedPublic

Authored by mstorsjo on Dec 21 2021, 9:33 AM.

Details

Summary

If %{exec} sets "--env PATH=single-dir", the directory containing
bash and related shell utils is omitted from the path, which means
that most shell scripts would fail.

(Setting PATH is needed for DLL builds on Windows; PATH fills the same
role as e.g. LD_LIBRARY_PATH on Linux.)

This condition is missed in the current test, because the executor
run.py first resolves the executable to run using the original path,
then invokes that executable with an environment with a restricted
path. Thus the executor is able to run bash, but that bash is then
unable to run further shell commands (other than bash builtins).

Extend the test from "bash --version" to "bash -c 'bash --version'".
This correctly identifies the executor-has-no-bash condition in the
current Windows CI configs, allowing removing 6 cases of
LIBCXX-WINDOWS-FIXME.

Another longterm fix would be to extend run.py with an option like
"--env-prepend PATH=dir", to allow keeping the current path while
adding a directory to it.

Diff Detail

Event Timeline

mstorsjo created this revision.Dec 21 2021, 9:33 AM
mstorsjo requested review of this revision.Dec 21 2021, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 21 2021, 9:33 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Dec 21 2021, 10:28 AM
This revision is now accepted and ready to land.Dec 21 2021, 10:28 AM