git: 23b270405951 - stable/14 - Make the CTL tests more resilient
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Jan 2025 16:24:07 UTC
The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=23b2704059512b985bb14b220d92102bc4569b3e commit 23b2704059512b985bb14b220d92102bc4569b3e Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2024-11-05 00:26:01 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2025-01-20 16:23:08 +0000 Make the CTL tests more resilient Fix the find_device function to work regardless of whether "camcontrol devlist" lists the da device first and the pass device second or vice versa. On FreeBSD 14 and 15 it apparently always lists da first. But on 13 it can do it in either order. Sponsored by: ConnectWise Reviewed by: emaste, markj, #cam Differential Revision: https://reviews.freebsd.org/D47446 (cherry picked from commit b032be711c740d2f25b27c92069537edcfac221c) --- tests/sys/cam/ctl/ctl.subr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/sys/cam/ctl/ctl.subr b/tests/sys/cam/ctl/ctl.subr index 18991e0fa144..868b1c809571 100644 --- a/tests/sys/cam/ctl/ctl.subr +++ b/tests/sys/cam/ctl/ctl.subr @@ -47,7 +47,14 @@ find_device() { ctladm port -o on -p 0 >/dev/null HEXLUN=`printf %x $LUN` while true; do - dev=`camcontrol devlist | awk -v lun=$HEXLUN '/FREEBSD CTL/ && $9==lun {split($10, fields, /[,]/); print fields[1];}' | sed 's:[()]::'` + dev=`camcontrol devlist | awk -v lun=$HEXLUN ' + /FREEBSD CTL.*,pass/ && $9==lun { + split($10, fields, /[,]/); print fields[1]; + } + /FREEBSD CTL.*\(pass/ && $9==lun { + split($10, fields, /[,]/); print fields[2]; + } + ' | sed 's:[()]::'` if [ -z "$dev" -o ! -c /dev/$dev ]; then retries=$(( $retries - 1 )) if [ $retries -eq 0 ]; then