File: lkcd-unordered-faroff

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 (84 lines) | stat: -rwxr-xr-x 1,557 bytes parent folder | download | duplicates (3)
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
#! /bin/sh

#
# Create an LKCDv9 with unordered data, but too far away to fit into the
# 32-bit offset. Verify that the data from the out-of-order page can be read.
#

# Skip this test if off_t is 32 bits (or less)
test $SIZEOF_OFF_T -gt 4 || exit 77

mkdir -p out || exit 99

name=$( basename "$0" )
datafile="out/${name}.data"
dumpfile="out/${name}.dump"

magic="4E 6F 4D 61 67 69 63 21"
magic2="21 4D 61 67 69 63 32 21"
cat >"$datafile" <<EOF
@0
00*4096
@
00*4096
# Gap is here at 0x2000 and 0x3000
@0x4000
$magic2
00*4088
# These two pages are invalid but never used
@0x100000000 skip=0xa0000000 raw
@0x200000000 skip=0xa0000000 raw
# Fill the gaps here (in reverse order):
@0x3000
$magic
00*4088
@0x2000
00*4096
@0 end
EOF

./mklkcd "$dumpfile" <<EOF
arch_name = x86_64
page_shift = 12
page_offset = 0xffff880000000000

NR_CPUS = 8
num_cpus = 1

compression = 1
DATA = $datafile
EOF
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot create lkcd file" >&2
    exit $rc
fi
echo "Created LKCD dump: $dumpfile"

result=$( ./dumpdata "$dumpfile" 0x2fff 9 )
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot read data" >&2
    exit $rc
fi
echo "Data: $result"
expect=$( echo 00 ; echo -n "$magic" )
if [ "${result% *}" != "$expect" ] ; then
    echo "Wrong data found" >&2
    exit 1
fi

result=$( ./dumpdata "$dumpfile" 0x3fff 9 )
rc=$?
if [ $rc -ne 0 ]; then
    echo "Cannot read data" >&2
    exit $rc
fi
echo "Data: $result"
expect=$( echo 00 ; echo -n "$magic2" )
if [ "${result% *}" != "$expect" ] ; then
    echo "Wrong data found" >&2
    exit 1
fi

exit 0