xref: /freebsd/tests/sys/geom/class/zoned/conf.sh (revision 48efb6c4eb9febc1c8c50d13a794e9165af71930)
1#!/bin/sh
2
3class="zoned"
4
5gzoned_test_setup()
6{
7	geom_atf_test_setup
8}
9
10# Print the write pointer LBA of the zone containing the given LBA.
11zone_wp()
12{
13	zoned_zone_wp /dev/${md}.zoned $1
14}
15
16# Print the start LBA of the given zone number.
17zone_start()
18{
19	zoned_zone_start /dev/${md}.zoned $1
20}
21
22# Print the number of zones matching a report option.
23zone_count()
24{
25	zoned_zone_count /dev/${md}.zoned $1
26}
27
28wait_dev()
29{
30	for _i in $(seq 1 50); do
31		[ -c "$1" ] && return 0
32		sleep 0.2
33	done
34	atf_fail "$1 did not appear"
35}
36
37wait_dev_gone()
38{
39	for _i in $(seq 1 50); do
40		[ -c "$1" ] || return 0
41		sleep 0.2
42	done
43	atf_fail "$1 did not go away"
44}
45
46gzoned_test_cleanup()
47{
48	if [ -f "$TEST_MDS_FILE" ]; then
49		while read md; do
50			[ -c /dev/${md}.zoned ] && \
51				gzoned destroy $md.zoned 2>/dev/null
52			mdconfig -d -u $md 2>/dev/null
53		done < $TEST_MDS_FILE
54	fi
55	true
56}
57
58. `dirname $0`/../geom_subr.sh
59. `dirname $0`/../zoned_subr.sh
60