In test/unit/legacy/BUILD
you can find examples for codechecker_test() and for compile_commands() rules.
For instance see targets codechecker_pass and compile_commands_pass.
Run all test Bazel targets:
bazel test ...After that you can find all artifacts in bazel-bin directory:
# All codechecker_pass artifacts
ls bazel-bin/test/unit/legacy/codechecker_pass/
# compile_commands.json for compile_commands_pass
cat bazel-bin/test/unit/legacy/compile_commands_pass/compile_commands.jsonThe FOSS tests
add these rules to upstream projects and analyze them in CI, which makes them
working end to end integration examples. Each project directory has an
init.sh that clones the project and appends the rules to its build files.
Trying the same by hand on zlib:
git clone https://github.com/madler/zlib.git
cd zlibbazel_dep(name = "rules_codechecker")
git_override(
module_name = "rules_codechecker",
remote = "https://github.com/Ericsson/rules_codechecker.git",
commit = "<latest commit id>",
)load("@rules_codechecker//:defs.bzl", "codechecker_test")
codechecker_test(
name = "check",
targets = [":z"],
)bazel test //:check --test_output=all