Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/dev/fss Do not assume an all-zeroes disk label will re...



details:   https://anonhg.NetBSD.org/src/rev/7634fb7ba9a6
branches:  trunk
changeset: 822346:7634fb7ba9a6
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Mar 15 10:53:15 2017 +0000

description:
Do not assume an all-zeroes disk label will read back as a disk with
an 'a'  partition covering the whole disk, instead use the raw partition.
Also skip this test if the fss device is not available.
With lots of help from pgoyette.

diffstat:

 tests/dev/fss/t_fss.sh |  28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diffs (67 lines):

diff -r 3d2561a5d69a -r 7634fb7ba9a6 tests/dev/fss/t_fss.sh
--- a/tests/dev/fss/t_fss.sh    Wed Mar 15 09:51:08 2017 +0000
+++ b/tests/dev/fss/t_fss.sh    Wed Mar 15 10:53:15 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_fss.sh,v 1.2 2016/07/29 20:27:37 pgoyette Exp $
+# $NetBSD: t_fss.sh,v 1.3 2017/03/15 10:53:15 martin Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,12 +28,20 @@
 # Verify basic operation of fss(4) file system snapshot device
 #
 
+vnddev=vnd0
+rawpart=$( sysctl -n kern.rawpartition | tr '01234' 'abcde' )
+vnd=/dev/${vnddev}${rawpart}
+
 orig_data="Original data"
 repl_data="Replacement data"
 
 atf_test_case basic cleanup
 basic_body() {
 
+# verify fss is available (or loadable as a module)
+
+       fssconfig -l /dev/fss0 > /dev/null || atf_skip "FSS not available"
+
 # create of mount-points for the file system and snapshot
 
        mkdir ./m1
@@ -43,9 +51,9 @@
 # and mount it
 
        dd if=/dev/zero of=./image bs=32k count=64
-       vndconfig -c vnd0 ./image
-       newfs /dev/vnd0a
-       mount /dev/vnd0a ./m1
+       vndconfig -c ${vnddev} ./image
+       newfs -I ${vnd}
+       mount ${vnd} ./m1
 
        echo "${orig_data}" > ./m1/text
 
@@ -62,20 +70,14 @@
 
        read test_data < ./m2/text
        atf_check_equal "${orig_data}" "${test_data}"
-
-# Unmount our temporary stuff
-
-       umount /dev/fss0        || true
-       fssconfig -u fss0       || true
-       umount /dev/vnd0a       || true
-       vndconfig -u vnd0       || true
 }
 
 basic_cleanup() {
-       umount /dev/vnd0a       || true
+# Unmount our temporary stuff
+       umount ${vnd}           || true
        fssconfig -u fss0       || true
        umount /dev/fss0        || true
-       vndconfig -u vnd0       || true
+       vndconfig -u ${vnddev}  || true
 }
 
 atf_init_test_cases()



Home | Main Index | Thread Index | Old Index