Re: [PATCH blktests V2] check: define TMPDIR earlier in _run_group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 11, 2023 at 03:25:30PM +0800, Yi Zhang wrote:
 @@ -559,6 +556,10 @@ _run_group() {
>  	local tests=("$@")
>  	local group="${tests["0"]%/*}"
>  
> +	if ! TMPDIR="$(mktemp --tmpdir -p "$OUTPUT" -d "tmpdir.${TEST_NAME//\//.}.XXX")"; then
> +		return
> +	fi
> +
>  	# shellcheck disable=SC1090
>  	. "tests/${group}/rc"

Sorry, I didn't catch this earlier. TMPDIR is newly created for every
single test run and gets removed afterwards, see the _cleanup function.

I think we should keep this behavior. So the question is if we could
make the $def_file_path evaluation just lazy. So something like:

modified   tests/nvme/rc
@@ -18,12 +18,15 @@ def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349"
 def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}"
 export def_subsysnqn="blktests-subsystem-1"
 export def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e"
-export def_file_path="${TMPDIR}/img"
 nvme_trtype=${nvme_trtype:-"loop"}
 nvme_img_size=${nvme_img_size:-"1G"}
 nvme_num_iter=${nvme_num_iter:-"1000"}

 _nvme_requires() {
+	# lazy evaluation because TMPDIR is per test run and not
+	# per test group
+	def_file_path="${TMPDIR}/img"
+
 	_have_program nvme
 	_require_nvme_test_img_size 4m
 	case ${nvme_trtype} in



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux