Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 1 | #!/usr/bin/env sh |
| 2 | |
| 3 | rootdir=${PWD} |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 4 | |
| 5 | # test to make sure the lint tests fail |
| 6 | SPACE=' ' |
| 7 | UNDERSCORE='_' |
| 8 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 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" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 13 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 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" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 52 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 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}" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 93 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 94 | echo "lint-stable-027-maintainers-syntax" |
| 95 | git checkout "${TESTFILE027}" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 96 | |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 97 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 98 | else |
| 99 | echo "Modifying files for linter testing" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 100 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 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}" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 105 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 106 | echo "lint-stable-003-whitespace" |
| 107 | sed -i.bak 's/^$/ /' "${TESTFILE003}" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 108 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 109 | echo "lint-stable-004-style-labels" |
| 110 | sed -i.bak 's/^done:/ done:/' "${TESTFILE004}" |
Martin Roth | ef5a238 | 2016-03-30 14:51:31 -0600 | [diff] [blame] | 111 | |
Martin Roth | d12e4f5 | 2022-06-05 11:59:11 -0600 | [diff] [blame] | 112 | echo "lint-stable-005-board-status" |
| 113 | sed -i.bak 's/^Category:.*/Category: lint/' "${TESTFILE005a}" |
| 114 | |
| 115 | echo "lint-stable-006-board-name" |
| 116 | rm -f "${TESTFILE006}" |
| 117 | |
| 118 | echo "lint-stable-008-kconfig" |
| 119 | sed -i.bak 's|config MISSING_BOARD_RESET|config MISSINGBOARDRESET|' "${TESTFILE008}" |
| 120 | |
| 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}" |
| 124 | |
| 125 | echo "lint-stable-010-asm-syntax" |
| 126 | sed -i "1s/^/.att${UNDERSCORE}syntax noprefix\n/" "${TESTFILE010}" |
| 127 | git add "${TESTFILE010}" |
| 128 | |
| 129 | echo "lint-stable-012-executable-bit" |
| 130 | chmod +x "${TESTFILE012}" |
| 131 | |
| 132 | echo "lint-stable-013-site-local" |
| 133 | mkdir -p site-local |
| 134 | git add -f "${TESTFILE013}" |
| 135 | |
| 136 | echo "lint-stable-016-non-ascii" |
| 137 | sed -i.bak 's|halt(|halt'"$(echo "\007")"'(|' "${TESTFILE016}" |
| 138 | |
| 139 | echo "lint-stable-017-configs" |
| 140 | make olddefconfig |
| 141 | cp .config "${TESTFILE017}" |
| 142 | |
| 143 | echo "lint-stable-018-symlinks" |
| 144 | rm -f "${TESTFILE018}" |
| 145 | ln -s src/Kconfig "${TESTFILE018}" |
| 146 | git add -f "${TESTFILE018}" |
| 147 | |
| 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}" |
| 156 | |
| 157 | fi |