17bdfc3b7SEnji Cooper# 27bdfc3b7SEnji Cooper# Copyright 2015 EMC Corp. 37bdfc3b7SEnji Cooper# All rights reserved. 47bdfc3b7SEnji Cooper# 57bdfc3b7SEnji Cooper# Redistribution and use in source and binary forms, with or without 67bdfc3b7SEnji Cooper# modification, are permitted provided that the following conditions are 77bdfc3b7SEnji Cooper# met: 87bdfc3b7SEnji Cooper# 97bdfc3b7SEnji Cooper# * Redistributions of source code must retain the above copyright 107bdfc3b7SEnji Cooper# notice, this list of conditions and the following disclaimer. 117bdfc3b7SEnji Cooper# * Redistributions in binary form must reproduce the above copyright 127bdfc3b7SEnji Cooper# notice, this list of conditions and the following disclaimer in the 137bdfc3b7SEnji Cooper# documentation and/or other materials provided with the distribution. 147bdfc3b7SEnji Cooper# 157bdfc3b7SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 167bdfc3b7SEnji Cooper# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 177bdfc3b7SEnji Cooper# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 187bdfc3b7SEnji Cooper# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 197bdfc3b7SEnji Cooper# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 207bdfc3b7SEnji Cooper# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 217bdfc3b7SEnji Cooper# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 227bdfc3b7SEnji Cooper# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 237bdfc3b7SEnji Cooper# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 247bdfc3b7SEnji Cooper# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 257bdfc3b7SEnji Cooper# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 267bdfc3b7SEnji Cooper# 277bdfc3b7SEnji Cooper# $FreeBSD$ 287bdfc3b7SEnji Cooper# 297bdfc3b7SEnji Cooper 30*66845bf5SEnji CooperKB=1024 31*66845bf5SEnji CooperTEST_IMAGE="test.img" 32*66845bf5SEnji CooperTEST_INPUTS_DIR="inputs" 337bdfc3b7SEnji CooperTEST_MD_DEVICE_FILE="md.output" 347bdfc3b7SEnji CooperTEST_MOUNT_DIR="mnt" 357bdfc3b7SEnji Cooper 36*66845bf5SEnji Coopercreate_test_dirs() 377bdfc3b7SEnji Cooper{ 387bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_MOUNT_DIR 397bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_INPUTS_DIR 407bdfc3b7SEnji Cooper} 417bdfc3b7SEnji Cooper 427bdfc3b7SEnji Coopercreate_test_inputs() 437bdfc3b7SEnji Cooper{ 44*66845bf5SEnji Cooper create_test_dirs 45*66845bf5SEnji Cooper 46*66845bf5SEnji Cooper cd $TEST_INPUTS_DIR 477bdfc3b7SEnji Cooper 487bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 mkdir -m 0755 -p a/b/1 497bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 ln -s a/b c 507bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch d 517bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 ln d e 527bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch .f 537bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 mkdir .g 54*66845bf5SEnji Cooper # XXX: fifos on the filesystem don't match fifos created by makefs for 55*66845bf5SEnji Cooper # some odd reason. 56*66845bf5SEnji Cooper #atf_check -e empty -s exit:0 mkfifo h 577bdfc3b7SEnji Cooper atf_check -e ignore -s exit:0 dd if=/dev/zero of=i count=1000 bs=1 587bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch klmn 597bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch opqr 607bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch stuv 617bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 install -m 0755 /dev/null wxyz 627bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000001 637bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000010 647bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000011 657bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000100 667bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000101 677bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000110 687bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00000111 697bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001000 707bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001001 717bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001010 727bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001011 737bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001100 747bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001101 757bdfc3b7SEnji Cooper atf_check -e empty -s exit:0 touch 0b00001110 76*66845bf5SEnji Cooper 77*66845bf5SEnji Cooper for filesize in 1 512 $(( 2 * $KB )) $(( 10 * $KB )) $(( 512 * $KB )); \ 78*66845bf5SEnji Cooper do 79*66845bf5SEnji Cooper atf_check -e ignore -o empty -s exit:0 \ 80*66845bf5SEnji Cooper dd if=/dev/zero of=${filesize}.file bs=1 \ 81*66845bf5SEnji Cooper count=1 oseek=${filesize} conv=sparse 82*66845bf5SEnji Cooper files="${files} ${filesize}.file" 83*66845bf5SEnji Cooper done 84*66845bf5SEnji Cooper 85*66845bf5SEnji Cooper cd - 867bdfc3b7SEnji Cooper} 87