summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-10 17:25:23 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-12 09:58:33 +0200
commitadab1b36ec6ef0a333e950c4deb32434dbfaf322 (patch)
treeec77a976af27cd3e5785e683d62bdeb31d749924 /rules
parentb266d6350bfbc8a6e7adbe179c1f249dc37614eb (diff)
downloadjustbuild-adab1b36ec6ef0a333e950c4deb32434dbfaf322.tar.gz
Tests: also record `pwd`
... as test meta data. Tests are executed in an unspecified directory, assuming pass or fail is independent of the location where the test is run. While this generally is true, test logs often contain the working directory. So, in order to more easily compare different execution orders of a potential race condition, it can be desirable to compare logs "up to the execution directory". This, however, requires that this directory is recored in the first place. Do so. For consistency of the output format, also have a (fixed) artifact pwd in the summary report.
Diffstat (limited to 'rules')
-rw-r--r--rules/CC/test/EXPRESSIONS14
-rw-r--r--rules/CC/test/RULES1
-rwxr-xr-xrules/CC/test/runner2
-rw-r--r--rules/shell/test/EXPRESSIONS2
-rw-r--r--rules/shell/test/RULES7
-rwxr-xr-xrules/shell/test/runner1
6 files changed, 23 insertions, 4 deletions
diff --git a/rules/CC/test/EXPRESSIONS b/rules/CC/test/EXPRESSIONS
index b0a7f2b4..1646dd7b 100644
--- a/rules/CC/test/EXPRESSIONS
+++ b/rules/CC/test/EXPRESSIONS
@@ -165,7 +165,13 @@
[ [ "test-results"
, { "type": "ACTION"
, "outs":
- ["result", "stdout", "stderr", "time-start", "time-stop"]
+ [ "result"
+ , "stdout"
+ , "stderr"
+ , "time-start"
+ , "time-stop"
+ , "pwd"
+ ]
, "inputs": {"type": "var", "name": "test input"}
, "cmd": ["./runner"]
, "env":
@@ -291,7 +297,11 @@
, [ "artifacts"
, { "type": "map_union"
, "$1":
- [ {"type": "var", "name": "summary"}
+ [ { "type": "singleton_map"
+ , "key": "pwd"
+ , "value": {"type": "BLOB", "data": "/summary"}
+ }
+ , {"type": "var", "name": "summary"}
, { "type": "singleton_map"
, "key": "work"
, "value":
diff --git a/rules/CC/test/RULES b/rules/CC/test/RULES
index 74445516..e23359e1 100644
--- a/rules/CC/test/RULES
+++ b/rules/CC/test/RULES
@@ -143,6 +143,7 @@
, " the respective file descriptor"
, "time-start/time-stop: The time (decimally coded) in seconds since the"
, " epoch when the test invocation started and ended."
+ , "pwd: the directory in which the test was carried out"
]
, "runfiles_doc":
[ "A tree consisting of the artifacts staged at the name of the test."
diff --git a/rules/CC/test/runner b/rules/CC/test/runner
index 45a1bee7..4984b176 100755
--- a/rules/CC/test/runner
+++ b/rules/CC/test/runner
@@ -36,6 +36,8 @@ def dump_results() -> None:
f.write("%s\n" % (stdout, ))
with open("stderr", "w") as f:
f.write("%s\n" % (stderr, ))
+ with open("pwd", "w") as f:
+ f.write("%s\n" % (os.getcwd(), ))
dump_results()
diff --git a/rules/shell/test/EXPRESSIONS b/rules/shell/test/EXPRESSIONS
index e158a4c8..e445c2ad 100644
--- a/rules/shell/test/EXPRESSIONS
+++ b/rules/shell/test/EXPRESSIONS
@@ -172,7 +172,7 @@
, [ "outs"
, { "type": "++"
, "$1":
- [ ["result", "stdout", "stderr", "time-start", "time-stop"]
+ [ ["result", "stdout", "stderr", "time-start", "time-stop", "pwd"]
, { "type": "foreach"
, "var": "filename"
, "range": {"type": "var", "name": "keep"}
diff --git a/rules/shell/test/RULES b/rules/shell/test/RULES
index af188280..ef677087 100644
--- a/rules/shell/test/RULES
+++ b/rules/shell/test/RULES
@@ -93,6 +93,7 @@
, "work: In this directory, all the files specified to \"keep\" are staged"
, "time-start/time-stop: The time (decimally coded) in seconds since the"
, " epoch when the test invocation started and ended."
+ , "pwd: the directory in which the test was carried out"
]
, "runfiles_doc":
[ "A tree consisting of the artifacts staged at the name of the test."
@@ -227,7 +228,11 @@
, [ "artifacts"
, { "type": "map_union"
, "$1":
- [ {"type": "var", "name": "summary"}
+ [ { "type": "singleton_map"
+ , "key": "pwd"
+ , "value": {"type": "BLOB", "data": "/summary"}
+ }
+ , {"type": "var", "name": "summary"}
, { "type": "singleton_map"
, "key": "work"
, "value":
diff --git a/rules/shell/test/runner b/rules/shell/test/runner
index f762355b..624610b5 100755
--- a/rules/shell/test/runner
+++ b/rules/shell/test/runner
@@ -21,6 +21,7 @@ RESULT=UNKNOWN
echo "${RESULT}" > result
echo UNKNOWN > time-start
echo UNKNOWN > time-stop
+pwd > pwd
mkdir scratch
export TEST_TMPDIR=$(realpath scratch)