Browse Source

igr_functions: make use of IGR_OUTPUT consistent.

The way it was written, if IGR_OUTPUT was set on input it was modified
by appending the test name, if it wasn't set it was set to a directory
in the current working directory. This double use was strange and
confusing.

Now use IGR_OUTPUT_BASE as the base directory for output, if it is set
(IGR_OUTPUT is set to $IGR_OUTPUT_BASE/$TEST_NAME). Otherwise IGR_OUTPUT
is set to $PWD/output. It is still somewhat different depending on
whether IGR_OUTPUT_BASE is set or not, but at least use of IGR_OUTPUT
itself is consistent.
Davin McCall 8 months ago
parent
commit
1b4e49f56f
2 changed files with 11 additions and 9 deletions
  1. 10 8
      src/igr-tests/igr_functions.sh
  2. 1 1
      src/igr-tests/meson.build

+ 10 - 8
src/igr-tests/igr_functions.sh

@@ -81,17 +81,19 @@ find_dinitctl() { find_executable dinitctl DINITCTL; }
 find_dinitcheck() { find_executable dinitcheck DINITCHECK; }
 find_dinitmonitor() { find_executable dinit-monitor DINITMONITOR; }
 
-## Prepare IGR_OUTPUT
+# Prepare IGR_OUTPUT.
+# Three basic modes:
+# - IGR_OUTPUT is already set
+# - IGR_OUTPUT_BASE is set, append test name and use result as IGR_OUTPUT
+# - neither, use "output" within current directory as IGR_OUTPUT
 TEST_NAME="${PWD##*/}"
 [ -n "$TEST_NAME" ] || error "Failed to guess test name."
 if [ -z "${IGR_OUTPUT:-}" ]; then
-    IGR_OUTPUT="$PWD"/output
-    export IGR_OUTPUT
-else
-    # Igr test is probably used by Meson.
-    mkdir -p "$IGR_OUTPUT/$TEST_NAME/"
-    IGR_OUTPUT="$IGR_OUTPUT/$TEST_NAME/"
-    export IGR_OUTPUT
+    if [ -n "${IGR_OUTPUT_BASE:-}" ]; then
+        export IGR_OUTPUT="${IGR_OUTPUT_BASE}/${TEST_NAME}"
+    else
+        export IGR_OUTPUT="$PWD"/output
+    fi
 fi
 export SOCKET="$IGR_OUTPUT/socket"
 mkdir -p "$IGR_OUTPUT"

+ 1 - 1
src/igr-tests/meson.build

@@ -1,7 +1,7 @@
 # Included from top-level meson.build
 
 igr_tests_env += [
-     'IGR_OUTPUT=@0@'.format(meson.current_build_dir()),
+     'IGR_OUTPUT_BASE=@0@'.format(meson.current_build_dir()),
      'DEBUG=yes'
 ]