diff options
author | Nikita Iashchenko <nikitai@google.com> | 2022-06-06 15:56:28 +0100 |
---|---|---|
committer | Nikita Iashchenko <nikitai@google.com> | 2022-06-08 11:50:22 +0000 |
commit | 9f15d94e4a1c5d065bcffafe4d8a278558ffce8d (patch) | |
tree | be10320523cccf404b8f387b4f435bb6783bcdaf /PREUPLOAD.cfg | |
parent | 60d965bbfe51055c528c752fedc16ef7560bf682 (diff) | |
download | art-9f15d94e4a1c5d065bcffafe4d8a278558ffce8d.tar.gz |
Add presubmit linter hook for failures.txt expectation files
This change is primarily targeted to reduce the number of failures that
can happen when failure expectation files for art buildbot are
modified, by adding a linter hook to check files ending with
'_failures.txt'. The example of the failure can be found here:
https://ci.chromium.org/ui/p/art/builders/ci/fugu-ndebug/2433/overview
Linter is written in java because vogar uses gson library with lenient
mode enabled to parse JSON expectations. This mode allows C-style
comments, unquoted keys and values, top level values of any type and
some other differences which make use of default jsonlint hook or a
simpler python script impossible.
This hook is filtering all changed files ending with '_failures.txt',
and passes them to a linter that parses those files with lenient mode;
and fails if JSON is malformed. Linter is compiled from source in a
temporary directory which is removed after checks.
Bug: 235103837
Test: art/tools/check_presubmit_json_expectations.sh \
$ANDROID_BUILD_TOP art/tools/*_failures.txt
Test: $ANDROID_BUILD_TOP/tools/repohooks/pre-upload.py
Change-Id: I8fc10bf39d1b8ced0ae88152a8e3a0dbf8e44035
Diffstat (limited to 'PREUPLOAD.cfg')
-rw-r--r-- | PREUPLOAD.cfg | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index b8ee3c525c..2182991cab 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -7,6 +7,8 @@ hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/c # so we don't need the custom runtests script and this check. check_libnativebridge_test_field = libnativebridge/tests/preupload_check_test_tag.sh ${PREUPLOAD_COMMIT_MESSAGE} ${PREUPLOAD_FILES} +check_expectation_jsons = tools/check_presubmit_json_expectations.sh ${REPO_ROOT} ${PREUPLOAD_FILES} + [Builtin Hooks] cpplint = true bpfmt = true |