summaryrefslogtreecommitdiff
path: root/indra/test
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-07-07 10:06:02 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-07-07 10:06:02 -0400
commitf54c1215676f26480d88b4588bb0eeb9c05f50d9 (patch)
treee6c269f6d664a96397251d85025c1d07d83959d2 /indra/test
parent2b1a3cf9cdb4cde92d14217b743545eccdcb2991 (diff)
SL-18837: Try putting generated Python scripts in RUNNER_TEMP dir.
The claim is that the Windows Python interpreter is integrated somehow with the OS such that a command line that tries to run Python with a script that "looks suspicious" (i.e. in a system temp directory) fails with "Access denied" without even loading the interpreter. At least that theory would explain the "Access denied" errors we've been getting trying to run Python scripts generated into the system temp directory by our integration tests. Our hope is that generating such scripts into the GitHub RUNNER_TEMP directory will work better. As this test is specific to Windows, don't even bother running Mac builds.
Diffstat (limited to 'indra/test')
-rw-r--r--indra/test/namedtempfile.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/indra/test/namedtempfile.h b/indra/test/namedtempfile.h
index c215c50f3f..4343361f41 100644
--- a/indra/test/namedtempfile.h
+++ b/indra/test/namedtempfile.h
@@ -84,12 +84,19 @@ protected:
const std::string_view& sfx)
{
// Create file in a temporary place.
+ // This variable is set by GitHub actions and is the recommended place
+ // to put temp files belonging to an actions job.
+ const char* RUNNER_TEMP = getenv("RUNNER_TEMP");
+ boost::filesystem::path tempdir{
+ // if RUNNER_TEMP is set and not empty
+ (RUNNER_TEMP && *RUNNER_TEMP)?
+ boost::filesystem::path(RUNNER_TEMP) : // use RUNNER_TEMP if available
+ boost::filesystem::temp_directory_path()}; // else canonical temp dir
boost::filesystem::path tempname{
- boost::filesystem::temp_directory_path() /
- // unique_path() recommended template, but with underscores
- // instead of hyphens: some use cases involve temporary Python
- // scripts
- stringize(pfx, "%%%%_%%%%_%%%%_%%%%", sfx) };
+ // use filename template recommended by unique_path() doc, but
+ // with underscores instead of hyphens: some use cases involve
+ // temporary Python scripts
+ tempdir / stringize(pfx, "%%%%_%%%%_%%%%_%%%%", sfx) };
mPath = boost::filesystem::unique_path(tempname);
boost::filesystem::ofstream out{ mPath };