File: diskdump-split

package info (click to toggle)
libkdumpfile 0.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,800 kB
  • sloc: ansic: 34,639; sh: 3,853; python: 1,490; makefile: 755
file content (175 lines) | stat: -rwxr-xr-x 3,635 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#! /bin/sh

#
# Check reading data from a split dump file
#

mkdir -p out || exit 99

name=$( basename "$0" )
dumpfile="out/${name}.dump"
resultfile="out/${name}.result"
datafile="$srcdir/${name}.data"
expectfile="$srcdir/${name}.expect"

desc="
version = 6
arch_name = x86_64
block_size = 4096
phys_base = 0
max_mapnr = 0x100
sub_hdr_size = 1

uts.sysname = Linux
uts.nodename = test-node
uts.release = 3.4.5-test
uts.version = #1 SMP Fri Jan 22 14:02:42 UTC 2016 (1234567)
uts.machine = x86_64
uts.domainname = (none)

nr_cpus = 1

split = 1

DATA = $datafile
"

# Create three split dump files

./mkdiskdump "$dumpfile.1" <<EOF
$desc
start_pfn = 1
end_pfn = 2
DATA = $datafile
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot create diskdump file" >&2
    exit $rc
fi
echo "Created split diskdump dump: $dumpfile.1"

./mkdiskdump "$dumpfile.2" <<EOF
$desc
start_pfn = 2
end_pfn = 3
DATA = $datafile
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot create diskdump file" >&2
    exit $rc
fi
echo "Created split diskdump dump: $dumpfile.2"

./mkdiskdump "$dumpfile.3" <<EOF
$desc
start_pfn = 3
end_pfn = 5
DATA = $datafile
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot create diskdump file" >&2
    exit $rc
fi
echo "Created split diskdump dump: $dumpfile.3"

echo "Check that file 1 only contains PFN 1"
./dumpdata "$dumpfile.1" 0x1000 8 > "$resultfile.1"
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot dump DISKDUMP data" >&2
    exit $rc
fi
if ! diff "$expectfile.1" "$resultfile.1"; then
    echo "Results do not match" >&2
    exit 1
fi
./dumpdata "$dumpfile.1" 0x2000 8 > "$resultfile.1.err" 2>/dev/null
rc=$?
if [ $rc -eq 0 ]; then
    echo "Unexpected success!" >&2
    exit 1
fi

echo "Check that file 2 only contains PFN 2"
./dumpdata "$dumpfile.2" 0x2000 8 > "$resultfile.2"
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot dump DISKDUMP data" >&2
    exit $rc
fi
if ! diff "$expectfile.2" "$resultfile.2"; then
    echo "Results do not match" >&2
    exit 1
fi
./dumpdata "$dumpfile.2" 0x1000 8 > "$resultfile.2.err" 2>/dev/null
rc=$?
if [ $rc -eq 0 ]; then
    echo "Unexpected success!" >&2
    exit 1
fi

echo "Check that file 3 contains PFN 3 and PFN 4"
./dumpdata "$dumpfile.3" 0x3ffc 8 > "$resultfile.3"
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot dump DISKDUMP data" >&2
    exit $rc
fi
if ! diff "$expectfile.3" "$resultfile.3"; then
    echo "Results do not match" >&2
    exit 1
fi
./dumpdata "$dumpfile.3" 0x2000 8 > "$resultfile.3.err" 2>/dev/null
rc=$?
if [ $rc -eq 0 ]; then
    echo "Unexpected success!" >&2
    exit 1
fi

echo "Check that data from all three files is combined"
./dumpdata -n3 "$dumpfile.1" "$dumpfile.2" "$dumpfile.3" 0x1ffc 8 0x2ffc 8 0x3ffc 8 > "$resultfile"
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot dump DISKDUMP data" >&2
    exit $rc
fi
if ! diff "$expectfile" "$resultfile"; then
    echo "Results do not match" >&2
    exit 1
fi

echo "Check combined page map"
./checkattr "$dumpfile.1" "$dumpfile.2" "$dumpfile.3" <<EOF
file.pagemap = bitmap: 0x1e
memory.pagemap = bitmap: 0x3f
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Attribute check failed" >&2
    exit $rc
fi

echo "Check combined page map with files out of order"
./checkattr "$dumpfile.2" "$dumpfile.3" "$dumpfile.1" <<EOF
file.pagemap = bitmap: 0x1e
memory.pagemap = bitmap: 0x3f
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Attribute check failed" >&2
    exit $rc
fi

echo "Check combined page map with one file missing"
./checkattr "$dumpfile.3" "$dumpfile.1" <<EOF
file.pagemap = bitmap: 0x1a
memory.pagemap = bitmap: 0x3f
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Attribute check failed" >&2
    exit $rc
fi