blob: 24c75c98980da7b380d13e7d1a24f41fb47bf498 (
plain)
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
|
#!/usr/bin/env sh
rootdir=${PWD}
# test to make sure the lint tests fail
SPACE=' '
UNDERSCORE='_'
# lint-stable-000-license-headers
TESTFILE000a="${rootdir}/src/arch/x86/thread.c"
TESTFILE000b="${rootdir}/src/arch/riscv/misc.c"
TESTFILE000c="${rootdir}/src/lib/hardwaremain.c"
# lint-stable-003-whitespace
TESTFILE003="${rootdir}/src/acpi/sata.c"
# lint-stable-004-style-labels
TESTFILE004="${rootdir}/src/soc/nvidia/tegra124/spi.c"
# lint-stable-005-board-status
TESTFILE005a="${rootdir}/src/mainboard/google/storm/board_info.txt"
# lint-stable-006-board-name
TESTFILE006="${rootdir}/src/mainboard/ibase/mb899/Kconfig.name"
# lint-stable-008-kconfig
TESTFILE008="${rootdir}/src/lib/Kconfig"
# lint-stable-009-old-licenses
TESTFILE009="${rootdir}/src/superio/common/conf_mode.c"
# lint-stable-010-asm-syntax
TESTFILE010="${rootdir}/src/arch/x86/assembly_entry.S"
# lint-stable-012-executable-bit
TESTFILE012="${rootdir}/src/lib/libgcc.c"
# lint-stable-013-site-local
TESTFILE013="$(mktemp --tmpdir=site-local)"
# lint-stable-016-non-ascii
TESTFILE016="${rootdir}/src/lib/halt.c"
# lint-stable-017-configs
TESTFILE017="${rootdir}/configs/testconfig"
# lint-stable-018-symlinks
TESTFILE018="${rootdir}/src/testKconfig"
# lint-stable-019-header-files
TESTFILE019=${rootdir}/test
# lint-stable-021-coreboot-lowercase
TESTFILE021=${rootdir}/test
# lint-stable-022-clang-format
TESTFILE022=${rootdir}/test
# lint-stable-023-filenames
TESTFILE023=${rootdir}/test
# lint-stable-024-kconfig-no-subsystem
TESTFILE024=${rootdir}/test
# lint-stable-026-line-endings
TESTFILE026=${rootdir}/test
# lint-stable-027-maintainers-syntax
TESTFILE027="${rootdir}/MAINTAINERS"
if [ "$1" = "--reset" ]; then
echo "Resetting testfiles"
echo "lint-stable-000-license-headers"
git checkout "${TESTFILE000a}" "${TESTFILE000b}" "${TESTFILE000c}"
echo "lint-stable-003-whitespace"
git checkout "${TESTFILE003}"
echo "lint-stable-004-style-labels"
git checkout "${TESTFILE004}"
echo "lint-stable-005-board-status"
git checkout "${TESTFILE005a}"
echo "lint-stable-006-board-name"
git checkout "${TESTFILE006}"
echo "lint-stable-008-kconfig"
git checkout "${TESTFILE008}"
echo "lint-stable-009-old-licenses"
git checkout "${TESTFILE009}"
echo "lint-stable-010-asm-syntax"
git checkout "${TESTFILE010}"
echo "lint-stable-012-executable-bit"
git checkout "${TESTFILE012}"
echo "lint-stable-013-site-local"
git reset "${TESTFILE013}"; rm -vf "${TESTFILE013}"
echo "lint-stable-016-non-ascii"
git checkout "${TESTFILE016}"
echo "lint-stable-017-configs"
rm -vf "${TESTFILE017}"
echo "lint-stable-018-symlinks"
rm -vf "${TESTFILE018}"
echo "lint-stable-019-header-files"
git checkout "${TESTFILE019}"
echo "lint-stable-021-coreboot-lowercase"
git checkout "${TESTFILE021}"
echo "lint-stable-022-clang-format"
git checkout "${TESTFILE022}"
echo "lint-stable-023-filenames"
git checkout "${TESTFILE023}"
echo "lint-stable-024-kconfig-no-subsystem"
git checkout "${TESTFILE024}"
echo "lint-stable-026-line-endings"
git checkout "${TESTFILE026}"
echo "lint-stable-027-maintainers-syntax"
git checkout "${TESTFILE027}"
else
echo "Modifying files for linter testing"
echo "lint-stable-000-license-headers"
sed -i.bak 's|^/\*.*||' "${TESTFILE000a}"
#sed -i.bak 's|^.*]SPDX-License-Identifier.*||' "${TESTFILE000b}"
#sed -i.bak 's|^.*]GPL-2.0-only|GPL-2.0|' "${TESTFILE000c}"
echo "lint-stable-003-whitespace"
sed -i.bak 's/^$/ /' "${TESTFILE003}"
echo "lint-stable-004-style-labels"
sed -i.bak 's/^done:/ done:/' "${TESTFILE004}"
echo "lint-stable-005-board-status"
sed -i.bak 's/^Category:.*/Category: lint/' "${TESTFILE005a}"
echo "lint-stable-006-board-name"
rm -f "${TESTFILE006}"
echo "lint-stable-008-kconfig"
sed -i.bak 's|config MISSING_BOARD_RESET|config MISSINGBOARDRESET|' "${TESTFILE008}"
echo "lint-stable-009-old-licenses"
sed -i "s|^.*]SPDX-License-Identifier.*|\* for more details.\n \* You${SPACE}should${SPACE}have received a copy of the GNU General Public License\n \* along with this program; if not, write to the Free Software\n \* Foundation, Inc.|" "${TESTFILE009}"
git add "${TESTFILE009}"
echo "lint-stable-010-asm-syntax"
sed -i "1s/^/.att${UNDERSCORE}syntax noprefix\n/" "${TESTFILE010}"
git add "${TESTFILE010}"
echo "lint-stable-012-executable-bit"
chmod +x "${TESTFILE012}"
echo "lint-stable-013-site-local"
mkdir -p site-local
git add -f "${TESTFILE013}"
echo "lint-stable-016-non-ascii"
sed -i.bak 's|halt(|halt'"$(echo "\007")"'(|' "${TESTFILE016}"
echo "lint-stable-017-configs"
make olddefconfig
cp .config "${TESTFILE017}"
echo "lint-stable-018-symlinks"
rm -f "${TESTFILE018}"
ln -s src/Kconfig "${TESTFILE018}"
git add -f "${TESTFILE018}"
# lint-stable-019-header-files
# lint-stable-021-coreboot-lowercase
# lint-stable-022-clang-format
# lint-stable-023-filenames
# lint-stable-024-kconfig-no-subsystem
# lint-stable-026-line-endings
echo "lint-stable-027-maintainers-syntax"
sed -i.bak 's|src/cpu/x86/$|src/cpu/x86|' "${TESTFILE027}"
fi
|