git: b032be711c74 - main - Make the CTL tests more resilient
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Nov 2024 02:07:10 UTC
The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=b032be711c740d2f25b27c92069537edcfac221c commit b032be711c740d2f25b27c92069537edcfac221c Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2024-11-05 00:26:01 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2024-11-05 02:06:53 +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. MFC after: 2 weeks MFC with: fe1755fa Sponsored by: ConnectWise Reviewed by: emaste, markj, #cam Differential Revision: https://reviews.freebsd.org/D47446 --- 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