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