git: 83b08f402641 - main - fix parallel execution of swapon tests

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Tue, 01 Jul 2025 10:07:03 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/src/commit/?id=83b08f40264177ecf03fce808474815816f9846f

commit 83b08f40264177ecf03fce808474815816f9846f
Author:     Siva Mahadevan <me@svmhdvn.name>
AuthorDate: 2025-07-01 09:57:29 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2025-07-01 10:06:27 +0000

    fix parallel execution of swapon tests
    
    And apparantly the CI env already has an md device so be relaxed about which md device is added.
    
    PR:     186252
    Reported by:    markj
    Fixes:  1ee33e3a578c35ff0e8ef5db87a8005f1f99546a "swapon: parse md.eli device for encrypted swapfile from fstab"
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1747
---
 sbin/swapon/tests/swapon_test.sh | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/sbin/swapon/tests/swapon_test.sh b/sbin/swapon/tests/swapon_test.sh
index 3c4286cd6815..b6d31ecaeed0 100755
--- a/sbin/swapon/tests/swapon_test.sh
+++ b/sbin/swapon/tests/swapon_test.sh
@@ -32,8 +32,8 @@ attach_mdX_body()
 {
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
-	atf_check -s exit:0 -o save:fstab.out -x "echo 'md3    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md3 as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o save:fstab.out -x "echo 'md31    none    swap    sw,file=swapfile  0       0'"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md31 as swap device" -x "swapon -F fstab.out -a"
 }
 attach_mdX_cleanup()
 {
@@ -50,8 +50,8 @@ attach_dev_mdX_body()
 {
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
-	atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md3    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md3 as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md32    none    swap    sw,file=swapfile  0       0'"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md32 as swap device" -x "swapon -F fstab.out -a"
 }
 attach_dev_mdX_cleanup()
 {
@@ -62,14 +62,14 @@ attach_dev_mdX_cleanup()
 atf_test_case attach_md cleanup
 attach_md_head()
 {
-	atf_set "descr" "mdX device should attach"
+	atf_set "descr" "md device should attach"
 }
 attach_md_body()
 {
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
 	atf_check -s exit:0 -o save:fstab.out -x "echo 'md    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md0 as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]* as swap device" -x "swapon -F fstab.out -a"
 }
 attach_md_cleanup()
 {
@@ -87,7 +87,7 @@ attach_dev_md_body()
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
 	atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md0 as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]* as swap device" -x "swapon -F fstab.out -a"
 }
 attach_dev_md_cleanup()
 {
@@ -104,8 +104,8 @@ attach_mdX_eli_body()
 {
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
-	atf_check -s exit:0 -o save:fstab.out -x "echo 'md3.eli    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md3.eli as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o save:fstab.out -x "echo 'md33.eli    none    swap    sw,file=swapfile  0       0'"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md33.eli as swap device" -x "swapon -F fstab.out -a"
 }
 attach_mdX_eli_cleanup()
 {
@@ -122,8 +122,8 @@ attach_dev_mdX_eli_body()
 {
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
-	atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md3.eli    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md3.eli as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md34.eli    none    swap    sw,file=swapfile  0       0'"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md34.eli as swap device" -x "swapon -F fstab.out -a"
 }
 attach_dev_mdX_eli_cleanup()
 {
@@ -141,7 +141,7 @@ attach_md_eli_body()
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
 	atf_check -s exit:0 -o save:fstab.out -x "echo 'md.eli    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md0.eli as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]*.eli as swap device" -x "swapon -F fstab.out -a"
 }
 attach_md_eli_cleanup()
 {
@@ -159,7 +159,7 @@ attach_dev_md_eli_body()
 	# if the swapfile is too small (like 1k) then mdconfig hangs looking up the md
 	atf_check -s exit:0 -x "truncate -s 10k swapfile"
 	atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md.eli    none    swap    sw,file=swapfile  0       0'"
-	atf_check -s exit:0 -o match:"swapon: adding /dev/md0.eli as swap device" -x "swapon -F fstab.out -a"
+	atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]*.eli as swap device" -x "swapon -F fstab.out -a"
 }
 attach_dev_md_eli_cleanup()
 {