Skip to contentSkip to conversation

common/rc: explicitly test for engine availability in _require_fio

PATCH Superseded Eric Sandeen 2 participants 3 messages Mar 12, 2025 – Mar 14, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/rc: explicitly test for engine availability in _require_fio

The current test in _require_fio (--warnings-fatal --showcmd) does not fail if an invalid/unavailable io engine is specified.

Add an explicit test that every requested io engine in the job file is actually available.

Remove the "ioe_e4defrag" entries in ext4 tests - an engine with this name has seemingly never existed, but in each case later stanzas overrode the io engine, so it did not cause problems without this explicit parsing and checking.

---

common/rc +6 -0
index ca755055..c155bb46 100644
@@ -3983,6 +3983,12 @@ _require_fio()
 		return 1;
 	fi
 
+	# Explicitly check for every ioengine availability
+	for ENGINE in `grep ioengine= $job | awk -F= '{print $2}'; sort`; do
+		fio --enghelp | grep -qw $ENGINE || \
+			_notrun "fio engine $ENGINE not available"
+	done
+
 	$FIO_PROG --warnings-fatal --showcmd $job >> $seqres.full 2>&1
 	[ $? -eq 0 ] || _notrun "$FIO_PROG too old, see $seqres.full"
 }
tests/ext4/301 +0 -1
index abf47d4b..a05b8e8a 100755
@@ -31,7 +31,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
tests/ext4/302 +0 -1
index 87820184..e0f5f2f9 100755
@@ -31,7 +31,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
tests/ext4/303 +0 -1
index 2381f047..0a83e86c 100755
@@ -31,7 +31,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
tests/ext4/304 +0 -1
index 53b522ee..5f2ae4bd 100755
@@ -32,7 +32,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
#1 lore raw
Quoted 19 lines · Eric Sandeen

The current test in _require_fio (--warnings-fatal --showcmd) does not fail if an invalid/unavailable io engine is specified.

Add an explicit test that every requested io engine in the job file is actually available.

Remove the "ioe_e4defrag" entries in ext4 tests - an engine with this name has seemingly never existed, but in each case later stanzas overrode the io engine, so it did not cause problems without this explicit parsing and checking.

---

common/rc +0 -0
index ca755055..c155bb46 100644

common/rc _require_fio() · line 3987

Quoted 5 lines
common/rc +2 -0
@@ -3983,6 +3983,12 @@ _require_fio()
 		return 1;
 	fi
 
+	# Explicitly check for every ioengine availability
+	for ENGINE in `grep ioengine= $job | awk -F= '{print $2}'; sort`; do
            ^^^^^^

I think a local variable is enough, e.g. "local eng".

And, how about:
for eng in sed -n "s/ioengine=\(.*\)/\1/p" $job

common/rc _require_fio() · line 3988

Quoted 1 line
common/rc +1 -0
+		fio --enghelp | grep -qw $ENGINE || \
                ^^^
              $FIO_PROG

And to make sure the "||" checks the return value of grep, how about:

  grep -wq $eng <($FIO_PROG --enghelp 2>/dev/null) ||

Others look good to me.

Thanks,
Zorro

Quoted 56 lines
common/rc +3 -0
+			_notrun "fio engine $ENGINE not available"
+	done
+
 	$FIO_PROG --warnings-fatal --showcmd $job >> $seqres.full 2>&1
 	[ $? -eq 0 ] || _notrun "$FIO_PROG too old, see $seqres.full"
 }
tests/ext4/301 +0 -1
index abf47d4b..a05b8e8a 100755
@@ -31,7 +31,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
tests/ext4/302 +0 -1
index 87820184..e0f5f2f9 100755
@@ -31,7 +31,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
tests/ext4/303 +0 -1
index 2381f047..0a83e86c 100755
@@ -31,7 +31,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
tests/ext4/304 +0 -1
index 53b522ee..5f2ae4bd 100755
@@ -32,7 +32,6 @@ FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
 cat >$fio_config <<EOF
 # Common e4defrag regression tests
 [global]
-ioengine=ioe_e4defrag
 iodepth=1
 directory=${SCRATCH_MNT}
 filesize=${FILE_SIZE}
#2 lore raw
Quoted 32 lines · Zorro Lang
Quoted 19 lines · Eric Sandeen

The current test in _require_fio (--warnings-fatal --showcmd) does not fail if an invalid/unavailable io engine is specified.

Add an explicit test that every requested io engine in the job file is actually available.

Remove the "ioe_e4defrag" entries in ext4 tests - an engine with this name has seemingly never existed, but in each case later stanzas overrode the io engine, so it did not cause problems without this explicit parsing and checking.

---

common/rc +0 -0
index ca755055..c155bb46 100644

common/rc _require_fio() · line 3987

Quoted 5 lines
common/rc +2 -0
@@ -3983,6 +3983,12 @@ _require_fio()
 		return 1;
 	fi
 
+	# Explicitly check for every ioengine availability
+	for ENGINE in `grep ioengine= $job | awk -F= '{print $2}'; sort`; do
            ^^^^^^

I think a local variable is enough, e.g. "local eng".

And, how about:
for eng in sed -n "s/ioengine=\(.*\)/\1/p" $job

Quoted 7 lines

common/rc _require_fio() · line 3988

Quoted 1 line
common/rc +1 -0
+		fio --enghelp | grep -qw $ENGINE || \
                ^^^
              $FIO_PROG

And to make sure the "||" checks the return value of grep, how about:

  grep -wq $eng <($FIO_PROG --enghelp 2>/dev/null) ||

Clearly my bash-fu is lacking!

Quoted 2 lines

Others look good to me.

Ok, I'll try this. Also noticing that I typo'd "sort" which was supposed to be via a pipe, as well as a missing "uniq" :( sorry about that.

-Eric