Skip to content

Commit

Permalink
[ci/cryptotest] Add bazel tag to skip test in nightly CI
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Dai <[email protected]>
  • Loading branch information
milesdai authored and moidx committed Dec 3, 2024
1 parent 54332ee commit d30491d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
| grep -v examples \
| grep -v penetrationtests \
> "$bazel_tests"
./bazelisk.sh test --build_tests_only --target_pattern_file="$bazel_tests"
./bazelisk.sh test --build_tests_only --test_tag_filters=-skip_in_nightly_ci --target_pattern_file="$bazel_tests"
- name: Run tests after ROM_EXT boot stage
if: success() || failure()
Expand All @@ -75,7 +75,7 @@ jobs:
| grep -v examples \
| grep -v penetrationtests \
> "$bazel_tests"
./bazelisk.sh test --build_tests_only --target_pattern_file="$bazel_tests"
./bazelisk.sh test --build_tests_only --test_tag_filters=-skip_in_nightly_ci --target_pattern_file="$bazel_tests"
- name: Publish bazel test results
if: success() || failure()
Expand Down
15 changes: 15 additions & 0 deletions sw/device/tests/crypto/cryptotest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ AES_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "aes_kat",
skip_in_nightly_ci = True,
test_args = AES_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/aes_nist_kat:harness",
test_vectors = AES_TESTVECTOR_TARGETS,
Expand Down Expand Up @@ -67,6 +68,7 @@ ECDSA_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "ecdsa_kat",
skip_in_nightly_ci = True,
test_args = ECDSA_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/ecdsa_kat:harness",
test_vectors = ECDSA_TESTVECTOR_TARGETS,
Expand Down Expand Up @@ -112,6 +114,7 @@ SHA256_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sha256_kat",
skip_in_nightly_ci = True,
test_args = SHA256_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA256_TESTVECTOR_TARGETS,
Expand All @@ -134,6 +137,7 @@ SHA384_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sha384_kat",
skip_in_nightly_ci = True,
test_args = SHA384_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA384_TESTVECTOR_TARGETS,
Expand All @@ -156,6 +160,7 @@ SHA512_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sha512_kat",
skip_in_nightly_ci = True,
test_args = SHA512_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA512_TESTVECTOR_TARGETS,
Expand Down Expand Up @@ -200,6 +205,7 @@ SHA3_256_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sha3_256_kat",
skip_in_nightly_ci = True,
test_args = SHA3_256_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA3_256_TESTVECTOR_TARGETS,
Expand All @@ -222,6 +228,7 @@ SHA3_384_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sha3_384_kat",
skip_in_nightly_ci = True,
test_args = SHA3_384_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA3_384_TESTVECTOR_TARGETS,
Expand All @@ -244,6 +251,7 @@ SHA3_512_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sha3_512_kat",
skip_in_nightly_ci = True,
test_args = SHA3_512_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA3_512_TESTVECTOR_TARGETS,
Expand All @@ -267,6 +275,7 @@ SHAKE128_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "shake128_kat",
skip_in_nightly_ci = True,
test_args = SHAKE128_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHAKE128_TESTVECTOR_TARGETS,
Expand All @@ -290,6 +299,7 @@ SHAKE256_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "shake256_kat",
skip_in_nightly_ci = True,
test_args = SHAKE256_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHAKE256_TESTVECTOR_TARGETS,
Expand Down Expand Up @@ -323,6 +333,7 @@ DRBG_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "drbg_kat",
skip_in_nightly_ci = True,
test_args = DRBG_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/drbg_kat:harness",
test_vectors = DRBG_TESTVECTOR_TARGETS,
Expand All @@ -340,6 +351,7 @@ HMAC_SHA256_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "hmac_sha256_kat",
skip_in_nightly_ci = True,
test_args = HMAC_SHA256_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hmac_kat:harness",
test_vectors = HMAC_SHA256_TESTVECTOR_TARGETS,
Expand All @@ -357,6 +369,7 @@ HMAC_SHA384_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "hmac_sha384_kat",
skip_in_nightly_ci = True,
test_args = HMAC_SHA384_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hmac_kat:harness",
test_vectors = HMAC_SHA384_TESTVECTOR_TARGETS,
Expand All @@ -374,6 +387,7 @@ HMAC_SHA512_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "hmac_sha512_kat",
skip_in_nightly_ci = True,
test_args = HMAC_SHA512_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hmac_kat:harness",
test_vectors = HMAC_SHA512_TESTVECTOR_TARGETS,
Expand Down Expand Up @@ -413,6 +427,7 @@ SPHINCSPLUS_TESTVECTOR_ARGS = " ".join([

cryptotest(
name = "sphincsplus_kat",
skip_in_nightly_ci = True,
test_args = SPHINCSPLUS_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/sphincsplus_kat:harness",
test_vectors = SPHINCSPLUS_TESTVECTOR_TARGETS,
Expand Down
7 changes: 6 additions & 1 deletion sw/device/tests/crypto/cryptotest/cryptotest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ CRYPTOTEST_EXEC_ENVS = {
"//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon",
}

def cryptotest(name, test_vectors, test_args, test_harness):
def cryptotest(name, test_vectors, test_args, test_harness, skip_in_nightly_ci = False):
"""A macro for defining a CryptoTest test case.
Args:
name: the name of the test.
test_vectors: the test vectors to use.
test_args: additional arguments to pass to the test.
test_harness: the test harness to use.
skip_in_nightly_ci: indicate if the test should be run in the nightly CI.
"""
tags = ["skip_in_nightly_ci"] if skip_in_nightly_ci else []
opentitan_test(
name = name,
fpga = fpga_params(
timeout = "long",
binaries = {"//sw/device/tests/crypto/cryptotest/firmware:firmware_fpga_cw310_test_rom": "firmware"},
data = test_vectors,
tags = tags,
test_cmd = """
--bootstrap={firmware}
""" + test_args,
Expand All @@ -46,6 +49,7 @@ def cryptotest(name, test_vectors, test_args, test_harness):
fpga_cw340 = fpga_params(
timeout = "long",
binaries = {"//sw/device/tests/crypto/cryptotest/firmware:firmware_fpga_cw340_test_rom": "firmware"},
tags = tags,
data = test_vectors,
test_cmd = """
--bootstrap={firmware}
Expand All @@ -56,6 +60,7 @@ def cryptotest(name, test_vectors, test_args, test_harness):
silicon = silicon_params(
timeout = "eternal",
binaries = {"//sw/device/tests/crypto/cryptotest/firmware:firmware_silicon_owner_sival_rom_ext": "firmware"},
tags = tags,
data = test_vectors,
test_cmd = """
--bootstrap={firmware}
Expand Down

0 comments on commit d30491d

Please sign in to comment.