@@ -61,6 +61,44 @@ opentitan_binary(
6161 ],
6262)
6363
64+ # ------------------------------------------------------------------------------
65+ # Coverage Generation for Cryptolib
66+ # ------------------------------------------------------------------------------
67+ # To run coverage manually, use the `ot_coverage` config. If you are running
68+ # multiple `bazel coverage` commands sequentially, you must concatenate the
69+ # resulting `bazel-out/_coverage/lcov_files.tmp` into a single master list
70+ # between runs, as Bazel will overwrite it each time.
71+ #
72+ # 1. Run Unit Tests
73+ # bazel coverage --config=ot_coverage --nocache_test_results --test_output=errors \
74+ # //sw/device/lib/crypto/impl:impl_unittest_suite \
75+ # //sw/device/lib/base:base_unittest_suite \
76+ # //sw/device/tests/crypto:otcrypto_coverage_view
77+ #
78+ # 2. Run Device Tests
79+ # Note: This requires the Google A1 silicon provisioning git repository to be
80+ # available (PROV_EXTS_DIR). To run on FPGA instead, drop the two `--//signing`
81+ # flags and swap the suffix below to `fpga_cw340_sival_rom_ext`.
82+ # Note that the CW340 can provide garbled outputs during the KATs due to SPI flakyness,
83+ # hence why the silicon version is shown instead.
84+ #
85+ # bazel coverage \
86+ # --//signing:token=@provisioning_exts//shared/tokens:cloud_kms_gb \
87+ # --//signing:appkey=@provisioning_exts//shared/rom_ext/gb/keys:keyset \
88+ # --config=ot_coverage --nocache_test_results --test_output=errors \
89+ # --test_arg=--timeout --test_arg=100s \
90+ # //sw/device/tests/crypto/cryptotest:crypto_kat_test_suite_silicon_owner_gb_rom_ext \
91+ # //sw/device/lib/base:base_functest_suite_silicon_owner_gb_rom_ext \
92+ # //sw/device/lib/crypto/drivers:drivers_test_suite_silicon_owner_gb_rom_ext \
93+ # //sw/device/tests/crypto:cryptolib_test_suite_silicon_owner_gb_rom_ext \
94+ # //sw/device/tests/crypto:cryptolib_keygen_test_suite_silicon_owner_gb_rom_ext \
95+ # //sw/device/tests/crypto:otcrypto_coverage_view
96+ #
97+ # 3. Collect and Bundle Viewer
98+ # Note: Change lcov_files to the concatenated master list if running multiple tests.
99+ # python3 -m util.coverage.viewer.collect --lcov_files=bazel-out/_coverage/lcov_files.tmp
100+ # python3 -m util.coverage.viewer.bundler --output /tmp/viewer.html
101+ # ------------------------------------------------------------------------------
64102coverage_view_test (
65103 name = "otcrypto_coverage_view" ,
66104 elf = "otcrypto_export_size" ,
0 commit comments