mb/google/parrot: Fix smbus subsystem ID
[coreboot.git] / util / lint / check_lint_tests
blob24c75c98980da7b380d13e7d1a24f41fb47bf498
1 #!/usr/bin/env sh
3 rootdir=${PWD}
5 # test to make sure the lint tests fail
6 SPACE=' '
7 UNDERSCORE='_'
9 # lint-stable-000-license-headers
10 TESTFILE000a="${rootdir}/src/arch/x86/thread.c"
11 TESTFILE000b="${rootdir}/src/arch/riscv/misc.c"
12 TESTFILE000c="${rootdir}/src/lib/hardwaremain.c"
14 # lint-stable-003-whitespace
15 TESTFILE003="${rootdir}/src/acpi/sata.c"
16 # lint-stable-004-style-labels
17 TESTFILE004="${rootdir}/src/soc/nvidia/tegra124/spi.c"
18 # lint-stable-005-board-status
19 TESTFILE005a="${rootdir}/src/mainboard/google/storm/board_info.txt"
20 # lint-stable-006-board-name
21 TESTFILE006="${rootdir}/src/mainboard/ibase/mb899/Kconfig.name"
22 # lint-stable-008-kconfig
23 TESTFILE008="${rootdir}/src/lib/Kconfig"
24 # lint-stable-009-old-licenses
25 TESTFILE009="${rootdir}/src/superio/common/conf_mode.c"
26 # lint-stable-010-asm-syntax
27 TESTFILE010="${rootdir}/src/arch/x86/assembly_entry.S"
28 # lint-stable-012-executable-bit
29 TESTFILE012="${rootdir}/src/lib/libgcc.c"
30 # lint-stable-013-site-local
31 TESTFILE013="$(mktemp --tmpdir=site-local)"
32 # lint-stable-016-non-ascii
33 TESTFILE016="${rootdir}/src/lib/halt.c"
34 # lint-stable-017-configs
35 TESTFILE017="${rootdir}/configs/testconfig"
36 # lint-stable-018-symlinks
37 TESTFILE018="${rootdir}/src/testKconfig"
38 # lint-stable-019-header-files
39 TESTFILE019=${rootdir}/test
40 # lint-stable-021-coreboot-lowercase
41 TESTFILE021=${rootdir}/test
42 # lint-stable-022-clang-format
43 TESTFILE022=${rootdir}/test
44 # lint-stable-023-filenames
45 TESTFILE023=${rootdir}/test
46 # lint-stable-024-kconfig-no-subsystem
47 TESTFILE024=${rootdir}/test
48 # lint-stable-026-line-endings
49 TESTFILE026=${rootdir}/test
50 # lint-stable-027-maintainers-syntax
51 TESTFILE027="${rootdir}/MAINTAINERS"
53 if [ "$1" = "--reset" ]; then
54 echo "Resetting testfiles"
55 echo "lint-stable-000-license-headers"
56 git checkout "${TESTFILE000a}" "${TESTFILE000b}" "${TESTFILE000c}"
57 echo "lint-stable-003-whitespace"
58 git checkout "${TESTFILE003}"
59 echo "lint-stable-004-style-labels"
60 git checkout "${TESTFILE004}"
61 echo "lint-stable-005-board-status"
62 git checkout "${TESTFILE005a}"
63 echo "lint-stable-006-board-name"
64 git checkout "${TESTFILE006}"
65 echo "lint-stable-008-kconfig"
66 git checkout "${TESTFILE008}"
67 echo "lint-stable-009-old-licenses"
68 git checkout "${TESTFILE009}"
69 echo "lint-stable-010-asm-syntax"
70 git checkout "${TESTFILE010}"
71 echo "lint-stable-012-executable-bit"
72 git checkout "${TESTFILE012}"
73 echo "lint-stable-013-site-local"
74 git reset "${TESTFILE013}"; rm -vf "${TESTFILE013}"
75 echo "lint-stable-016-non-ascii"
76 git checkout "${TESTFILE016}"
77 echo "lint-stable-017-configs"
78 rm -vf "${TESTFILE017}"
79 echo "lint-stable-018-symlinks"
80 rm -vf "${TESTFILE018}"
81 echo "lint-stable-019-header-files"
82 git checkout "${TESTFILE019}"
83 echo "lint-stable-021-coreboot-lowercase"
84 git checkout "${TESTFILE021}"
85 echo "lint-stable-022-clang-format"
86 git checkout "${TESTFILE022}"
87 echo "lint-stable-023-filenames"
88 git checkout "${TESTFILE023}"
89 echo "lint-stable-024-kconfig-no-subsystem"
90 git checkout "${TESTFILE024}"
91 echo "lint-stable-026-line-endings"
92 git checkout "${TESTFILE026}"
94 echo "lint-stable-027-maintainers-syntax"
95 git checkout "${TESTFILE027}"
98 else
99 echo "Modifying files for linter testing"
101 echo "lint-stable-000-license-headers"
102 sed -i.bak 's|^/\*.*||' "${TESTFILE000a}"
103 #sed -i.bak 's|^.*]SPDX-License-Identifier.*||' "${TESTFILE000b}"
104 #sed -i.bak 's|^.*]GPL-2.0-only|GPL-2.0|' "${TESTFILE000c}"
106 echo "lint-stable-003-whitespace"
107 sed -i.bak 's/^$/ /' "${TESTFILE003}"
109 echo "lint-stable-004-style-labels"
110 sed -i.bak 's/^done:/ done:/' "${TESTFILE004}"
112 echo "lint-stable-005-board-status"
113 sed -i.bak 's/^Category:.*/Category: lint/' "${TESTFILE005a}"
115 echo "lint-stable-006-board-name"
116 rm -f "${TESTFILE006}"
118 echo "lint-stable-008-kconfig"
119 sed -i.bak 's|config MISSING_BOARD_RESET|config MISSINGBOARDRESET|' "${TESTFILE008}"
121 echo "lint-stable-009-old-licenses"
122 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}"
123 git add "${TESTFILE009}"
125 echo "lint-stable-010-asm-syntax"
126 sed -i "1s/^/.att${UNDERSCORE}syntax noprefix\n/" "${TESTFILE010}"
127 git add "${TESTFILE010}"
129 echo "lint-stable-012-executable-bit"
130 chmod +x "${TESTFILE012}"
132 echo "lint-stable-013-site-local"
133 mkdir -p site-local
134 git add -f "${TESTFILE013}"
136 echo "lint-stable-016-non-ascii"
137 sed -i.bak 's|halt(|halt'"$(echo "\007")"'(|' "${TESTFILE016}"
139 echo "lint-stable-017-configs"
140 make olddefconfig
141 cp .config "${TESTFILE017}"
143 echo "lint-stable-018-symlinks"
144 rm -f "${TESTFILE018}"
145 ln -s src/Kconfig "${TESTFILE018}"
146 git add -f "${TESTFILE018}"
148 # lint-stable-019-header-files
149 # lint-stable-021-coreboot-lowercase
150 # lint-stable-022-clang-format
151 # lint-stable-023-filenames
152 # lint-stable-024-kconfig-no-subsystem
153 # lint-stable-026-line-endings
154 echo "lint-stable-027-maintainers-syntax"
155 sed -i.bak 's|src/cpu/x86/$|src/cpu/x86|' "${TESTFILE027}"