| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. sh |
| 2 | |
| 3 | rootdir=${PWD} |
| 4 | |
| 5 | # test to make sure the lint tests fail |
| 6 | SPACE=' ' |
| 7 | UNDERSCORE='_' |
| 8 | |
| 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" |
| 13 | |
| 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="$(mktempscip-shell system . . 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" |
| 52 | |
| 53 | if [scip-shell system . . `[`. "$1" = "--reset" ]; then |
| 54 | echoscip-shell system . . echo. "Resetting testfiles" |
| 55 | echoscip-shell system . . echo. "lint-stable-000-license-headers" |
| 56 | gitscip-shell system . . git. checkout "${TESTFILE000a}" "${TESTFILE000b}" "${TESTFILE000c}" |
| 57 | echoscip-shell system . . echo. "lint-stable-003-whitespace" |
| 58 | gitscip-shell system . . git. checkout "${TESTFILE003}" |
| 59 | echoscip-shell system . . echo. "lint-stable-004-style-labels" |
| 60 | gitscip-shell system . . git. checkout "${TESTFILE004}" |
| 61 | echoscip-shell system . . echo. "lint-stable-005-board-status" |
| 62 | gitscip-shell system . . git. checkout "${TESTFILE005a}" |
| 63 | echoscip-shell system . . echo. "lint-stable-006-board-name" |
| 64 | gitscip-shell system . . git. checkout "${TESTFILE006}" |
| 65 | echoscip-shell system . . echo. "lint-stable-008-kconfig" |
| 66 | gitscip-shell system . . git. checkout "${TESTFILE008}" |
| 67 | echoscip-shell system . . echo. "lint-stable-009-old-licenses" |
| 68 | gitscip-shell system . . git. checkout "${TESTFILE009}" |
| 69 | echoscip-shell system . . echo. "lint-stable-010-asm-syntax" |
| 70 | gitscip-shell system . . git. checkout "${TESTFILE010}" |
| 71 | echoscip-shell system . . echo. "lint-stable-012-executable-bit" |
| 72 | gitscip-shell system . . git. checkout "${TESTFILE012}" |
| 73 | echoscip-shell system . . echo. "lint-stable-013-site-local" |
| 74 | gitscip-shell system . . git. reset "${TESTFILE013}"; rmscip-shell system . . rm. -vf "${TESTFILE013}" |
| 75 | echoscip-shell system . . echo. "lint-stable-016-non-ascii" |
| 76 | gitscip-shell system . . git. checkout "${TESTFILE016}" |
| 77 | echoscip-shell system . . echo. "lint-stable-017-configs" |
| 78 | rmscip-shell system . . rm. -vf "${TESTFILE017}" |
| 79 | echoscip-shell system . . echo. "lint-stable-018-symlinks" |
| 80 | rmscip-shell system . . rm. -vf "${TESTFILE018}" |
| 81 | echoscip-shell system . . echo. "lint-stable-019-header-files" |
| 82 | gitscip-shell system . . git. checkout "${TESTFILE019}" |
| 83 | echoscip-shell system . . echo. "lint-stable-021-coreboot-lowercase" |
| 84 | gitscip-shell system . . git. checkout "${TESTFILE021}" |
| 85 | echoscip-shell system . . echo. "lint-stable-022-clang-format" |
| 86 | gitscip-shell system . . git. checkout "${TESTFILE022}" |
| 87 | echoscip-shell system . . echo. "lint-stable-023-filenames" |
| 88 | gitscip-shell system . . git. checkout "${TESTFILE023}" |
| 89 | echoscip-shell system . . echo. "lint-stable-024-kconfig-no-subsystem" |
| 90 | gitscip-shell system . . git. checkout "${TESTFILE024}" |
| 91 | echoscip-shell system . . echo. "lint-stable-026-line-endings" |
| 92 | gitscip-shell system . . git. checkout "${TESTFILE026}" |
| 93 | |
| 94 | echoscip-shell system . . echo. "lint-stable-027-maintainers-syntax" |
| 95 | gitscip-shell system . . git. checkout "${TESTFILE027}" |
| 96 | |
| 97 | |
| 98 | else |
| 99 | echoscip-shell system . . echo. "Modifying files for linter testing" |
| 100 | |
| 101 | echoscip-shell system . . echo. "lint-stable-000-license-headers" |
| 102 | sedscip-shell system . . 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}" |
| 105 | |
| 106 | echoscip-shell system . . echo. "lint-stable-003-whitespace" |
| 107 | sedscip-shell system . . sed. -i.bak 's/^$/ /' "${TESTFILE003}" |
| 108 | |
| 109 | echoscip-shell system . . echo. "lint-stable-004-style-labels" |
| 110 | sedscip-shell system . . sed. -i.bak 's/^done:/ done:/' "${TESTFILE004}" |
| 111 | |
| 112 | echoscip-shell system . . echo. "lint-stable-005-board-status" |
| 113 | sedscip-shell system . . sed. -i.bak 's/^Category:.*/Category: lint/' "${TESTFILE005a}" |
| 114 | |
| 115 | echoscip-shell system . . echo. "lint-stable-006-board-name" |
| 116 | rmscip-shell system . . rm. -f "${TESTFILE006}" |
| 117 | |
| 118 | echoscip-shell system . . echo. "lint-stable-008-kconfig" |
| 119 | sedscip-shell system . . sed. -i.bak 's|config MISSING_BOARD_RESET|config MISSINGBOARDRESET|' "${TESTFILE008}" |
| 120 | |
| 121 | echoscip-shell system . . echo. "lint-stable-009-old-licenses" |
| 122 | sedscip-shell system . . 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 | gitscip-shell system . . git. add "${TESTFILE009}" |
| 124 | |
| 125 | echoscip-shell system . . echo. "lint-stable-010-asm-syntax" |
| 126 | sedscip-shell system . . sed. -i "1s/^/.att${UNDERSCORE}syntax noprefix\n/" "${TESTFILE010}" |
| 127 | gitscip-shell system . . git. add "${TESTFILE010}" |
| 128 | |
| 129 | echoscip-shell system . . echo. "lint-stable-012-executable-bit" |
| 130 | chmodscip-shell system . . chmod. +x "${TESTFILE012}" |
| 131 | |
| 132 | echoscip-shell system . . echo. "lint-stable-013-site-local" |
| 133 | mkdirscip-shell system . . mkdir. -p site-local |
| 134 | gitscip-shell system . . git. add -f "${TESTFILE013}" |
| 135 | |
| 136 | echoscip-shell system . . echo. "lint-stable-016-non-ascii" |
| 137 | sedscip-shell system . . sed. -i.bak 's|halt(|halt'"$(echoscip-shell system . . echo. "\007")"'(|' "${TESTFILE016}" |
| 138 | |
| 139 | echoscip-shell system . . echo. "lint-stable-017-configs" |
| 140 | makescip-shell system . . make. olddefconfig |
| 141 | cpscip-shell system . . cp. .config "${TESTFILE017}" |
| 142 | |
| 143 | echoscip-shell system . . echo. "lint-stable-018-symlinks" |
| 144 | rmscip-shell system . . rm. -f "${TESTFILE018}" |
| 145 | lnscip-shell system . . ln. -s src/Kconfig "${TESTFILE018}" |
| 146 | gitscip-shell system . . 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 | echoscip-shell system . . echo. "lint-stable-027-maintainers-syntax" |
| 155 | sedscip-shell system . . sed. -i.bak 's|src/cpu/x86/$|src/cpu/x86|' "${TESTFILE027}" |
| 156 | |
| 157 | fi |