]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
report: allow test runners to inject arbitrary values v2023.03.26
authorDarrick J. Wong <djwong@kernel.org>
Wed, 15 Mar 2023 00:53:55 +0000 (17:53 -0700)
committerZorro Lang <zlang@kernel.org>
Sun, 26 Mar 2023 14:09:42 +0000 (22:09 +0800)
Per Ted's request, add to the test section reporting code the ability
for test runners to point to a file containing colon-separated key value
pairs.  These key value pairs will be recorded in the report file as
extra properties.

Requested-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
README
common/report

diff --git a/README b/README
index 1ca506492bf0ea29081414dd28ddd40bef110fe5..4ee877a962ccceaf341c814e36743bf38fb9b45b 100644 (file)
--- a/README
+++ b/README
@@ -268,6 +268,9 @@ Misc:
    this option is supported for all filesystems currently only -overlay is
    expected to run without issues. For other filesystems additional patches
    and fixes to the test suite might be needed.
+ - Set REPORT_VARS_FILE to a file containing colon-separated name-value pairs
+   that will be recorded in the test section report.  Names must be unique.
+   Whitespace surrounding the colon will be removed.
 
 ______________________
 USING THE FSQA SUITE
index db15aec54fc47d57185d4a51285f07a16811db82..23ddbb096d22cd472ceeec9953aee983c9a7c0cb 100644 (file)
@@ -49,9 +49,19 @@ __generate_blockdev_report_vars() {
        REPORT_VARS["${bdev_var}_ZONES"]="$(cat "$sysfs_bdev/queue/nr_zones" 2>/dev/null)"
 }
 
+__import_report_vars() {
+       local fname="$1"
+
+       while IFS=':' read key value; do
+               REPORT_VARS["${key%% }"]="${value## }"
+       done < "$1"
+}
+
 # Fill out REPORT_VARS with tidbits about our test runner configuration.
 # Caller is required to declare REPORT_VARS to be an associative array.
 __generate_report_vars() {
+       test "$REPORT_VARS_FILE" && __import_report_vars "$REPORT_VARS_FILE"
+
        REPORT_VARS["ARCH"]="$(uname -m)"
        REPORT_VARS["KERNEL"]="$(uname -r)"
        REPORT_VARS["CPUS"]="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"