summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-04-17 15:06:37 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-04-17 15:33:40 +0200
commit3e19cd959774ccb09df97e8dd96d5bacfff57ca3 (patch)
tree212828fa1d0b80811ccdc7ac22ff39dc168e6e6c
parent2984aea3702b75f82f7a09cefecbf133c89960fa (diff)
downloadjustbuild-3e19cd959774ccb09df97e8dd96d5bacfff57ca3.tar.gz
["CC/test", "test"] runner: set TMPDIR
... to the same value as TEST_TMPDIR. While TEST_TMPDIR is the conventional name that tests should use for their temporary file, setting TMPDIR as well has the advantage that more library functions can be used to create temporary files and directories, as quite a few of them inspect the variable TMPDIR. While there, also fix some typos in the documentation strings.
-rw-r--r--rules/CC/test/RULES7
-rwxr-xr-xrules/CC/test/runner2
2 files changed, 5 insertions, 4 deletions
diff --git a/rules/CC/test/RULES b/rules/CC/test/RULES
index ac1bff9d..aa698275 100644
--- a/rules/CC/test/RULES
+++ b/rules/CC/test/RULES
@@ -42,9 +42,10 @@
, "srcs":
[ "The sources of the test binary"
, ""
- , "The resulting test binary in an environment where it can assume"
+ , "The resulting test binary is run in an environment where it can assume"
, "that the environment variable TEST_TMPDIR points to a"
- , "director that may be used exclusively by this test."
+ , "directory that may be used exclusively by this test."
+ , "For convenience, the environment variable TMPDIR is also set to TEST_TMPDIR."
, ""
, "This running of the test is carried out by the implicit dependency"
, "on the target \"runner\". By setting this target in the target layer"
@@ -72,7 +73,7 @@
, "data": ["Any files the test binary needs access to when running"]
, "defaults": ["The C/C++ toolchain to use"]
, "runner":
- [ "The test runner which starts the actual test binrary after providing"
+ [ "The test runner which starts the actual test binary after providing"
, "the respective environment. The runner also takes care of capturing"
, "stdout/stderr and timing information."
]
diff --git a/rules/CC/test/runner b/rules/CC/test/runner
index fc1f04cb..45a1bee7 100755
--- a/rules/CC/test/runner
+++ b/rules/CC/test/runner
@@ -46,7 +46,7 @@ os.makedirs(TEMP_DIR, exist_ok=True)
WORK_DIR = os.path.realpath("work")
os.makedirs(WORK_DIR, exist_ok=True)
-ENV = dict(os.environ, TEST_TMPDIR=TEMP_DIR)
+ENV = dict(os.environ, TEST_TMPDIR=TEMP_DIR, TMPDIR=TEMP_DIR)
with open('test-launcher.json') as f:
test_launcher = json.load(f)