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