mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-30 08:19:09 +00:00
Replace for/retry loops with "wait_for_ggate_device" calls and check
results of commands As noted in r313008, the underlying issue was that geom_gate device creation wasn't created at ggatel command completion, but some short time after. ggatec(8) employs similar logic when creating geom_gate(4) devices. Switch from retry loops (after the ggatec/dd write calls) to wait_for_ggate_device function calls after calling ggatec(8) instead to detect the presence of the /dev/ggate* device, as this function is sufficient for determining whether or not the character device is ready for testing While here, use atf_check consistently with all dd calls to ensure that data output is as expected. MFC after: 1 week Reviewed by: asomers Differential Revision: D9409 Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
ed869ff019
commit
b42fffb4ef
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313081
@ -4,7 +4,6 @@ PIDFILE=ggated.pid
|
||||
PLAINFILES=plainfiles
|
||||
PORT=33080
|
||||
CONF=gg.exports
|
||||
RETRIES=16
|
||||
|
||||
atf_test_case ggated cleanup
|
||||
ggated_head()
|
||||
@ -21,31 +20,23 @@ ggated_body()
|
||||
work=$(alloc_md)
|
||||
src=$(alloc_md)
|
||||
|
||||
dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc
|
||||
dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc
|
||||
|
||||
echo $CONF >> $PLAINFILES
|
||||
echo "127.0.0.1 RW /dev/$work" > $CONF
|
||||
|
||||
atf_check ggated -p $PORT -F $PIDFILE $CONF
|
||||
for try in `jot $RETRIES`; do
|
||||
ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work && break
|
||||
# wait for ggated to be ready
|
||||
sleep 0.25
|
||||
done
|
||||
if [ "$try" -eq "$RETRIES" ]; then
|
||||
atf_fail "ggatec create failed"
|
||||
fi
|
||||
atf_check ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work
|
||||
|
||||
for try in `jot $RETRIES`; do
|
||||
dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1 conv=notrunc\
|
||||
&& break
|
||||
# Wait for /dev/ggate${us} to be ready
|
||||
sleep 0.25
|
||||
done
|
||||
if [ "$try" -eq "$RETRIES" ]; then
|
||||
atf_fail "dd failed; /dev/ggate${us} isn't working"
|
||||
fi
|
||||
ggate_dev=/dev/ggate${us}
|
||||
|
||||
wait_for_ggate_device ${ggate_dev}
|
||||
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=/dev/${src} of=${ggate_dev} bs=1m count=1 conv=notrunc
|
||||
|
||||
checksum /dev/$src /dev/$work
|
||||
}
|
||||
@ -78,7 +69,8 @@ ggatel_file_body()
|
||||
|
||||
wait_for_ggate_device ${ggate_dev}
|
||||
|
||||
dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc
|
||||
|
||||
checksum src work
|
||||
}
|
||||
@ -103,8 +95,10 @@ ggatel_md_body()
|
||||
work=$(alloc_md)
|
||||
src=$(alloc_md)
|
||||
|
||||
dd if=/dev/random of=$work bs=1m count=1 conv=notrunc
|
||||
dd if=/dev/random of=$src bs=1m count=1 conv=notrunc
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=/dev/random of=$work bs=1m count=1 conv=notrunc
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=/dev/random of=$src bs=1m count=1 conv=notrunc
|
||||
|
||||
atf_check ggatel create -u $us /dev/$work
|
||||
|
||||
@ -112,7 +106,8 @@ ggatel_md_body()
|
||||
|
||||
wait_for_ggate_device ${ggate_dev}
|
||||
|
||||
dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc
|
||||
atf_check -e ignore -o ignore \
|
||||
dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc
|
||||
|
||||
checksum /dev/$src /dev/$work
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user