blob: 1574b8da20e188169e46e9c74731dd0130b95d9b (
plain) (
blame)
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
|
# -*- sh -*-
# See LICENSE file for copyright and license details.
check_section () {
sectionn=$1
whole=$2
splitinwhole=$3
split=$(printf '%s\n' $splitinwhole | tr -d -- -)
wholebits=$(( ( $(printf '%s\n' $whole | sed 's/./+1/g') ) * 4 ))
splitbits=$(( ( $(printf '%s\n' $split | sed 's/./+1/g') ) * 4 ))
ssplit=$(printf '%s\n' $split | sed 's/^0*//' | sed 's/^$/0/' )
ssplitinwhole=$(printf '%s\n' $splitinwhole | tr -- - 0 | sed 's/^0*//' | sed 's/^$/0/' )
test $(section-value.tu $sectionn $whole $wholebits) = $ssplit
test $(unsection-value.tu $sectionn $split $splitbits) = $ssplitinwhole
}
test $(section-value.tu 32767 0 8) = inval
test $(unsection-value.tu 32767 0 8) = inval
for section in $(getnamelist SECTION); do
sectionn=$(getnum SECTION $section)
if test $section = UNDETERMINED || test $section = WHOLE; then
check_section $sectionn 12 12
check_section $sectionn 1234 1234
check_section $sectionn 12345678 12345678
check_section $sectionn 123456789ABC 123456789ABC
check_section $sectionn 0123456789ABCDEF 0123456789ABCDEF
elif test $section = UPPER_HALF; then
check_section $sectionn 1234 12--
check_section $sectionn 12345678 1234----
check_section $sectionn 123456789ABC 123456------
check_section $sectionn 0123456789ABCDEF 01234567--------
elif test $section = LOWER_HALF; then
check_section $sectionn 1234 --34
check_section $sectionn 12345678 ----5678
check_section $sectionn 123456789ABC ------789ABC
check_section $sectionn 0123456789ABCDEF --------89ABCDEF
elif test $section = INNER_HALF; then
check_section $sectionn 12345678 --3456--
check_section $sectionn 0123456789ABCDEF ----456789AB----
elif test $section = OUTER_HALF; then
check_section $sectionn 12345678 12----78
check_section $sectionn 0123456789ABCDEF 0123--------CDEF
elif test $section = EVEN_QUARTERS_AS_HALF; then
check_section $sectionn 12345678 --34--78
check_section $sectionn 0123456789ABCDEF ----4567----CDEF
elif test $section = ODD_QUARTERS_AS_HALF; then
check_section $sectionn 12345678 12--56--
check_section $sectionn 0123456789ABCDEF 0123----89AB----
elif test $section = EVEN_BYTES_AS_HALF; then
check_section $sectionn 1234 --34
check_section $sectionn 12345678 --34--78
check_section $sectionn 123456789ABC --34--78--BC
check_section $sectionn 0123456789ABCDEF --23--67--AB--EF
elif test $section = ODD_BYTES_AS_HALF; then
check_section $sectionn 1234 12--
check_section $sectionn 12345678 12--56--
check_section $sectionn 123456789ABC 12--56--9A--
check_section $sectionn 0123456789ABCDEF 01--45--89--CD--
elif test $section = UPPER_QUARTER; then
check_section $sectionn 12345678 12------
check_section $sectionn 0123456789ABCDEF 0123------------
elif test $section = UPPER_MID_QUARTER; then
check_section $sectionn 12345678 --34----
check_section $sectionn 0123456789ABCDEF ----4567--------
elif test $section = LOWER_MID_QUARTER; then
check_section $sectionn 12345678 ----56--
check_section $sectionn 0123456789ABCDEF --------89AB----
elif test $section = LOWER_QUARTER; then
check_section $sectionn 12345678 ------78
check_section $sectionn 0123456789ABCDEF ------------CDEF
else
printf 'Missing test for LIBSYSCALLS_SECTION_%s in tests/sections\n' "$section" >&2
false
fi
done
|