1272343Sngie# $NetBSD: t_high_ino_big_file.sh,v 1.4 2014/07/07 22:06:02 pgoyette Exp $ 2272343Sngie# 3272343Sngie# Copyright (c) 2014 The NetBSD Foundation, Inc. 4272343Sngie# All rights reserved. 5272343Sngie# 6272343Sngie# Redistribution and use in source and binary forms, with or without 7272343Sngie# modification, are permitted provided that the following conditions 8272343Sngie# are met: 9272343Sngie# 1. Redistributions of source code must retain the above copyright 10272343Sngie# notice, this list of conditions and the following disclaimer. 11272343Sngie# 2. Redistributions in binary form must reproduce the above copyright 12272343Sngie# notice, this list of conditions and the following disclaimer in the 13272343Sngie# documentation and/or other materials provided with the distribution. 14272343Sngie# 15272343Sngie# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16272343Sngie# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17272343Sngie# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18272343Sngie# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19272343Sngie# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20272343Sngie# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21272343Sngie# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22272343Sngie# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23272343Sngie# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24272343Sngie# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25272343Sngie# POSSIBILITY OF SUCH DAMAGE. 26272343Sngie# 27272343Sngie 28272343Sngie# The image used in these tests has been provided by Thomas Schmitt under 29272343Sngie# the following license (see PR kern/48787 for details how to recreate it): 30272343Sngie# 31272343Sngie# Copyright (c) 1999 - 2008, Thomas Schmitt (scdbackup@gmx.net) 32272343Sngie# 33272343Sngie# Redistribution and use in source and binary forms, with or without 34272343Sngie# modification, are permitted provided that the following conditions are met: 35272343Sngie# 36272343Sngie# Redistributions of source code must retain the above copyright notice, 37272343Sngie# this list of conditions and the following disclaimer. 38272343Sngie# 39272343Sngie# Redistributions in binary form must reproduce the above copyright notice, 40272343Sngie# this list of conditions and the following disclaimer in the documentation 41272343Sngie# and/or other materials provided with the distribution. 42272343Sngie# 43272343Sngie# Neither the name of Thomas Schmitt nor the names of his contributors 44272343Sngie# may be used to endorse or promote products derived from this software without 45272343Sngie# specific prior written permission. 46272343Sngie# 47272343Sngie# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 48272343Sngie# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 49272343Sngie# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 50272343Sngie# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 51272343Sngie# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 52272343Sngie# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53272343Sngie# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 54272343Sngie# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 55272343Sngie# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 56272343Sngie# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 57272343Sngie# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 58272343Sngie# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 59272343Sngie# DAMAGE. 60272343Sngie# 61272343Sngie# ------------------------------------------------------------------------ 62272343Sngie# This is the BSD license as stated July 22 1999 with 63272343Sngie# <OWNER>="Thomas Schmitt (scdbackup@gmx.net)", 64272343Sngie# <ORGANIZATION>="Thomas Schmitt" and <YEAR>="1999" 65272343Sngie# an Open Source license approved by opensource.org 66272343Sngie# 67272343Sngie 68272343Sngiemntpnt="" 69272343Sngie 70272343Sngieatf_test_case pr_kern_48787 cleanup 71272343Sngiepr_kern_48787_head() { 72272343Sngie atf_set "descr" "Verifies 32bit overflow isssues from PR kern/48787 are fixed" 73272343Sngie atf_set "require.user" "root" 74272343Sngie atf_set "require.progs" "rump_cd9660 bunzip2 stat" 75272343Sngie atf_set "timeout" 6000 76272343Sngie} 77272343Sngie 78272343Sngiepr_kern_48787_body() { 79272343Sngie avail=$( df -Pk . | awk '{if (NR==2) print $4}' ) 80272343Sngie if [ $avail -lt 4500000 ]; then 81272343Sngie atf_skip "not enough free disk space, have ${avail} Kbytes, need ~ 4500000 Kbytes" 82272343Sngie fi 83272343Sngie bunzip2 < $(atf_get_srcdir)/pr_48787.image.bz2 > pr_48787.image 84272343Sngie mntpnt=$(pwd)/mnt 85272343Sngie mkdir ${mntpnt} 86272343Sngie rump_cd9660 -o norrip ./pr_48787.image ${mntpnt} 87272343Sngie if [ ! -r ${mntpnt}/small_file ]; then 88272343Sngie atf_fail "${mntpnt}/small_file does not exist" 89272343Sngie fi 90272343Sngie if [ ! -r ${mntpnt}/my/large_file ]; then 91272343Sngie atf_fail "${mntpnt}/my/large_file does not exist" 92272343Sngie fi 93272343Sngie umount ${mntpnt} 94272343Sngie rump_cd9660 ./pr_48787.image ${mntpnt} 95272343Sngie if [ ! -r ${mntpnt}/small_file ]; then 96272343Sngie atf_fail "${mntpnt}/small_file does not exist" 97272343Sngie fi 98272343Sngie if [ ! -r ${mntpnt}/my/large_file ]; then 99272343Sngie atf_fail "${mntpnt}/my/large_file does not exist" 100272343Sngie fi 101272343Sngie echo "this assumes current cd9660 inode encoding - adapt on changes" 102272343Sngie atf_check -o match:"^4329541966$" stat -f "%i" ${mntpnt}/small_file 103272343Sngie atf_check -o match:"^4329545920$" stat -f "%i" ${mntpnt}/my/large_file 104272343Sngie umount ${mntpnt} 105272343Sngie touch "done" 106272343Sngie} 107272343Sngie 108272343Sngiepr_kern_48787_cleanup() { 109272343Sngie if [ ! -f done ]; then 110272343Sngie if [ "x${mntpnt}" != "x" ]; then 111272343Sngie umount -f ${mntpnt} || true 112272343Sngie fi 113272343Sngie fi 114272343Sngie} 115272343Sngie 116272343Sngieatf_init_test_cases() { 117272343Sngie atf_add_test_case pr_kern_48787 118272343Sngie} 119