diff mbox series

[blktests] check: define TMPDIR before running the test

Message ID 20231011034832.1650797-1-yi.zhang@redhat.com (mailing list archive)
State New, archived
Headers show
Series [blktests] check: define TMPDIR before running the test | expand

Commit Message

Yi Zhang Oct. 11, 2023, 3:48 a.m. UTC
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")
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
---
 check | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Daniel Wagner Oct. 11, 2023, 6:54 a.m. UTC | #1
Hi,

On Wed, Oct 11, 2023 at 11:48:32AM +0800, Yi Zhang wrote:
> @@ -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
Yi Zhang Oct. 11, 2023, 7:27 a.m. UTC | #2
On Wed, Oct 11, 2023 at 2:53 PM Daniel Wagner <dwagner@suse.de> wrote:
>
> Hi,
>
> On Wed, Oct 11, 2023 at 11:48:32AM +0800, Yi Zhang wrote:
> > @@ -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.

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

>
> Currently it is:
>
> _check
>   _run_group
>     tests/${group}/rc
>     _run_test
>       _call_test
>         TMPDIR=...
>         $test_func
>
> Thanks,
> Daniel
>
diff mbox series

Patch

diff --git a/check b/check
index 55871b0..d25b56b 100755
--- a/check
+++ b/check
@@ -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}"