summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2020-07-23 23:29:50 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2020-07-23 23:29:50 +0000
commit3cee7cb26993aea9b089270f098a42ce0f4ba73b (patch)
treec1f6ea711cfcb10e626b3b705a1ec859bbff1bdd /tests
parent98b765e5c28aa451b82a377bc69283120cd924fa (diff)
downloadsrc-test-3cee7cb26993aea9b089270f098a42ce0f4ba73b.tar.gz
src-test-3cee7cb26993aea9b089270f098a42ce0f4ba73b.zip
Limit gmirror failpoint tests to the test worker
This avoids injecting errors into the test system's mirrors. gnop seems like a good solution here but it injects errors at the wrong place vs where these tests expect and does not support a 'max global count' like the failpoints do with 'n*' syntax. Reviewed by: cem, vangyzen Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=363463
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/geom/class/mirror/10_test.sh2
-rw-r--r--tests/sys/geom/class/mirror/11_test.sh2
-rw-r--r--tests/sys/geom/class/mirror/12_test.sh2
-rw-r--r--tests/sys/geom/class/mirror/13_test.sh2
-rw-r--r--tests/sys/geom/class/mirror/9_test.sh2
-rw-r--r--tests/sys/geom/class/mirror/conf.sh5
-rw-r--r--tests/sys/geom/class/mirror/sync_error.sh4
7 files changed, 12 insertions, 7 deletions
diff --git a/tests/sys/geom/class/mirror/10_test.sh b/tests/sys/geom/class/mirror/10_test.sh
index c8187189d60dd..9247abddd8265 100644
--- a/tests/sys/geom/class/mirror/10_test.sh
+++ b/tests/sys/geom/class/mirror/10_test.sh
@@ -30,7 +30,7 @@ tmp2=$(mktemp $base.XXXXXX)
EIO=5
# gmirror should retry a failed read from the other mirror.
-sysctl ${regreadfp}="1*return(${EIO})"
+sysctl ${regreadfp}="1*return(${EIO})[pid $(gmirror_worker_pid)]"
dd if=/dev/mirror/$name of=$tmp1 iseek=256 bs=$ddbs count=1 >/dev/null 2>&1
dd if=/dev/$us1 of=$tmp2 iseek=256 bs=$ddbs count=1 >/dev/null 2>&1
sysctl ${regreadfp}='off'
diff --git a/tests/sys/geom/class/mirror/11_test.sh b/tests/sys/geom/class/mirror/11_test.sh
index 284aa19c72fa4..8ae65a1f5a04f 100644
--- a/tests/sys/geom/class/mirror/11_test.sh
+++ b/tests/sys/geom/class/mirror/11_test.sh
@@ -31,7 +31,7 @@ tmp2=$(mktemp $base.XXXXXX)
ENXIO=6
# gmirror has special handling for ENXIO. It does not mark the failed component
# as broken, allowing it to rejoin the mirror automatically when it appears.
-sysctl ${regreadfp}="1*return(${ENXIO})"
+sysctl ${regreadfp}="1*return(${ENXIO})[pid $(gmirror_worker_pid)]"
dd if=/dev/mirror/$name of=$tmp1 iseek=512 bs=$ddbs count=1 >/dev/null 2>&1
dd if=/dev/$us1 of=$tmp2 iseek=512 bs=$ddbs count=1 >/dev/null 2>&1
sysctl ${regreadfp}='off'
diff --git a/tests/sys/geom/class/mirror/12_test.sh b/tests/sys/geom/class/mirror/12_test.sh
index 07d69b696adf6..46a79efe7e05b 100644
--- a/tests/sys/geom/class/mirror/12_test.sh
+++ b/tests/sys/geom/class/mirror/12_test.sh
@@ -29,7 +29,7 @@ dd if=/dev/random of=$tmp1 bs=$ddbs count=1 >/dev/null 2>&1
EIO=5
# gmirror should kick one of the mirrors out after hitting EIO.
-sysctl ${regwritefp}="1*return(${EIO})"
+sysctl ${regwritefp}="1*return(${EIO})[pid $(gmirror_worker_pid)]"
dd if=$tmp1 of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
dd if=/dev/mirror/$name of=$tmp2 bs=$ddbs count=1 >/dev/null 2>&1
sysctl ${regwritefp}='off'
diff --git a/tests/sys/geom/class/mirror/13_test.sh b/tests/sys/geom/class/mirror/13_test.sh
index 4a66d65321a31..4b0fc6cf7825f 100644
--- a/tests/sys/geom/class/mirror/13_test.sh
+++ b/tests/sys/geom/class/mirror/13_test.sh
@@ -31,7 +31,7 @@ dd if=/dev/random of=$tmp1 bs=$ddbs count=1 >/dev/null 2>&1
ENXIO=6
# gmirror has special handling for ENXIO. It does not mark the failed component
# as broken, allowing it to rejoin the mirror automatically when it appears.
-sysctl ${regwritefp}="1*return(${ENXIO})"
+sysctl ${regwritefp}="1*return(${ENXIO})[pid $(gmirror_worker_pid)]"
dd if=$tmp1 of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
dd if=/dev/mirror/$name of=$tmp2 bs=$ddbs count=1 >/dev/null 2>&1
sysctl ${regwritefp}='off'
diff --git a/tests/sys/geom/class/mirror/9_test.sh b/tests/sys/geom/class/mirror/9_test.sh
index c7af15ba8ed23..0c29cefd4344b 100644
--- a/tests/sys/geom/class/mirror/9_test.sh
+++ b/tests/sys/geom/class/mirror/9_test.sh
@@ -26,7 +26,7 @@ devwait
# Break one of the mirrors by forcing a single metadata write error.
# When dd closes the mirror provider, gmirror will attempt to mark the mirrors
# clean, and will kick one of the mirrors out upon hitting the error.
-sysctl debug.fail_point.g_mirror_metadata_write='1*return(5)' || exit 1
+sysctl debug.fail_point.g_mirror_metadata_write="1*return(5)[pid $(gmirror_worker_pid)]" || exit 1
dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
sysctl debug.fail_point.g_mirror_metadata_write='off' || exit 1
diff --git a/tests/sys/geom/class/mirror/conf.sh b/tests/sys/geom/class/mirror/conf.sh
index cee2b10e9ff6a..f50ff5f6b6362 100644
--- a/tests/sys/geom/class/mirror/conf.sh
+++ b/tests/sys/geom/class/mirror/conf.sh
@@ -12,6 +12,11 @@ gmirror_test_cleanup()
}
trap gmirror_test_cleanup ABRT EXIT INT TERM
+gmirror_worker_pid()
+{
+ pgrep -S -n "g_mirror mirror\..*"
+}
+
syncwait()
{
while $(gmirror status -s $name | grep -q SYNCHRONIZING); do
diff --git a/tests/sys/geom/class/mirror/sync_error.sh b/tests/sys/geom/class/mirror/sync_error.sh
index b5f138aaf8a05..7c736b955a68b 100644
--- a/tests/sys/geom/class/mirror/sync_error.sh
+++ b/tests/sys/geom/class/mirror/sync_error.sh
@@ -28,7 +28,7 @@ sync_read_error_2_disks_body()
atf_check gmirror label $name $md1
devwait
- atf_check -s ignore -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)'
+ atf_check -s ignore -e empty -o not-empty sysctl ${REG_READ_FP}="1*return(5)[pid $(gmirror_worker_pid)]"
# If a read error occurs while synchronizing and the mirror contains
# a single active disk, gmirror has no choice but to fail the
@@ -75,7 +75,7 @@ sync_read_error_3_disks_body()
atf_check gmirror insert $name $md2
syncwait
- atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)'
+ atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}="1*return(5)[pid $(gmirror_worker_pid)]"
# If a read error occurs while synchronizing a new disk, and we have
# multiple active disks, we retry the read after an error. The disk