diff options
author | 2020-08-12 09:32:05 -0700 | |
---|---|---|
committer | 2020-08-12 09:32:05 -0700 | |
commit | e4d3fb0f8ca159295bbacfdaee2b7c32489b5c6c (patch) | |
tree | 2f44bccb710e06f27ac9822f43bad6ead5367c5c | |
parent | 934898182204fced2cf9c7235770e9c592be7940 (diff) |
[infra][docs] Be more explicit about code coverage being supported for C/C++ only (#4284). (#4303)
* [infra][docs] Be more explicit about code coverage being supported for C/C++ only (#4284).
* fix typos and pass env variable
-rw-r--r-- | docs/advanced-topics/code_coverage.md | 10 | ||||
-rwxr-xr-x | infra/helper.py | 12 |
2 files changed, 18 insertions, 4 deletions
diff --git a/docs/advanced-topics/code_coverage.md b/docs/advanced-topics/code_coverage.md index 6e56c402..3b0acc26 100644 --- a/docs/advanced-topics/code_coverage.md +++ b/docs/advanced-topics/code_coverage.md @@ -9,9 +9,11 @@ permalink: /advanced-topics/code-coverage/ # Code Coverage {: .no_toc} -You can generate code coverage reports for your project using Clang source-based -code coverage. This page walks you through the basic steps. For more details, -see [Clang's documentation]. +For projects written in C/C++, you can generate code coverage reports using +Clang source-based code coverage. This page walks you through the basic steps. +For more details, see [Clang's documentation]. + +Code coverage reports generation for other languages is not supported yet. - TOC {:toc} @@ -124,4 +126,4 @@ coverage_extra_args: -ignore-filename-regex=.*crc.* -ignore-filename-regex=.*adl [Clang's documentation]: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html [gsutil tool]: https://cloud.google.com/storage/docs/gsutil_install -[llvm-cov tool]: https://llvm.org/docs/CommandGuide/llvm-cov.html
\ No newline at end of file +[llvm-cov tool]: https://llvm.org/docs/CommandGuide/llvm-cov.html diff --git a/infra/helper.py b/infra/helper.py index b1266c28..99d87112 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -58,6 +58,9 @@ CORPUS_BACKUP_URL_FORMAT = ( PROJECT_LANGUAGE_REGEX = re.compile(r'\s*language\s*:\s*([^\s]+)') +# Languages from project.yaml that have code coverage support. +LANGUAGES_WITH_COVERAGE_SUPPORT = ['c', 'c++'] + def main(): # pylint: disable=too-many-branches,too-many-return-statements,too-many-statements """Get subcommand from program arguments and do it.""" @@ -727,12 +730,21 @@ def coverage(args): if not check_project_exists(args.project_name): return 1 + project_language = _get_project_language(args.project_name) + if project_language not in LANGUAGES_WITH_COVERAGE_SUPPORT: + print( + 'ERROR: Project is written in %s, coverage for it is not supported yet.' + % project_language, + file=sys.stderr) + return 1 + if not args.no_corpus_download and not args.corpus_dir: if not download_corpora(args): return 1 env = [ 'FUZZING_ENGINE=libfuzzer', + 'FUZZING_LANGUAGE=%s' % project_language, 'PROJECT=%s' % args.project_name, 'SANITIZER=coverage', 'HTTP_PORT=%s' % args.port, |