1*57718be8SEnji Cooper# $NetBSD: t_high_ino_big_file.sh,v 1.4 2014/07/07 22:06:02 pgoyette Exp $ 2*57718be8SEnji Cooper# 3*57718be8SEnji Cooper# Copyright (c) 2014 The NetBSD Foundation, Inc. 4*57718be8SEnji Cooper# All rights reserved. 5*57718be8SEnji Cooper# 6*57718be8SEnji Cooper# Redistribution and use in source and binary forms, with or without 7*57718be8SEnji Cooper# modification, are permitted provided that the following conditions 8*57718be8SEnji Cooper# are met: 9*57718be8SEnji Cooper# 1. Redistributions of source code must retain the above copyright 10*57718be8SEnji Cooper# notice, this list of conditions and the following disclaimer. 11*57718be8SEnji Cooper# 2. Redistributions in binary form must reproduce the above copyright 12*57718be8SEnji Cooper# notice, this list of conditions and the following disclaimer in the 13*57718be8SEnji Cooper# documentation and/or other materials provided with the distribution. 14*57718be8SEnji Cooper# 15*57718be8SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16*57718be8SEnji Cooper# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17*57718be8SEnji Cooper# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18*57718be8SEnji Cooper# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19*57718be8SEnji Cooper# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20*57718be8SEnji Cooper# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21*57718be8SEnji Cooper# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22*57718be8SEnji Cooper# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23*57718be8SEnji Cooper# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24*57718be8SEnji Cooper# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25*57718be8SEnji Cooper# POSSIBILITY OF SUCH DAMAGE. 26*57718be8SEnji Cooper# 27*57718be8SEnji Cooper 28*57718be8SEnji Cooper# The image used in these tests has been provided by Thomas Schmitt under 29*57718be8SEnji Cooper# the following license (see PR kern/48787 for details how to recreate it): 30*57718be8SEnji Cooper# 31*57718be8SEnji Cooper# Copyright (c) 1999 - 2008, Thomas Schmitt (scdbackup@gmx.net) 32*57718be8SEnji Cooper# 33*57718be8SEnji Cooper# Redistribution and use in source and binary forms, with or without 34*57718be8SEnji Cooper# modification, are permitted provided that the following conditions are met: 35*57718be8SEnji Cooper# 36*57718be8SEnji Cooper# Redistributions of source code must retain the above copyright notice, 37*57718be8SEnji Cooper# this list of conditions and the following disclaimer. 38*57718be8SEnji Cooper# 39*57718be8SEnji Cooper# Redistributions in binary form must reproduce the above copyright notice, 40*57718be8SEnji Cooper# this list of conditions and the following disclaimer in the documentation 41*57718be8SEnji Cooper# and/or other materials provided with the distribution. 42*57718be8SEnji Cooper# 43*57718be8SEnji Cooper# Neither the name of Thomas Schmitt nor the names of his contributors 44*57718be8SEnji Cooper# may be used to endorse or promote products derived from this software without 45*57718be8SEnji Cooper# specific prior written permission. 46*57718be8SEnji Cooper# 47*57718be8SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 48*57718be8SEnji Cooper# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 49*57718be8SEnji Cooper# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 50*57718be8SEnji Cooper# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 51*57718be8SEnji Cooper# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 52*57718be8SEnji Cooper# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53*57718be8SEnji Cooper# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 54*57718be8SEnji Cooper# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 55*57718be8SEnji Cooper# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 56*57718be8SEnji Cooper# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 57*57718be8SEnji Cooper# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 58*57718be8SEnji Cooper# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 59*57718be8SEnji Cooper# DAMAGE. 60*57718be8SEnji Cooper# 61*57718be8SEnji Cooper# ------------------------------------------------------------------------ 62*57718be8SEnji Cooper# This is the BSD license as stated July 22 1999 with 63*57718be8SEnji Cooper# <OWNER>="Thomas Schmitt (scdbackup@gmx.net)", 64*57718be8SEnji Cooper# <ORGANIZATION>="Thomas Schmitt" and <YEAR>="1999" 65*57718be8SEnji Cooper# an Open Source license approved by opensource.org 66*57718be8SEnji Cooper# 67*57718be8SEnji Cooper 68*57718be8SEnji Coopermntpnt="" 69*57718be8SEnji Cooper 70*57718be8SEnji Cooperatf_test_case pr_kern_48787 cleanup 71*57718be8SEnji Cooperpr_kern_48787_head() { 72*57718be8SEnji Cooper atf_set "descr" "Verifies 32bit overflow isssues from PR kern/48787 are fixed" 73*57718be8SEnji Cooper atf_set "require.user" "root" 74*57718be8SEnji Cooper atf_set "require.progs" "rump_cd9660 bunzip2 stat" 75*57718be8SEnji Cooper atf_set "timeout" 6000 76*57718be8SEnji Cooper} 77*57718be8SEnji Cooper 78*57718be8SEnji Cooperpr_kern_48787_body() { 79*57718be8SEnji Cooper avail=$( df -Pk . | awk '{if (NR==2) print $4}' ) 80*57718be8SEnji Cooper if [ $avail -lt 4500000 ]; then 81*57718be8SEnji Cooper atf_skip "not enough free disk space, have ${avail} Kbytes, need ~ 4500000 Kbytes" 82*57718be8SEnji Cooper fi 83*57718be8SEnji Cooper bunzip2 < $(atf_get_srcdir)/pr_48787.image.bz2 > pr_48787.image 84*57718be8SEnji Cooper mntpnt=$(pwd)/mnt 85*57718be8SEnji Cooper mkdir ${mntpnt} 86*57718be8SEnji Cooper rump_cd9660 -o norrip ./pr_48787.image ${mntpnt} 87*57718be8SEnji Cooper if [ ! -r ${mntpnt}/small_file ]; then 88*57718be8SEnji Cooper atf_fail "${mntpnt}/small_file does not exist" 89*57718be8SEnji Cooper fi 90*57718be8SEnji Cooper if [ ! -r ${mntpnt}/my/large_file ]; then 91*57718be8SEnji Cooper atf_fail "${mntpnt}/my/large_file does not exist" 92*57718be8SEnji Cooper fi 93*57718be8SEnji Cooper umount ${mntpnt} 94*57718be8SEnji Cooper rump_cd9660 ./pr_48787.image ${mntpnt} 95*57718be8SEnji Cooper if [ ! -r ${mntpnt}/small_file ]; then 96*57718be8SEnji Cooper atf_fail "${mntpnt}/small_file does not exist" 97*57718be8SEnji Cooper fi 98*57718be8SEnji Cooper if [ ! -r ${mntpnt}/my/large_file ]; then 99*57718be8SEnji Cooper atf_fail "${mntpnt}/my/large_file does not exist" 100*57718be8SEnji Cooper fi 101*57718be8SEnji Cooper echo "this assumes current cd9660 inode encoding - adapt on changes" 102*57718be8SEnji Cooper atf_check -o match:"^4329541966$" stat -f "%i" ${mntpnt}/small_file 103*57718be8SEnji Cooper atf_check -o match:"^4329545920$" stat -f "%i" ${mntpnt}/my/large_file 104*57718be8SEnji Cooper umount ${mntpnt} 105*57718be8SEnji Cooper touch "done" 106*57718be8SEnji Cooper} 107*57718be8SEnji Cooper 108*57718be8SEnji Cooperpr_kern_48787_cleanup() { 109*57718be8SEnji Cooper if [ ! -f done ]; then 110*57718be8SEnji Cooper if [ "x${mntpnt}" != "x" ]; then 111*57718be8SEnji Cooper umount -f ${mntpnt} || true 112*57718be8SEnji Cooper fi 113*57718be8SEnji Cooper fi 114*57718be8SEnji Cooper} 115*57718be8SEnji Cooper 116*57718be8SEnji Cooperatf_init_test_cases() { 117*57718be8SEnji Cooper atf_add_test_case pr_kern_48787 118*57718be8SEnji Cooper} 119