t_high_ino_big_file.sh revision 1.7 1 # $NetBSD: t_high_ino_big_file.sh,v 1.7 2024/06/11 17:12:36 rillig 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 issues from PR kern/48787 are fixed"
73 atf_set "require.user" "root"
74 atf_set "require.progs" "rump_cd9660 stat"
75 atf_set "timeout" 6000
76 }
77
78 pr_kern_48787_body() {
79 avail=$(df -Pk . | awk 'NR == 2 { print $4 }')
80 if [ $avail -lt 4500000 ]; then
81 atf_skip "not enough free disk space, have ${avail} Kbytes, need ~ 4500000 Kbytes"
82 fi
83 $(atf_get_srcdir)/h_hexdump_r < $(atf_get_srcdir)/pr_48787.image.hex > pr_48787.image || atf_fail "h_hexdump_r failed"
84 mntpnt=$PWD/mnt
85 mkdir ${mntpnt}
86
87 rump_cd9660 -o norrip "$PWD"/pr_48787.image ${mntpnt}
88 if [ ! -r ${mntpnt}/small_file ]; then
89 atf_fail "${mntpnt}/small_file does not exist"
90 fi
91 if [ ! -r ${mntpnt}/my/large_file ]; then
92 atf_fail "${mntpnt}/my/large_file does not exist"
93 fi
94 umount ${mntpnt}
95
96 rump_cd9660 "$PWD/pr_48787.image" ${mntpnt}
97 if [ ! -r ${mntpnt}/small_file ]; then
98 atf_fail "${mntpnt}/small_file does not exist"
99 fi
100 if [ ! -r ${mntpnt}/my/large_file ]; then
101 atf_fail "${mntpnt}/my/large_file does not exist"
102 fi
103 echo "this assumes current cd9660 inode encoding - adapt on changes"
104 atf_check -o match:"^4329541966$" stat -f "%i" ${mntpnt}/small_file
105 atf_check -o match:"^4329545920$" stat -f "%i" ${mntpnt}/my/large_file
106 umount ${mntpnt}
107
108 touch "done"
109 }
110
111 pr_kern_48787_cleanup() {
112 if [ ! -f done ]; then
113 if [ "x${mntpnt}" != "x" ]; then
114 umount -f ${mntpnt} || true
115 fi
116 fi
117 }
118
119 atf_init_test_cases() {
120 atf_add_test_case pr_kern_48787
121 }
122