summaryrefslogtreecommitdiff
path: root/util/lint
AgeCommit message (Collapse)Author
2018-09-18util/lint: Ignore "visible if" statement in Kconfig filesPatrick Georgi
They allow reducing the visible set of options to remove clutter. Change-Id: I18c953c7feae23c0752392a2bf8f49783c17310e Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/28635 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
2018-09-14lint-000-license-headers: add SPDX-License-Identifier: GPL-2.0-or-laterRonald G. Minnich
Change-Id: Icbf21b02d3092815bbe876eceea72ebba8dd54da Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: https://review.coreboot.org/28599 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-09-04util/lint: update whitespace checking rulesMartin Roth
- Check payloads, the root Makefiles and toolchain.inc - 3rdparty is already not checked, so remove - The marks around COPYING, LICENSE, and README were not needed - Skip checking .ico files Change-Id: Ic4a1709224604b36362d82e249c2916fca0336a2 Signed-off-by: Martin Roth <martinr@coreboot.org> Reviewed-on: https://review.coreboot.org/28431 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
2018-09-04util/lint: Update whitespace linter for FreeBSDMartin Roth
On FreeBSD, this test was failing with the error: "grep: Argument list too long" I found that changing this to other forms takes MUCH longer, so I left the original method mostly unchanged except for moving the include & exclude lists into variables. Currently, I'm setting all non-linux operating systems to use the second version. I'll update that if I find other that other OSes support the first. Change-Id: I1c9281440d051dea8a8b3a3ddc04676ccea77c7a Signed-off-by: Martin Roth <martinr@coreboot.org> Reviewed-on: https://review.coreboot.org/28429 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
2018-08-20util/lint: Exclude util/superiotool from checkpatchNico Huber
`superiotool` follows its own style (e.g. lot's of missing spaces and odd placement of braces in the register descriptions). Change-Id: Ifa33938a0fbac10577cbda10537f856f6f100233 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/28214 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2018-08-13util/lint: Set "acknowledgement" correctElyes HAOUAS
"acknowledgement" is not commonly used but correct. Change-Id: I0aa469d77904d65288f5b7133bec10be3688a596 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/27953 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Tristan Corrick <tristan@corrick.kiwi> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-08-13util/lint: update checkpatch.pl to latest linux versionMartin Roth
Taken from Linux upstream commit ffe075132af8b7967089c361e506d4fa747efd14 Change-Id: I43d09a912fafe896c045df080c0f75fe6d908087 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/28046 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2018-08-13util/lint: Update spelling.txt to latest linux versionMartin Roth
Comment out 'sepc' and add a comment about it at the top so that it doesn't get added back in accidentally in a future update. Change-Id: Iaa909d97d0d97d7bf0799e48fc237a9673d549aa Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/28045 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-08-11util/lint: Remove register name identified as a misspelled wordXiang Wang
RISC-V has a register named 'sepc' but checkpatch identifies it as a misspelling of 'spec'. Remove it from the list. Change-Id: I7b092d6f04e28fba36095c607bc59346fb5c605d Signed-off-by: Xiang Wang <wxjstz@126.com> Reviewed-on: https://review.coreboot.org/28005 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
2018-07-26util: Add description.md to each utilTom Hiller
Descriptions are taken from the files themselves or READMEs. Description followed by a space with the language in marked up as code. Change-Id: I5f91e85d1034736289aedf27de00df00db3ff19c Signed-off-by: Tom Hiller <thrilleratplay@gmail.com> Reviewed-on: https://review.coreboot.org/27563 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2018-07-06util/lint: Update lint-stable-000-license-headers linterMartin Roth
- Update stable directories - Remove duplicated directories There are currently 220 files that still need to have headers added or be excluded from the lint-000-license-headers test. Change-Id: I40046a2fb7359262b130f6813eda1f2c30916b46 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/26573 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2018-06-25util/lint/checkpatch_json: Fix checkpatch output keyword match stringNaresh G Solanki
From checkpatch output, look for keywords starting with 'ERROR:' & 'WARNING:' . Also check for keywork ': FILE:' instead of the same without the colon (:). BUG=None BRANCH=None TEST=Check if patch https://review.coreboot.org/#/c/coreboot/+/22537/21 is processed & json output is generated properly. Change-Id: Ib690ab34a1ffabc4f83642634fd34beea16a64dc Signed-off-by: Naresh G Solanki <naresh.solanki@intel.com> Reviewed-on: https://review.coreboot.org/27170 Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2018-06-14util/lint: Run lint-extended-007-final-newlines checks in parallelMartin Roth
Instead of checking each directory in series, kick off the checks in parallel and then wait for them to finish. Failures print out with file information, so mixing output isn't a problem. This reduces the time it takes to run on lumberingbuilder by 60%. This could probably be sped up even more by splitting up src/mainboard into smaller sections. This method does skip a few control files at the top level - .gitignore, .checkpatch.conf, gnat.adc, etc. These could be added to the list of files to check, but I didn't think it was needed. Change-Id: I171977e713a9956cf4142cfc0a199e10040abb35 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/27011 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-06-12util/lint: Run lint-extended-007-checkpatch checks in parallelMartin Roth
Instead of checking each directory in series, kick off all the checks in parallel and then wait for them to finish. Failures print out with file information, so mixing output isn't a problem. This reduces the time it takes to run on lumberingbuilder from 31 seconds to 6. Change-Id: I1252a68a723370389d399f3d1a2aff3fad64c365 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/26995 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-06-07util/lint: Add filename checkerMartin Roth
Check that filenames have only alphanumeric characters plus underscore, dash, and period. Change-Id: I7bf0be15d588aa1a5ece628b56e871662d6af44b Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/26938 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-06-02util/lint: Update lint-000-license-headers linterMartin Roth
- Add some directories and files to the ignore list - Add the LGPL as a recognized header. It's used in some files that were pulled into coreboot from other sources. Change-Id: I53423205f1cbf142a294ee5d24e885741a44dfcd Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/26572 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-06-01util/lint: use a more compact output formatPatrick Georgi
It now looks like this: Check that files have license headers (lint-stable-000-license-headers): success Check for superfluous whitespace in the tree (lint-stable-003-whitespace): success Check that C labels begin at start-of-line (lint-stable-004-style-labels): success Change-Id: I9d1f6adebae5b68a51e89c2833f8713f0ffcb616 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/26703 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2018-05-31util/lint: Add check that changes conform to clang-format stylePatrick Georgi
It's a white list (configured through $(top)/.clang-format-scope) with the expectation that the list will grow over time. Once everything is covered, we can turn off the white-listing and keep everything enforced. To not drive people crazy, only check the files their commit touched. Change-Id: I52c7ea73fd36aaa46c0bfce928158e1cd6304540 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/26514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2018-05-30checkpatch: exclude util/crossgcc/patchesPatrick Georgi
These files are supposed to contain trailing whitespace due to the patch format. Also use the exclusion list in the pre-commit hook. Change-Id: I8816c05ea703964a332915a0675096836957b242 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/26695 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Martin Roth <martinroth@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2018-05-22util/lint: Make the non-ascii character check stableMartin Roth
Change-Id: I967f67a19a96cac8b7e0e98356e87d7d0610d4b2 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/26435 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-05-09util/lint: Ignore whitespace, newlines, and licenses in vbt filesMartin Roth
Change-Id: I84f612db058d83936ddd5a6baa32c993e5b0f594 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/26064 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-04-16util/lint: Fix execution on OpenBSDPiotr Kubaj
util/lint/lint creates a file using mktemp. mktemp on OpenBSD requires at least 6 X's, while only 5 are in the template. Change-Id: I0b80214dd83d21e12e16a5002c68127a7ca2e41b Signed-off-by: Piotr Kubaj <pkubaj@anongoth.pl> Reviewed-on: https://review.coreboot.org/19745 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
2018-04-09util/lint: Generate json output from checkpatch outputNaresh G Solanki
checkpatch_json.py processes the output of checkpatch.pl & generates json format output of comments. This json format output can be used to post comment on particular CL using gerrit. BUG=None BRANCH=None TEST= Run following commands: 1. Capture output of checkpatch.pl to file say checkpatch.txt nice -n 20 git diff HEAD~ | util/lint/checkpatch.pl --no-signoff -q - | tee checkpatch.txt 2. Generate json format file for the output. util/lint/checkpatch_json.py checkpatch.txt comment.json 3. Post the comment.json using gerrit ssh coreboot.org gerrit review -j "<CL number>,<patchset number>" < comment.json Change-Id: I2471792796ab8e7d9855a6559fc731345ebd1525 Signed-off-by: Naresh G Solanki <naresh.solanki@intel.com> Signed-off-by: Maulik V Vaghela <maulik.v.vaghela@intel.com> Reviewed-on: https://review.coreboot.org/23429 Reviewed-by: Subrata Banik <subrata.banik@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2018-01-29util/lint/checkpatch.pl: Untaint filenameMartin Roth
This fixes the warning that is seen on the jenkins server: Insecure dependency in piped open while running setgid at util/lint/checkpatch.pl line 958. Change-Id: I476efa76ef6a275584a47ec0ecf2315948d53e9d Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/23473 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2018-01-26util/lint: Apply `final newlines` check to scriptsAlex Thiessen
The `lint-extended-015-final-newlines` script skips over executable files and thus leaves script files unchecked. Use `file` to find scripts and include them in the `final newlines` checks. Whitelisting is used including bash, perl, python and sh scripts. Change-Id: I8649b261b7e2cbbac7f9b90a9ace3f1c7b0eedeb Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com> Reviewed-on: https://review.coreboot.org/23325 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2018-01-23util/lint: Unify checks for git worktreeAlex Thiessen
Linters try to determine whether they are running in a git worktree so that `git grep` can be used instead of `grep`. These checks are done in different not truly correct ways and thus the linters don't use `git grep` when running from a worktree subdirectory, e.g. in a git subtree environment. Unify checks using `git rev-parse --is-inside-work-tree`. Change-Id: I3f54afc99ad0f0e3052cffdd32bdd9649cf3d720 Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com> Reviewed-on: https://review.coreboot.org/23297 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-01-23util/*: Fix final newlines in scriptsAlex Thiessen
Some script files under the `util` directory have no final newline or multiple final newlines. This is fixed so that an adapted `util/lint/lint-extended-015-final-newlines` does not bark at them anymore. Change-Id: Icec08f1fc7ea837906653475b7f821aa1a143169 Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com> Reviewed-on: https://review.coreboot.org/23324 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
2018-01-10util/lint: Check license headers of git hooksAlex Thiessen
Now that all the files under util/gitconfig have their license headers, enable lint-000-license-headers to check the directory too. Change-Id: I242256f72ac70553535509f83166c6d1ddb16fdc Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com> Reviewed-on: https://review.coreboot.org/23098 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-12-05lint-stable: Only check files tracked by git (ie source files) for +xPatrick Georgi
Change-Id: I99cbcba7a086ef950f248888a83cf24a4db4aee9 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/21419 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2017-09-20util/lint: update checkpatch & spelling.txt to upstream versionsMartin Roth
- Update checkpatch.pl to version 0547fa58 (checkpatch: add 6 missing types to --list-types) - Update spelling.txt to version d9f91f8 (scripts/spelling.txt: add a bunch more spelling mistakes) - Fix an additional unescaped left brace in a regex - causes warnings in new versions of perl. Change-Id: Ic443099e90a46280f18d58799afc72d00dc83793 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/21581 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Chris Ching <chingcodes@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-09-13util/lint: Exclude external payloads from coreboot lowercase checkMartin Roth
Change-Id: I70bbf37fad67fd9bda5724811f4bbdcc53779a42 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/21321 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
2017-09-02util/lint/checkpatch: Untaint variables from env & command lineMartin Roth
Jenkins is giving warnings due tainted variables from the environment and command line: Insecure $ENV{PATH} while running setgid at util/lint/checkpatch.pl line 907, <$conststructs> line 39. Insecure dependency in piped open while running setgid at util/lint/checkpatch.pl line 907, <$conststructs> line 39. This should fix those warnings. Change-Id: I6a09915d13547bf9a86c011d44cbcd39c46f3fec Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/21293 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2017-08-17util/lint: Change final-newlines to lint-test from lint-extended-testMartin Roth
The final newline check is taking longer than we'd like to run. Since it runs on every commit as part of the pre-commit check, we want that to run faster than it currently does. Remove LINT_SKIP_NEWLINE_CHECK as it's no longer needed. Change-Id: Ie945dd6caba84e0d23af499d43367d70b1696089 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20872 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2017-08-17lint: update signed-off-by checkMartin Roth
The current signed-off-by check doesn't really work well as a lint stable test being run by the pre-commit git hook. This test looks at the PREVIOUS commit instead of the staged commit, which works well on the server. In looking for a way to check the staged commit message, I found the commit-msg hook, which is the correct way to check the staged message. - Update the commit message check from a lint-stable test to a lint-extended test. - Add the check for signed-off-by to the commit-msg hook Change-Id: I8be8aef25730d988c7cf1586ae66ecb839d5f756 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20920 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-08-14Makefile.inc: lint: Update to run lint-extended scriptsMartin Roth
- Add lint-extended as a valid option - Call lint-extend from what-jenkins-does and test-lint - When logging to a junit.xml file, name the file extended-junit.xml so it doesn't conflict with the stable junit.xml file. Change-Id: I7e4156844b8c60790e03a0e43564610bb0c8f386 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16362 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-08-14util/lint: add extended stable checkpatch for testingMartin Roth
The checkpatch script takes a while to run, so don't add it to the lint-stable checks which run pre-commit. Change-Id: I907176c21c057564495b75133ba10b0761c9fe7b Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16360 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-08-10util/lint: Update license header lint scriptsMartin Roth
- Check for original LinuxBIOS header from LANL - Check for the BSD style license used in x86emu - Add top level checks for src/cpu and src/vboot - Add drivers dir check for aspeed, emulation, and sil - Add mainboard dir check for digitallogic Change-Id: Ie1ef6a39fd1d184815d22235d43780caedb2ca95 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/19122 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Chris Ching <chingcodes@google.com> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-08-10lint: Update lint-stable-021-coreboot-lowercaseMartin Roth
- Exclude .patch files from check - Exclude 'CorebootBdsLib' path in Tianocore. Change-Id: I82186f401d267d7594fe1cd88c818c4a7015ba91 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20905 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Evelyn Huang <evhuang@google.com>
2017-08-09util/lint: provide option to skip newline checkAaron Durbin
The newline lint check takes forever as it checks every file in the git repo -- not just the files changed. To add insult to injury these checks are performed on every commit. Allow one to skip this check by setting the LINT_SKIP_NEWLINE_CHECK environment variable. Change-Id: I1cd5c50627b73d68b0da2fcb2d9546eb874a7959 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/20903 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
2017-07-24util/lint: Update final newline checkMartin Roth
- Exclude .png and .patch files. - Turn into a lint-stable test. Change-Id: I4a5c77d7856bc5017ba441d458378b4837c1c7d5 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20706 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2017-07-21util/lint: exclude patch files from asm syntax checkMartin Roth
This allows the paches to add cross-compile support for true x86 16-bit GCC (ia16) to go in. Change-Id: If9246b5fb2f3578afea601fd63b7d716ddf8597e Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/19714 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-07-18util/lint: update kconfig_lintMartin Roth
* Add check for '#if defined' as well as #ifdef * Add check for IS_ENABLED() around bools in #if statements. * Fix an incomplete comment. Change-Id: I0787eab80ae64f59664fb53f395389bf5ac2a067 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20360 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
2017-06-29util/lint: Update checkpatch & files to upstream linuxMartin Roth
- Update checkpatch.pl to version 522b837 (checkpatch: warn when formats use %Z and suggest %z) - This update moves the const_struct definitions into an external file. coreboot will want to update this file, but for now I'm just pulling it in directly from the linux tree. - Update spelling.txt used by checkpatch.pl to version 505d308 (scripts/spelling.txt: add "overide" pattern and fix typo instances) - Add better notes where things have been changed for coreboot to make future merges easier. Change-Id: I0ef067874fe7b1d23276a10e63858895d6083f69 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/18810 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-06-27util/lint: Add check to make sure 'coreboot' is lowercaseMartin Roth
- Excludes certain phrases which can't be changed. - Checks last commit message if code is in a repo. Change-Id: I6b52342488dacc56ef6083db5503507af35d41ac Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20032 Reviewed-by: Marc Jones <marc@marcjonesconsulting.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2017-06-07util/lint: Give better warning for help spacing issueMartin Roth
Because the help block uses significant whitespace to determine whether or not text is inside the help block, a mixture of spaces and tabs confuses the parser. If there's an unrecognized line, and the previous line was inside a help block, it's likely that this line is too. Additionally, this was found with a line that started ' configuration', and threw a perl warning about an uninitialized value because the parser thought this was the start of a new config line, but couldn't find the symbol. Now we make sure that config statements have whitespace after the 'config' statement. Change-Id: I46375738a18903b266ea9fff3102a1a91235e609 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/19155 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2017-06-07util/lint/kconfig_lint: update help checkingMartin Roth
- Turn the check for help text with no indentation from a warning to an error. - Show an error if the help text is at the same indentation level as the 'help' keyword. Change-Id: Ibf868c83e2a128ceb6c4d3da7f2cf7dc237054e6 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/19851 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2017-05-25util/lint: ignore some more binary file typesPatrick Georgi
Namely png (images) and eot, ttf, woff (fonts) Change-Id: I41e773c0adab796876a3b1e91e089ae89cbb04df Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: https://review.coreboot.org/19880 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
2017-04-24util/lint: Don't run checkpatch on the documentationMartin Roth
Change-Id: Ib95a7c9c64c481af7dcf1074ffc0fc76dc6b6ff9 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/19144 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-03-27util/lint: Show an error if a symbol is created in two choice blocksMartin Roth
Kconfig shows a warning about this, but we want to catch it earlier and halt the build. Change-Id: I0acce1d40a6ca2b212c638bdb1ec65de5bd4d726 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/18970 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik <subrata.banik@intel.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2017-03-09uti/lint/checkpatch: Fix __attribute__ struct errors for OPEN_BRACEMartin Roth
The __attribute__((weak)) lines on structs were being read as functions, causing a warning that the brace should be on the next line. Add a check to see if it's a struct with an attribute, and ignore it for the OPEN_BRACE check if it is. Change-Id: Ieb0c96027e8df842f60ca7c9de7aac941eed1dc2 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/18570 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Lee Leahy <leroy.p.leahy@intel.com>
2017-03-09uti/lint/checkpatch: add --exclude to ignore specific directoriesMartin Roth
checkpatch: add option for excluding directories when importing code from external sources Using --exclude <dir> we should be able to exclude a list of well defined locations in the tree that carry sources from other projects with other styles. This comes from the 01org/zephyr project in github: Original-Change-Id: I7d321e85eed6bc37d5c6879ae88e21d20028a433 Original-Signed-off-by: Anas Nashif <anas.nashif@intel.com> Change-Id: Icc9e841e7d84026d6ab857ff90b0f093515ccaad Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/18568 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
2017-02-14util/lint: Don't check license text for files with under 5 linesMartin Roth
Change-Id: I7c1e3cf558d447838819b4d6a63d93d48d5f13e0 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/18316 Tested-by: build bot (Jenkins) Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
2017-01-09util/lint: Add check for the signed-off-by lineMartin Roth
Gerrit will let you push a patch without a signed-off-by line, although I believe it can't actually be merged. Instead of catching it either manually, or when the patch is attempting to be merged, catch this in the jenkins builder. Change-Id: I80161befa157266dd4e3209839a06ff398aab6bb Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17941 Tested-by: build bot (Jenkins) Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
2016-12-12lint/kconfig_lint: Make sure all symbols have a type definedMartin Roth
Show an error if a symbol does not have a defined type. This caused a problem of an undefined symbol in check_defaults, so we just skip those symbols there as we can't verify the default pattern without knowing the type. Change-Id: I28711a77962e16f6fc89789400363edd0fdd0931 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17345 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@googlemail.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-12-12util/lint: add check for auto-included headersMartin Roth
Since we've removed them from the tree, add a check to keep them out. Change-Id: I2995da765fee8796a297963d54a1c34f56376efe Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17658 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-12-09util/lint: Add check to verify saved configs are miniconfigsMartin Roth
Change-Id: Ifc5ec645dd27663c1b1fde9ff16d48534606a554 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17600 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins)
2016-11-30util/lint: Add check for symbolic links in the coreboot treeMartin Roth
Because of the varied environments that coreboot is built under, we don't want to have symbolic links in the tree. Change-Id: I4cf9d95a437626cb52e3032a5e6cba83320a334b Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17633 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-11-30util/lint: Exclude devicetree files with custom name from license checkNaresh G Solanki
As devicetree files can have different name followed by extension cb Exclude all .cb file from the license header check. Change-Id: I37b651eedd77cbf3d3e65ff0f027f971b0a2d2ac Signed-off-by: Naresh G Solanki <naresh.solanki@intel.com> Reviewed-on: https://review.coreboot.org/17186 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
2016-11-28kconfig_lint: More updates for excluded filesMartin Roth
- All of the symbols are in the .config, so if .config is include in the search all of the symbols are always found. - There are now some Kconfig symbols in the Documentation directory, so that needs to be excluded. - 3rdparty has lots of Kconfig symbols that are unrelated to what is being searched for. Change-Id: I0ff56d0a0916338a8b94f5210b8e0b3be5194f41 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17588 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-11-28kconfig_lint: exclude payloads from search, add back specific filesMartin Roth
Don't search for symbols in the payloads directory, except for specific files that are actively added back to the search. Change-Id: I6f28dc7dee040b8061fa5644066f3613367b6d84 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17443 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-10-27util/lint/lint: Show lint script output as it's runningMartin Roth
The checkpatch script takes a really long time to run, and when the output is buffered to wait until it's finished, it's hard to tell if the script is actually doing anything. Instead, use tee to log the output and display it at the same time. Change-Id: I3cf36e5e6ca28584103888ee1c6f125320ac068a Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17125 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
2016-10-03Revert "util/lint/kconfig_lint: change warning levels and text"Martin Roth
This reverts commit dfdb0733a6a71b11d15006dafc13841e84fab7cd. Change-Id: I91bf5e42f4ac241f544742ce161bae651f9f9947 Reviewed-on: https://review.coreboot.org/16868 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
2016-10-03util/lint/kconfig_lint: change warning levels and textMartin Roth
- Add an exception for MAINBOARD_POWER_ON_AFTER_POWER_FAIL when checking - With those exceptions set, we don't have anymore #define or #ifdef warnings, so turn them to errors so no more can be pushed. - Change the definition of an unused symbol from a warning to a note. There are times when unused symbols are expected. - Upgrade the warning for loading Kconfig files multiple times from a warning to an error. Change-Id: I6dcb06d4f0b099d5ccaf7643e72dd790719bdf58 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16840 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-10-03util/lint/kconfig_lint: Check default typesMartin Roth
The type of the default value wasn't being checked to make sure that it matched the type of the Kconfig symbol. This makes sure that the symbol is being set to either a reasonable looking value or to another Kconfig symbol. Change-Id: Ia01bd2d8b387f319d29f0a005d55cb8e20cd3853 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16839 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-09-20checkpatch.pl: ignore '#define asmlinkage'Martin Roth
checkpatch warns that the asmlinkage storage class should be at the beginning of the declaration when we define it to be an empty value. Change-Id: I12292d5b42bf6da9130bb969ebe00fca8efcf049 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16358 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-09-20lint/lint-007-checkpatch: Update lint scriptMartin Roth
- Check Kconfig files as well. - Accept a list of directories to check as a command line argument. - Only look at src & util directories by default. - Skip src/vendorcode. - Remove bypass of payloads/coreinfo/util/kconfig directory, it no longer exists. Change-Id: Ia522d3ddc29914220bdaae36ea23ded7338c48fd Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16359 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-09-19Add minimal GNAT run time system (RTS)Nico Huber
Add a stripped-down version of libgnat. This is somehow comparable to libgcc but for Ada programs. It's licensed under GPLv3 but with the runtime library exception. So it's totally fine to link it with our GPLv2 code and keep it under GPLv2. Change-Id: Ie6522abf093f0a516b9ae18ddc69131bd721dc0c Signed-off-by: Nico Huber <nico.huber@secunet.com> Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/11836 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com>
2016-09-15checkpatch.pl: Force raw_line to return a defined valueMartin Roth
Fixes the warning: Use of uninitialized value in concatenation (.) or string at util/lint/checkpatch.pl line 4739 Change-Id: Idc3c631735a595517d77cb8b8ec67e1ac00b6685 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16357 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-09-15lint/checkpatch.pl: Pull in coreboot fixesMartin Roth
This pulls in two fixes that were added to coreboot's checkpatch.pl script: - commit 82ef8ada (src/commonlib/lz4_wrapper: Correct inline asm for unaligned 64-bit copy): modify checkpatch.pl to ignore spaces before opening brackets when used in inline assembly. - commit ebef00fa (lint/checkpatch.pl: escape \{ in perl regex to fix warnings): Unescaped left brace in regex is deprecated, passed through in regex; Change-Id: Ia2c712c5b1bb5f67953a9098b5a076e31e3bd8d3 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/16348 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-09-04util/lint: Update to latest checkpatch.plStefan Reinauer
Taken from upstream Linux kernel. Change-Id: Id8c9d48b8ca3c7592dc4d78cfd092714bbbb2abf Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/15980 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
2016-08-19util/lint: Add a tool to verify a single newline at the end of filesMartin Roth
This takes way too long to run - currently about 30 seconds to look at the entire coreboot tree. Change-Id: I403934014b422528715ea95ff652babe5e18c88b Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/15976 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-08-02util/lint: Add a lint tool to find non-ascii & unprintable charsMartin Roth
This examines characters in coreboot's sourcecode to look for values that are not TAB, or in the range of space (0x20) to ~ (0x7F). It specifically excludes copyright lines so that names with high- ASCII characters are not flagged. Change-Id: I40f7e61fd403cbad19cf0746e2017c53e7379bf8 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/15979 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-06-24src/commonlib/lz4_wrapper: Correct inline asm for unaligned 64-bit copyBenjamin Barenblat
Rewrite inline assembly for ARMv7+ to correctly annotate inputs and outputs. On ARM GCC 6.1.1, this causes assembly output to change from the incorrect @ r0 is allocated to hold dst and x0 @ r1 is allocated to hold src and x1 ldr r0, [r1] @ clobbers dst! ldr r1, [r1, #4] str r0, [r0] str r1, [r0, #4] to the correct @ r0 is allocated to hold dst @ r1 is allocated to hold src and x1 @ r3 is allocated to hold x0 ldr r3, [r1] ldr r1, [r1, #4] str r3, [r0] str r1, [r0, #4] Also modify checkpatch.pl to ignore spaces before opening brackets when used in inline assembly. Change-Id: I255995f5e0a7b1a95375258755a93972c51d79b8 Signed-off-by: Benjamin Barenblat <bbaren@google.com> Reviewed-on: https://review.coreboot.org/15216 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2016-04-22lint/checkpatch.pl: escape \{ in perl regex to fix warningsAlexander Couzens
Fix warnings: Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE / at util/lint/checkpatch.pl line 3261. marked by <-- HERE in m/\(.*\){ <-- HERE / at util/lint/checkpatch.pl line 3750. marked by <-- HERE in m/do{ <-- HERE / at util/lint/checkpatch.pl line 3751. marked by <-- HERE in m/^\({ <-- HERE / at util/lint/checkpatch.pl line 4194. Change-Id: If0c1f07a16df9e6cd1c1393a31af8b8ea6a66b01 Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Reviewed-on: https://review.coreboot.org/14310 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-04-21util/lint: Find unsigned variables with no length specifiedMartin Roth
The coding guidelines say that all objects should have fully qualified types (unsigned int instead of unsigned). This script finds violations of that rule. Steps for the filter: 1) Find all lines in the coreboot tree that have the word 'unsigned' followed by a space. 2) Exclude directories that aren't in the include list or are specifically excluded. 3) Exclude files that aren't specifically included. 4) Filter out legimitate uses 'unsigned int' or 'unsigned long' for example. 5) Filter out lines that begin with '/*' or '*' Change-Id: I46213c6a168e6aafa29a50af814bf7e0fcd32eb6 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14269 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-04-21lint: Add check for amd & apple mainboard license headersMartin Roth
Change-Id: Idda4b7179e3e7b3f5b70be810b428b0651c1cd67 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14427 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-04-14util/lint: Update lint-stable-000-license-headersMartin Roth
Add all currently clean directories. Change-Id: Ibfb6432b485adb7fdc930f57ea0af4ff35921d37 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14332 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-04-13util/lint: update lint-000-license-headersMartin Roth
- Add some additional filters for files that do not require license headers. - Add an alternative wording for the BSD license that is used in several files. - Add string for dummy files - Stop checking if there are no files left. - Remove 'local' keyword which is not posix compliant. Change-Id: I2ed1b0572b5fbe84ea86173b7ec2106454399547 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14324 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-04-13lint/lint-stable-004-style-labels: Update scriptMartin Roth
- Look at entire tree instead of just the current commit. This was causing the test to overlook some issues that were already in the tree. - If git is on the system, and the code is in a git repo, use the 'git ls-files' command to find the files to examine. If those conditions aren't met, fall back to using the find command. - Wrap the command so it's easier to read. Change-Id: I3dce219a29ffb1ae56a31318b995e3ba8ea43e70 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14194 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-04-10lint/check_lint_tests: Add script that will break all stable testsMartin Roth
Add a script to help us verify that our lint tests are working. This isn't finished, because it should test all of the failure modes. Some of the tests, 008-kconfig in particular have a lot of ways that they can fail. Currently the Kconfig test is triggered by removing the board name file in test 006. This removes the only place the config option for that board name is located. Change-Id: If01c6daf1c99d097a19995b4befae90a3b5db2d6 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14198 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-03-29lint: Update board status script to look at the whole treeMartin Roth
The board status script wasn't checking the entire tree to make sure that all boards had board_info.txt files. Also it would only print out the first issue that was found. Change-Id: I5f2fa9e564c805c6dbee7a35cab80c1c342567a5 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14118 Tested-by: build bot (Jenkins) Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
2016-03-05lint-kconfig: pipe stderr to stdout to catch script errorsMartin Roth
Because the perl error messages go to stderr, we were not catching these on the build server. If the script has an issue, we want to know immediately, so change the bash script that calls into the perl lint tool to pipe these to stdout. Change-Id: Ieeec9ccbd59177cfd1859a9738a4ee1fab803d28 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13877 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-03-03kconfig_lint: make sure if and endif statements are balancedMartin Roth
In Kconfig files, the 'if' and 'endif' statements need to match up. A file can't start an if statement that's completed in the next file. Add a check as the files are being parsed to make sure that they match up correctly. Change-Id: If51207ea037089ab84c768e5a868270468cf4c4f Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13876 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-02-24kconfig_lint: Fix checks when running in taint modeMartin Roth
The builders run perl scripts in taint mode, and some of the checks that the kconfig lint script were running were tainted, causing the script to terminate early when running on the servers. This checks to see if taint mode is enabled, and untaints the path if it is. All external tools (git & grep) must be in /bin, /usr/bin, or /usr/local/bin. This also removes the check for unused kconfig files if taint mode is enabled. Change-Id: I8d1e1c32275f759d085759fb5d8a6c85d4f99539 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13751 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
2016-02-16lint: Make sure site-local isn't committed to coreboot repoMartin Roth
Change-Id: I1dc9469e3d001fe0d5b0517d45679b056586b5b3 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13556 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-02-10kconfig_lint: update kconfig lint shell scriptsMartin Roth
- Add lint-stable script with just error checking - Enable warnings in addition to errors in non-stable test. - Use git grep if the code is in a git repo now that exclusions are working. - Check for perl, and ask the user to install it if it isn't available. Change-Id: Ie60d21f4ef8a61d879f116eb2056eb805b0a55f2 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13542 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
2016-02-09kconfig_lint: demote 'always defined' errors to warningsMartin Roth
To be able to run this as a lint-stable test, demote these to warnings for now. After the current CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL issues get fixed, these can be promoted again. Change-Id: I1432980eb0c871fc61c12dcc351f8d46513a7965 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13541 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-02-09kconfig_lint: Check for IS_ENABLED used on symbols without CONFIG_Martin Roth
This looks at the coreboot codebase for the IS_ENABLED macro, and gives an error if there is a symbol used without the CONFIG_ prefix. This only works for symbols of type bool. A future check will be added for all symbols, but that will take a significant amount of time to run, because each symbol will need to be searched for individually. Change-Id: I92f2de2d231610d1a788da965f21966d89c2f25c Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13538 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-02-07lint: test for assembler dialect switchesPatrick Georgi
We prefer the default AT&T dialect on x86 Change-Id: I7a5778c82ab5df6e971dfc73e98373893cfeeb92 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/13135 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
2016-02-02lint: Check license headers for both paragraphs of the GPLMartin Roth
If the GPLv2 or GPLv2+ license header is being used on a coreboot file, make sure it has two paragraphs as specified by the Common License Header section in the developer guidelines in the coreboot wiki. Change-Id: Ifffa0fa7272f5a4b129d4b7b8a515f8795bc2401 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13119 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Add readme documentMartin Roth
The readme describes the operation and usage of kconfig_lint. It also lists all the notes, warnings, and errors that kconfig_lint looks for. Change-Id: I873f394ff93fce42cd9638cbbad6134f1aef3a6a Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13464 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: add comments and whitespace fixes.Martin Roth
No functional changes. Change-Id: I40284b68ddda7e19741c5306a8c74761c00e4b35 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13463 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Skip temp files when looking for unused Kconfig files.Martin Roth
Don't warn on Kconfig.orig and Kconfig~ files when trying to verify that all the Kconfig files in the coreboot source tree are being loaded. Change-Id: Ie7babe60b29735e5ccc5f93f4e42ad82dfb47044 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13462 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Update prompt structureMartin Roth
- The prompts were not getting incremented, so each prompt for a symbol would overwrite the previous. - Record the menu each prompt is in. Change-Id: Ia282a30344d5e135f4f2027be9aff0e49a4e5edb Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13461 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Add warning if tristate type is used in corebootMartin Roth
Although there's no reason we COULDN'T use tristate types, we haven't up to this point. If there's a good reason to use them in the future, this check can be removed. Change-Id: I5f1903341f522bc957e394bc0fd288ba1adab431 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13460 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: merge 'git grep' and 'grep' exclude dir and filesMartin Roth
The code had originally been using standard grep to look through the coreboot tree for Kconfig symbols. When this was switched to git grep, the --exclude-dir options didn't work, and nothing was added to exclude the directories that shouldn't be searched for symbols. This resulted in invalid warnings as it searched directories that had Kconfig symbols for other projects. This merges the exclusion list for both the regular and git versions of grep for consistent behavior. Change-Id: I7fed8b9fa827cb14f7373e7b774acc56e43cb6ff Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13459 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Don't look at IS_ENABLED() text in comments.Martin Roth
This fixes at least one kconfig_lint warning. Change-Id: I35edf57e90315a8372aaf3b41e923cd8dad7386a Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13458 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Exclude some Kconfig symbols from unused symbol checksMartin Roth
The configuration that coreboot uses for setting selected symbols typically involves a structure like this: config BLEH_SPECIFIC_OPTIONS def_bool y select SYMBOL This leads to an an extra kconfig symbol BLEH_SPECIFIC_OPTIONS that is never referenced by anything else, generating a warning. Since this is currently the construct that coreboot uses, filter it out of the warnings for now. Change-Id: I85a95e4c4e8469870c7f219f2a92955819845573 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13457 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: merge 'git grep' and 'grep' exclude dir and filesMartin Roth
The code had originally been using standard grep to look through the coreboot tree for Kconfig symbols. When this was switched to git grep, the --exclude-dir options didn't work, and nothing was added to exclude the directories that shouldn't be searched for symbols. This resulted in invalid warnings as it searched directories that had Kconfig symbols for other projects. This merges the exclusion list for both the regular and git versions of grep for consistent behavior. Change-Id: I69a1e0b30fecca152e02a511c82248b6091b3d8b Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13456 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30lint: Add a check for the executable bit being set on source codeMartin Roth
Change-Id: Ia51bd0fa742b2cb17f638c15d669ad1a7f65fefd Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13433 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)