7 if [ -c /dev/${class}/${name} ]; then
18 test_md=$(mdconfig -a "$@") || exit
19 echo $test_md >> $TEST_MDS_FILE || exit
29 mdconfig -d -u $unit || exit
30 sed -i '' "/^${test_md}$/d" $TEST_MDS_FILE || exit
37 if [ -f "$TEST_MDS_FILE" ]; then
38 while read test_md; do
39 # The "#" tells the TAP parser this is a comment
40 echo "# Removing test memory disk: $test_md"
41 mdconfig -d -u $test_md
44 rm -f "$TEST_MDS_FILE"
47 if [ $(id -u) -ne 0 ]; then
48 echo '1..0 # SKIP tests must be run as root'
52 # If the geom class isn't already loaded, try loading it.
53 if ! kldstat -q -m g_${class}; then
54 if ! geom ${class} load; then
55 echo "1..0 # SKIP could not load module for geom class=${class}"
60 # Need to keep track of the test md devices to avoid the scenario where a test
61 # failing will cause the other tests to bomb out, or a test failing will leave
62 # a large number of md(4) devices lingering around
65 if ! TEST_MDS_FILE=$(mktemp ${TMPDIR}/test_mds.XXXXXX); then
66 echo 'Failed to create temporary file for tracking the test md(4) devices'