Skip to contentSkip to conversation

check: define TMPDIR before running the test

PATCH In review Yi Zhang 2 participants 3 messages Oct 11, 2023 Block layer

lore
Share & tools
lore

Yi Zhang

author
#0 lore raw

PATCH 1/1 check: define TMPDIR before running the test

The TMPDIR was defined in _call_test before running test_func, but it was used in nvme/rc which has not yet defined, so move the definiation before runng the test to fix it.

Fixes b6356f6 ("nvme/rc: Add common file_path name define")
---
 check | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
check +4 -3
index 55871b0..d25b56b 100755
@@ -364,9 +364,6 @@ _call_test() {
 
 		unset TEST_CLEANUP
 		trap _cleanup EXIT
-		if ! TMPDIR="$(mktemp --tmpdir -p "$OUTPUT" -d "tmpdir.${TEST_NAME//\//.}.XXX")"; then
-			return
-		fi
 
 		TIMEFORMAT="%Rs"
 		pushd . >/dev/null || return
@@ -478,6 +475,10 @@ _run_test() {
 	# runs to suppress job status output.
 	set +m
 
+	if ! TMPDIR="$(mktemp --tmpdir -p "$OUTPUT" -d "tmpdir.${TEST_NAME//\//.}.XXX")"; then
+		return
+	fi
+
 	# shellcheck disable=SC1090
 	. "tests/${TEST_NAME}"
 
Signature · 1 line
2.34.3
#1 lore raw

Hi,

check _run_test() { · line 483

Quoted 10 lines · Yi Zhang
check +4 -0
@@ -478,6 +475,10 @@ _run_test() {
 	# runs to suppress job status output.
 	set +m
 
+	if ! TMPDIR="$(mktemp --tmpdir -p "$OUTPUT" -d "tmpdir.${TEST_NAME//\//.}.XXX")"; then
+		return
+	fi
+
 	# shellcheck disable=SC1090
 	. "tests/${TEST_NAME}"

Are you sure about the placement here? I went through the call chain and I figured that the TMPDIR should be set in _run_group before we call the 'rc' files.

Currently it is:

_check
_run_group

    tests/${group}/rc
    _run_test
      _call_test
        TMPDIR=...
        $test_func

Thanks,
Daniel

author
#2 lore raw
Quoted 8 lines · Daniel Wagner

Hi,

Quoted 4 lines · Yi Zhang
check +0 -0
@@ -478,6 +475,10 @@ _run_test() {
      # runs to suppress job status output.
      set +m
 
Quoted 10 lines

check _run_test() { · line 483

Quoted 6 lines
check +4 -0
+     if ! TMPDIR="$(mktemp --tmpdir -p "$OUTPUT" -d "tmpdir.${TEST_NAME//\//.}.XXX")"; then
+             return
+     fi
+
      # shellcheck disable=SC1090
      . "tests/${TEST_NAME}"

Are you sure about the placement here? I went through the call chain and I figured that the TMPDIR should be set in _run_group before we call the 'rc' files.

Yeah, you are right, just send v2 for the change.

Quoted 14 lines

Currently it is:

_check
_run_group

    tests/${group}/rc
    _run_test
      _call_test
        TMPDIR=...
        $test_func

Thanks,
Daniel

Signature · 2 lines
Best Regards,
  Yi Zhang