SL-18837: Force llprocess_test and llleap_test to use just 'python'.

On GitHub Windows runners, trying to make build.yaml set PYTHON=python in the
environment doesn't work: integration tests still fail with "Access is denied"
because they're still trying to execute the interpreter's full pathname.

Instead, make llprocess_test and llleap_test detect the case of GitHub Windows
and override the environment variable PYTHON with a baked-in string constant
"python".
master
Nat Goodspeed 2023-07-08 14:08:16 -04:00
parent ca4288edaa
commit 7dc6211ad5
3 changed files with 23 additions and 7 deletions

View File

@ -177,11 +177,7 @@ jobs:
# as neither CMake's FindPython nor our custom Python.cmake module
# will resolve the correct interpreter location.
if [[ "$RUNNER_OS" == "Windows" ]]; then
##export PYTHON="$(native_path "$(which python)")"
## Weirdly, on GitHub's Windows runners, the integration test that
## runs just 'python' succeeds while the integration tests that
## run the full path to the .exe fail with "Access is denied."
export PYTHON=python
export PYTHON="$(native_path "$(which python)")"
echo "Python location: $PYTHON"
export PYTHON_COMMAND="$PYTHON"
else

View File

@ -193,11 +193,20 @@ namespace tut
reader.getName().substr(0, reader.getName().length()-3))),
PYTHON(LLStringUtil::getenv("PYTHON"))
{
#if LL_WINDOWS
// Weirdly, on GitHub Windows runners, plain 'python' works much
// better than a full pathname.
const char* RUNNER_TEMP = getenv("RUNNER_TEMP");
if (RUNNER_TEMP && *RUNNER_TEMP)
{
PYTHON = "python";
}
#endif
ensure("Set PYTHON to interpreter pathname", !PYTHON.empty());
}
NamedExtTempFile reader;
const std::string reader_module;
const std::string PYTHON;
std::string PYTHON;
};
typedef test_group<llleap_data> llleap_group;
typedef llleap_group::object object;

View File

@ -141,6 +141,15 @@ struct PythonProcessLauncher
mScript("py", script)
{
auto PYTHON(LLStringUtil::getenv("PYTHON"));
#if LL_WINDOWS
// Weirdly, on GitHub Windows runners, plain 'python' works much better
// than a full pathname.
const char* RUNNER_TEMP = getenv("RUNNER_TEMP");
if (RUNNER_TEMP && *RUNNER_TEMP)
{
PYTHON = "python";
}
#endif
tut::ensure("Set $PYTHON to the Python interpreter", !PYTHON.empty());
mParams.desc = desc + " script";
@ -1013,7 +1022,9 @@ namespace tut
set_test_name("get*Pipe() validation");
PythonProcessLauncher py(get_test_name(),
"from __future__ import print_function\n"
"print('this output is expected')\n");
"import sys\n"
"print('this output is expected')\n"
"print('run by', sys.executable)\n");
py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stdin
py.mParams.files.add(LLProcess::FileParam()); // inherit stdout
py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stderr