summaryrefslogtreecommitdiff
path: root/shell/test
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
commitbefb472b1b9650d485f46ae54227caea8bf81cdd (patch)
treea73d61651460419da871053e7b70d3f9206ea85b /shell/test
parent4f60c5b43a7b33052e62caa78a7b705b3057028b (diff)
downloadrules-cc-befb472b1b9650d485f46ae54227caea8bf81cdd.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 'shell/test')
-rw-r--r--shell/test/EXPRESSIONS2
-rw-r--r--shell/test/RULES7
-rwxr-xr-xshell/test/runner1
3 files changed, 8 insertions, 2 deletions
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS
index e158a4c..e445c2a 100644
--- a/shell/test/EXPRESSIONS
+++ b/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/shell/test/RULES b/shell/test/RULES
index af18828..ef67708 100644
--- a/shell/test/RULES
+++ b/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/shell/test/runner b/shell/test/runner
index f762355..624610b 100755
--- a/shell/test/runner
+++ b/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)