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