[BACK]Return to t_fss.sh CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tests / dev / fss

Annotation of src/tests/dev/fss/t_fss.sh, Revision 1.2.2.1

1.2.2.1 ! bouyer      1: # $NetBSD: t_fss.sh,v 1.3 2017/03/15 10:53:15 martin Exp $
1.1       pgoyette    2: #
                      3: # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
                      4: # All rights reserved.
                      5: # Redistribution and use in source and binary forms, with or without
                      6: # modification, are permitted provided that the following conditions
                      7: # are met:
                      8: # 1. Redistributions of source code must retain the above copyright
                      9: #    notice, this list of conditions and the following disclaimer.
                     10: # 2. Redistributions in binary form must reproduce the above copyright
                     11: #    notice, this list of conditions and the following disclaimer in the
                     12: #    documentation and/or other materials provided with the distribution.
                     13: #
                     14: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     15: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     16: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     17: # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     18: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     19: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     20: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     21: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     22: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     23: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     24: # POSSIBILITY OF SUCH DAMAGE.
                     25: #
                     26:
                     27: #
                     28: # Verify basic operation of fss(4) file system snapshot device
                     29: #
                     30:
1.2.2.1 ! bouyer     31: vnddev=vnd0
        !            32: rawpart=$( sysctl -n kern.rawpartition | tr '01234' 'abcde' )
        !            33: vnd=/dev/${vnddev}${rawpart}
        !            34:
1.1       pgoyette   35: orig_data="Original data"
                     36: repl_data="Replacement data"
                     37:
                     38: atf_test_case basic cleanup
                     39: basic_body() {
                     40:
1.2.2.1 ! bouyer     41: # verify fss is available (or loadable as a module)
        !            42:
        !            43:        fssconfig -l /dev/fss0 > /dev/null || atf_skip "FSS not available"
        !            44:
1.1       pgoyette   45: # create of mount-points for the file system and snapshot
                     46:
                     47:        mkdir ./m1
                     48:        mkdir ./m2
                     49:
                     50: # create a small 4MB file, treat it as a disk, init a file-system on it,
                     51: # and mount it
                     52:
                     53:        dd if=/dev/zero of=./image bs=32k count=64
1.2.2.1 ! bouyer     54:        vndconfig -c ${vnddev} ./image
        !            55:        newfs -I ${vnd}
        !            56:        mount ${vnd} ./m1
1.1       pgoyette   57:
                     58:        echo "${orig_data}" > ./m1/text
                     59:
                     60: # configure and mount a snapshot of the file system
                     61:
                     62:        fssconfig -c fss0 ./m1 ./backup
1.2       pgoyette   63:        mount -o rdonly /dev/fss0 ./m2
1.1       pgoyette   64:
                     65: # Modify the data on the underlying file system
                     66:
                     67:        echo "${repl_data}" > ./m1/text || abort
                     68:
                     69: # Verify that original data is still visible in the snapshot
                     70:
                     71:        read test_data < ./m2/text
                     72:        atf_check_equal "${orig_data}" "${test_data}"
                     73: }
                     74:
                     75: basic_cleanup() {
1.2.2.1 ! bouyer     76: # Unmount our temporary stuff
        !            77:        umount ${vnd}           || true
1.2       pgoyette   78:        fssconfig -u fss0       || true
1.1       pgoyette   79:        umount /dev/fss0        || true
1.2.2.1 ! bouyer     80:        vndconfig -u ${vnddev}  || true
1.1       pgoyette   81: }
                     82:
                     83: atf_init_test_cases()
                     84: {
                     85:         atf_add_test_case basic
                     86: }

CVSweb <webmaster@jp.NetBSD.org>