diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1affbbda7dbe2..11f533e3a69e7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -49,6 +49,7 @@ jobs: - publish: $(Pipeline.Workspace)/opentitan-repo.tar.gz artifact: opentitan-repo displayName: Upload repository + - job: lint displayName: Quality (quick lint) # Run code quality checks (quick lint) @@ -182,23 +183,13 @@ jobs: dependsOn: lint condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyCdcChanges'], '0')) pool: ci-public - variables: - - name: bazelCacheGcpKeyPath - value: '' steps: - template: ci/checkout-template.yml - template: ci/install-package-dependencies.yml - - task: DownloadSecureFile@1 - condition: eq(variables['Build.SourceBranchName'], 'master') - name: bazelCacheGcpKey - inputs: - secureFile: "bazel_cache_gcp_key.json" - # Set the remote cache GCP key path - - bash: echo "##vso[task.setvariable variable=bazelCacheGcpKeyPath]$(bazelCacheGcpKey.secureFilePath)" - condition: eq(variables['Build.SourceBranchName'], 'master') - displayName: GCP key path + - template: ci/load-bazel-cache-write-creds.yml - bash: | set -x -e + # Check the entire build graph for conflicts in loading or analysis # phases. For context, see issue #18726. # First, test with an empty bitstream cache entry. @@ -217,14 +208,13 @@ jobs: # shallow exclusion; tests deeper under //hw will still be found. # * It excludes targets that depend on bitstream_splice rules, since the # environment does not have access to Vivado. - export GCP_BAZEL_CACHE_KEY=$(bazelCacheGcpKeyPath) TARGET_PATTERN_FILE=target_pattern.txt echo //... > "${TARGET_PATTERN_FILE}" echo -//quality/... >> "${TARGET_PATTERN_FILE}" echo -//sw/otbn/crypto/... >> "${TARGET_PATTERN_FILE}" echo -//third_party/riscv-compliance/... >> "${TARGET_PATTERN_FILE}" echo -//hw:all >> "${TARGET_PATTERN_FILE}" - ./bazelisk.sh cquery \ + ci/bazelisk.sh cquery \ --noinclude_aspects \ --output=starlark \ --starlark:expr='"-{}".format(target.label)' \ @@ -250,8 +240,8 @@ jobs: ROM_REAL_TARGETS="//sw/device/silicon_creator/rom:package_real" ROM_FAKE_TARGETS="//sw/device/silicon_creator/rom:package_fake" QUERY_CMD_ARGS=(outquery-all --noinclude_aspects --noimplicit_deps) - ROM_REAL_FILES=($(./bazelisk.sh "${QUERY_CMD_ARGS[@]}" "${ROM_REAL_TARGETS}" | sort | uniq)) - ROM_FAKE_FILES=($(./bazelisk.sh "${QUERY_CMD_ARGS[@]}" "${ROM_FAKE_TARGETS}" | sort | uniq)) + ROM_REAL_FILES=($(ci/bazelisk.sh "${QUERY_CMD_ARGS[@]}" "${ROM_REAL_TARGETS}" | sort | uniq)) + ROM_FAKE_FILES=($(ci/bazelisk.sh "${QUERY_CMD_ARGS[@]}" "${ROM_FAKE_TARGETS}" | sort | uniq)) cp -Lvt "${ROM_TARGET}" "${ROM_FAKE_FILES[@]}" "${ROM_REAL_FILES[@]}" - template: ci/upload-artifacts-template.yml parameters: @@ -263,21 +253,10 @@ jobs: timeoutInMinutes: 120 dependsOn: sw_build pool: ci-public - variables: - - name: bazelCacheGcpKeyPath - value: '' steps: - template: ci/checkout-template.yml - template: ci/install-package-dependencies.yml - - task: DownloadSecureFile@1 - condition: eq(variables['Build.SourceBranchName'], 'master') - name: bazelCacheGcpKey - inputs: - secureFile: "bazel_cache_gcp_key.json" - # Set the remote cache GCP key path - - bash: echo "##vso[task.setvariable variable=bazelCacheGcpKeyPath]$(bazelCacheGcpKey.secureFilePath)" - condition: eq(variables['Build.SourceBranchName'], 'master') - displayName: GCP key path + - template: ci/load-bazel-cache-write-creds.yml - download: current artifact: target_pattern_file - bash: | @@ -320,24 +299,12 @@ jobs: pool: ci-public timeoutInMinutes: 240 dependsOn: lint - variables: - - name: bazelCacheGcpKeyPath - value: '' steps: - template: ci/checkout-template.yml - template: ci/install-package-dependencies.yml - - task: DownloadSecureFile@1 - condition: eq(variables['Build.SourceBranchName'], 'master') - name: bazelCacheGcpKey - inputs: - secureFile: "bazel_cache_gcp_key.json" - - bash: echo "##vso[task.setvariable variable=bazelCacheGcpKeyPath]$(bazelCacheGcpKey.secureFilePath)" - condition: eq(variables['Build.SourceBranchName'], 'master') - displayName: GCP key path - # Set the remote cache GCP key path + - template: ci/load-bazel-cache-write-creds.yml - bash: | set -x -e - export GCP_BAZEL_CACHE_KEY=$(bazelCacheGcpKeyPath) ci/scripts/run-verilator-tests.sh displayName: Build & execute tests - template: ci/publish-bazel-test-results.yml @@ -350,7 +317,7 @@ jobs: - bash: | . util/build_consts.sh mkdir -p "$BIN_DIR/hw/top_earlgrey/" - cp $(./bazelisk.sh outquery-build.verilator //sw/device/tests:uart_smoketest_sim_verilator) \ + cp $(ci/bazelisk.sh outquery-build.verilator //sw/device/tests:uart_smoketest_sim_verilator) \ "$BIN_DIR/hw/top_earlgrey/Vchip_earlgrey_verilator" displayName: Copy verilated binary to $BIN_DIR - template: ci/upload-artifacts-template.yml @@ -377,6 +344,7 @@ jobs: parameters: downloadPartialBuildBinFrom: - chip_englishbreakfast_verilator + - template: ci/load-bazel-cache-write-creds.yml - bash: | . util/build_consts.sh ci/scripts/run-english-breakfast-verilator-tests.sh @@ -438,15 +406,7 @@ jobs: steps: - template: ci/checkout-template.yml - template: ci/install-package-dependencies.yml - - task: DownloadSecureFile@1 - condition: eq(variables['Build.SourceBranchName'], 'master') - name: bazelCacheGcpKey - inputs: - secureFile: "bazel_cache_gcp_key.json" - - bash: echo "##vso[task.setvariable variable=bazelCacheGcpKeyPath]$(bazelCacheGcpKey.secureFilePath)" - condition: eq(variables['Build.SourceBranchName'], 'master') - displayName: GCP key path - # Set the remote cache GCP key path + - template: ci/load-bazel-cache-write-creds.yml - bash: | ci/bazelisk.sh test --test_tag_filters=-nightly //sw/otbn/crypto/... displayName: Execute tests @@ -546,7 +506,7 @@ jobs: bucketURI: "gs://opentitan-bitstreams/earlgrey_es_sival" - job: execute_sival_fpga_tests_cw310 - displayName: CW310 SiVal Tests + displayName: CW310 SiVal non-ROM_EXT Tests pool: name: $(fpga_pool) demands: BOARD -equals cw310 @@ -561,23 +521,38 @@ jobs: - template: ci/download-artifacts-template.yml parameters: downloadPartialBuildBinFrom: - - chip_earlgrey_cw310 - chip_earlgrey_cw310_hyperdebug - sw_build + - template: ci/load-bazel-cache-write-creds.yml + # We run the update command twice to workaround an issue with udev on the container, + # where rusb cannot dynamically update its device list in CI (udev is not completely + # functional). If the device is in normal mode, the first thing that opentitantool + # does is to switch it to DFU mode and wait until it reconnects. This reconnection is + # never detected. But if we run the tool another time, the device list is queried again + # and opentitantool can finish the update. The device will now reboot in normal mode + # and work for the hyperdebug job. + - bash: | + ci/bazelisk.sh run \ + //sw/host/opentitantool:opentitantool -- \ + --interface=hyperdebug_dfu transport update-firmware \ + || ci/bazelisk.sh run \ + //sw/host/opentitantool:opentitantool -- \ + --interface=hyperdebug_dfu transport update-firmware || true + displayName: "Update the hyperdebug firmware" - bash: | set -e . util/build_consts.sh module load "xilinx/vivado/$(VIVADO_VERSION)" - ci/scripts/run-fpga-tests.sh hyper310 cw310_sival,-broken || { res=$?; echo "To reproduce failures locally, follow the instructions at https://opentitan.org/book/doc/getting_started/setup_fpga.html#reproducing-fpga-ci-failures-locally"; exit "${res}"; } + ci/scripts/run-fpga-tests.sh hyper310 cw310_sival_but_not_rom_ext_tests || { res=$?; echo "To reproduce failures locally, follow the instructions at https://opentitan.org/book/doc/getting_started/setup_fpga.html#reproducing-fpga-ci-failures-locally"; exit "${res}"; } displayName: Execute tests - template: ci/publish-bazel-test-results.yml -- job: execute_hyperdebug_tests_cw310 - displayName: Hyperdebug CW310 Tests (Experimental) +- job: execute_sival_rom_ext_fpga_tests_cw310 + displayName: CW310 SiVal ROM_EXT Tests pool: name: $(fpga_pool) demands: BOARD -equals cw310 - timeoutInMinutes: 60 + timeoutInMinutes: 45 dependsOn: - chip_earlgrey_cw310_hyperdebug - sw_build @@ -590,8 +565,9 @@ jobs: downloadPartialBuildBinFrom: - chip_earlgrey_cw310_hyperdebug - sw_build - # We run the update command twice to workaround an issue with udev on the container. - # Where rusb cannot dynamically update its device list in CI (udev is not completely + - template: ci/load-bazel-cache-write-creds.yml + # We run the update command twice to workaround an issue with udev on the container, + # where rusb cannot dynamically update its device list in CI (udev is not completely # functional). If the device is in normal mode, the first thing that opentitantool # does is to switch it to DFU mode and wait until it reconnects. This reconnection is # never detected. But if we run the tool another time, the device list is queried again @@ -609,7 +585,7 @@ jobs: set -e . util/build_consts.sh module load "xilinx/vivado/$(VIVADO_VERSION)" - ci/scripts/run-fpga-tests.sh hyper310 hyper310 || { res=$?; echo "To reproduce failures locally, follow the instructions at https://opentitan.org/book/doc/getting_started/setup_fpga.html#reproducing-fpga-ci-failures-locally"; exit "${res}"; } + ci/scripts/run-fpga-tests.sh hyper310 cw310_sival_rom_ext || { res=$?; echo "To reproduce failures locally, follow the instructions at https://opentitan.org/book/doc/getting_started/setup_fpga.html#reproducing-fpga-ci-failures-locally"; exit "${res}"; } displayName: Execute tests - template: ci/publish-bazel-test-results.yml @@ -629,6 +605,7 @@ jobs: downloadPartialBuildBinFrom: - chip_earlgrey_cw340 - sw_build + - template: ci/load-bazel-cache-write-creds.yml - bash: | set -e . util/build_consts.sh @@ -655,6 +632,7 @@ jobs: downloadPartialBuildBinFrom: - chip_earlgrey_cw310 - sw_build + - template: ci/load-bazel-cache-write-creds.yml - bash: | set -e . util/build_consts.sh diff --git a/bazelisk.sh b/bazelisk.sh index 7ba3153f71757..9b4e3e0c94109 100755 --- a/bazelisk.sh +++ b/bazelisk.sh @@ -93,10 +93,15 @@ function outquery_starlark_expr() { esac } +# Arguments: +# $qexpr: starlark expression - see `outquery_starlark_expr` +# $name: name of an array containing Bazel arguments that should come _before_ +# the subcommand (e.g. `--bazelrc=...`). function do_outquery() { local qexpr="$1" shift - "$file" cquery "$@" \ + + "$file" "${pre_cmd_args[@]}" cquery "$@" \ --output=starlark --starlark:expr="$qexpr" \ --ui_event_filters=-info --noshow_progress } @@ -121,6 +126,14 @@ function main() { fi fi + # Shift all flags (starting with `-`) that come before the subcommand + # into an array. + pre_cmd_args=() + while [[ "${1-}" == -* ]]; do + pre_cmd_args+=("$1") + shift + done + case "${1-}" in outquery*) # The custom 'outquery' command can be used to query bazel for the @@ -150,13 +163,13 @@ function main() { local qexpr outfile qexpr="$(outquery_starlark_expr outquery)" outfile=$(do_outquery "$qexpr" "$@") - "$file" build "$@" + "$file" "${pre_cmd_args[@]}" build "$@" # shellcheck disable=SC2059 # We are intentionally using $command_template as a format string. eval "$(printf "$command_template" "$outfile")" ;; *) - exec "$file" "$@" + exec "$file" "${pre_cmd_args[@]}" "$@" ;; esac } diff --git a/ci/azure-pipelines-nightly.yml b/ci/azure-pipelines-nightly.yml index 67bbb3760aa70..ef30a878764d3 100644 --- a/ci/azure-pipelines-nightly.yml +++ b/ci/azure-pipelines-nightly.yml @@ -82,7 +82,7 @@ jobs: --build_tests_only \ --test_tag_filters=-broken \ --test_output=errors \ - $(bash ./bazelisk.sh query 'attr("tags", "hyper310", tests(//...))') + $(bash ./bazelisk.sh query 'attr("tags", "cw310_sival", tests(//...))') displayName: "Run all the hyperdebug tests" - job: slow_otbn_crypto_tests diff --git a/ci/bazelisk.sh b/ci/bazelisk.sh index 89722b1e91639..756f2d19a1615 100755 --- a/ci/bazelisk.sh +++ b/ci/bazelisk.sh @@ -11,18 +11,19 @@ if [[ -n "${PWD_OVERRIDE}" ]]; then cd "${PWD_OVERRIDE}" || exit fi -echo "Running bazelisk in $(pwd)." +echo "Running bazelisk in $(pwd)." >&2 # An additional bazelrc must be synthesized to specify precisely how to use the # GCP bazel cache. +GCP_CREDS_FILE="$GCP_BAZEL_CACHE_KEY_SECUREFILEPATH" GCP_BAZELRC="$(mktemp /tmp/XXXXXX.bazelrc)" trap 'rm ${GCP_BAZELRC}' EXIT -if [[ -n "${GCP_BAZEL_CACHE_KEY}" && -f "${GCP_BAZEL_CACHE_KEY}" ]]; then - echo "Applying GCP cache key; will upload to the cache." - echo "build --google_credentials=${GCP_BAZEL_CACHE_KEY}" >> "${GCP_BAZELRC}" +if [[ -n "$GCP_CREDS_FILE" && -f "$GCP_CREDS_FILE" ]]; then + echo "Applying GCP cache key; will upload to the cache." >&2 + echo "build --google_credentials=${GCP_CREDS_FILE}" >> "${GCP_BAZELRC}" else - echo "No key/invalid path to key. Download from cache only." + echo "No key/invalid path to key. Download from cache only." >&2 echo "build --remote_upload_local_results=false" >> "${GCP_BAZELRC}" fi diff --git a/ci/load-bazel-cache-write-creds.yml b/ci/load-bazel-cache-write-creds.yml new file mode 100644 index 0000000000000..e413b287e285c --- /dev/null +++ b/ci/load-bazel-cache-write-creds.yml @@ -0,0 +1,17 @@ +# Copyright lowRISC contributors. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +# Azure Pipelines template for downloading a "secure file" containing the write +# credentials for a GCP bucket where we store a Bazel cache. +# +# The path to the downloaded file is automatically stored in an environment +# variable `GCP_BAZEL_CACHE_KEY_SECUREFILEPATH`. This file is loaded by the +# `ci/bazelisk.sh` script. + +steps: + - task: DownloadSecureFile@1 + condition: eq(variables['Build.SourceBranchName'], 'master') + name: GCP_BAZEL_CACHE_KEY + inputs: + secureFile: "bazel_cache_gcp_key.json" diff --git a/ci/scripts/check-bazel-banned-rules.sh b/ci/scripts/check-bazel-banned-rules.sh index ef605c7b213be..7ec3da8733910 100755 --- a/ci/scripts/check-bazel-banned-rules.sh +++ b/ci/scripts/check-bazel-banned-rules.sh @@ -6,7 +6,7 @@ set -e -GIT_REPOS=$(./bazelisk.sh query "kind('(new_)?git_repository', //external:*)") +GIT_REPOS=$(ci/bazelisk.sh query "kind('(new_)?git_repository', //external:*)") if [[ ${GIT_REPOS} ]]; then echo "Bazel's 'git_repository' rule is insecure and incompatible with OpenTitan's airgapping strategy." echo "Please replace $GIT_REPOS with our 'http_archive_or_local' rule and set a sha256 so it can be canonically reproducible." diff --git a/ci/scripts/check-bazel-tags.sh b/ci/scripts/check-bazel-tags.sh index 915432cdca635..9a4df57fdd780 100755 --- a/ci/scripts/check-bazel-tags.sh +++ b/ci/scripts/check-bazel-tags.sh @@ -25,7 +25,7 @@ check_empty () { # This check ensures OpenTitan software can be built with a wildcard without # waiting for Verilator using --build_tag_filters=-verilator -untagged=$(./bazelisk.sh query \ +untagged=$(ci/bazelisk.sh query \ "rdeps( //..., //hw:verilator diff --git a/ci/scripts/check-licence-headers.sh b/ci/scripts/check-licence-headers.sh index 220f683974d28..533120ed89e1d 100755 --- a/ci/scripts/check-licence-headers.sh +++ b/ci/scripts/check-licence-headers.sh @@ -30,7 +30,7 @@ set -o pipefail (for F in $(git diff --name-only --diff-filter=ACMRTUXB "$merge_base"); do echo "--test_arg=\"$F\"" done)| \ - xargs -r ./bazelisk.sh test //quality:license_check --test_output=streamed || { + xargs -r ci/bazelisk.sh test //quality:license_check --test_output=streamed || { echo >&2 -n "##vso[task.logissue type=error]" echo >&2 "Licence header check failed." diff --git a/ci/scripts/check-module-ids.sh b/ci/scripts/check-module-ids.sh index 246822491b00a..370d04e8bff32 100755 --- a/ci/scripts/check-module-ids.sh +++ b/ci/scripts/check-module-ids.sh @@ -24,7 +24,7 @@ query_elfs=' )' target_file=$(mktemp) trap 'rm -f "$target_file"' EXIT -./bazelisk.sh query "$query_elfs" >"$target_file" +ci/bazelisk.sh query "$query_elfs" >"$target_file" # We now ask bazel to build all targets but we also add the module ID checker aspect # and we query the corresponding output group to force bazel to run the checks. ./ci/bazelisk.sh build \ diff --git a/ci/scripts/clang-format.sh b/ci/scripts/clang-format.sh index 288c3f81b3b16..f23f3fb7d7858 100755 --- a/ci/scripts/clang-format.sh +++ b/ci/scripts/clang-format.sh @@ -28,4 +28,4 @@ set -o pipefail (for F in $(git diff --name-only "$merge_base" -- "*.cpp" "*.cc" "*.c" "*.h" ':!*/vendor/*'); do echo "--test_arg=\"$F\"" done) | \ - xargs -r ./bazelisk.sh test //quality:clang_format_check --test_output=streamed + xargs -r ci/bazelisk.sh test //quality:clang_format_check --test_output=streamed diff --git a/ci/scripts/get-bitstream-strategy.sh b/ci/scripts/get-bitstream-strategy.sh index 45e67dfe6824e..f71e480c67d76 100755 --- a/ci/scripts/get-bitstream-strategy.sh +++ b/ci/scripts/get-bitstream-strategy.sh @@ -33,12 +33,12 @@ else fi # Retrieve the most recent bitstream at or before HEAD. -BITSTREAM="--refresh HEAD" ./bazelisk.sh build @bitstreams//:manifest +BITSTREAM="--refresh HEAD" ci/bazelisk.sh build @bitstreams//:manifest # Find the bitstream commit from the manifest file. manifest_file=$(ci/scripts/target-location.sh @bitstreams//:manifest) -bitstream_commit=$(./bazelisk.sh run //util/py/scripts:get_bitstream_build_id \ +bitstream_commit=$(ci/bazelisk.sh run //util/py/scripts:get_bitstream_build_id \ -- --manifest ${manifest_file} \ --schema ${REPO_TOP}/rules/scripts/bitstreams_manifest.schema.json \ --design ${bitstream_design}) diff --git a/ci/scripts/lib/bazel_query.py b/ci/scripts/lib/bazel_query.py index e6fbbf2d54571..ca9f944ca0a8d 100644 --- a/ci/scripts/lib/bazel_query.py +++ b/ci/scripts/lib/bazel_query.py @@ -108,7 +108,7 @@ def query(self, query: str) -> List[str]: return self._backend(query) bazel = subprocess.run( - ["./bazelisk.sh", "query", "--output=label", query], + ["ci/bazelisk.sh", "query", "--output=label", query], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, encoding='utf-8', diff --git a/ci/scripts/run-fpga-tests.sh b/ci/scripts/run-fpga-tests.sh index 8dfbcba5f199e..0419063860d31 100755 --- a/ci/scripts/run-fpga-tests.sh +++ b/ci/scripts/run-fpga-tests.sh @@ -9,14 +9,13 @@ set -e . util/build_consts.sh if [ $# == 0 ]; then - echo >&2 "Usage: run-fpga-tests.sh " - echo >&2 "E.g. ./run-fpga-tests.sh cw310 cw310_rom" - echo >&2 "E.g. ./run-fpga-tests.sh cw340 cw340_rom cw340_test_rom" + echo >&2 "Usage: run-fpga-tests.sh " + echo >&2 "E.g. ./run-fpga-tests.sh cw310 manuf" + echo >&2 "E.g. ./run-fpga-tests.sh cw310 cw310_rom_tests" exit 1 fi fpga="$1" -shift -fpga_tags=("$@") +fpga_tags="$2" # Copy bitstreams and related files into the cache directory so Bazel will have # the corresponding targets in the @bitstreams workspace. @@ -45,14 +44,61 @@ trap 'ci/bazelisk.sh run //sw/host/opentitantool -- --rcfile= --interface=${fpga ci/bazelisk.sh run //sw/host/opentitantool -- --rcfile= --interface="$fpga" --logging debug fpga set-pll || true ci/bazelisk.sh run //sw/host/opentitantool -- --rcfile= --interface="$fpga" fpga clear-bitstream -for tag in "${fpga_tags[@]}"; do - ci/bazelisk.sh test //... @manufacturer_test_hooks//...\ - --define DISABLE_VERILATOR_BUILD=true \ - --nokeep_going \ - --test_tag_filters="${tag}",-broken,-skip_in_ci \ - --test_timeout_filters=short,moderate \ - --test_output=all \ - --build_tests_only \ - --define "$fpga"=lowrisc \ - --flaky_test_attempts=2 -done +pattern_file=$(mktemp) +# Recognize special test set names, otherwise we interpret it as a list of tags. +test_args="" +echo "tags: ${fpga_tags}" +if [ "${fpga_tags}" == "cw310_sival_but_not_rom_ext_tests" ] +then + # Only consider tests that are tagged `cw310_sival` but not tagged `cw310_sival_rom_ext`. + # The difficulty is that, technically, they are different tests since `opentitan_test` creates + # one target for each execution environment. The following query relies on the existence + # of the test suite created by `opentitan_test` that depends on all per-exec-env tests. + ci/bazelisk.sh query \ + " + `# Find all test tagged cw310_sival that are dependencies of the test suite identified` + attr( + \"tags\", + \"cw310_sival([^_]|$)\", + deps( + `# Find all test suites depending on a test tagged cw310_sival` \ + kind( + \"test_suite\", + rdeps( + //..., + `# Find all tests tagged cw310_sival` + attr(\"tags\",\"cw310_sival([^_]|$)\", //...), + 1 + ) + ) + except + `# Remove all test suites depending on a test tagged cw310_sival_rom_ext` + rdeps( + //..., + `# Find all tests tagged cw310_sival_rom_ext` + attr(\"tags\",\"cw310_sival_rom_ext\", //...), + 1 + ), + 1 + ) + ) + " \ + > "${pattern_file}" + # We need to remove tests tagged as manual since we are not using a wildcard target. + test_args="${test_args} --test_tag_filters=-broken,-skip_in_ci,-manual" +else + test_args="${test_args} --test_tag_filters=${fpga_tags},-broken,-skip_in_ci" + echo "//..." > "${pattern_file}" + echo "@manufacturer_test_hooks//..." >> "${pattern_file}" +fi + +ci/bazelisk.sh test \ + --define DISABLE_VERILATOR_BUILD=true \ + --nokeep_going \ + --test_timeout_filters=short,moderate \ + --test_output=all \ + --build_tests_only \ + --define "$fpga"=lowrisc \ + --flaky_test_attempts=2 \ + --target_pattern_file="${pattern_file}" \ + ${test_args} diff --git a/ci/scripts/rust-format.sh b/ci/scripts/rust-format.sh index 557bb15fdf9d0..bffd0ff7f97b3 100755 --- a/ci/scripts/rust-format.sh +++ b/ci/scripts/rust-format.sh @@ -27,7 +27,7 @@ trap 'echo "code failed rustfmt_check fix with ./bazelisk.sh run //quality:rustf set -o pipefail if ! git diff --quiet $merge_base -- "*.rs" ':!*/vendor/*'; then echo "Rust files changed, running Rust lint checks" - ./bazelisk.sh test //quality:rustfmt_check --test_output=streamed + ci/bazelisk.sh test //quality:rustfmt_check --test_output=streamed else echo "Rust files unchanged, skipping Rust lint checks" fi diff --git a/hw/top_earlgrey/BUILD b/hw/top_earlgrey/BUILD index 98a960a4e0561..420af0a08819c 100644 --- a/hw/top_earlgrey/BUILD +++ b/hw/top_earlgrey/BUILD @@ -71,6 +71,7 @@ fpga_cw310( base = ":fpga_cw310", base_bitstream = "//hw/bitstream:bitstream", exec_env = "fpga_cw310_test_rom", + openocd_adapter_config = "//third_party/openocd:jtag_olimex_cfg", otp = "//hw/ip/otp_ctrl/data:img_rma", otp_mmi = "//hw/bitstream:otp_mmi", param = { diff --git a/rules/opentitan/cc.bzl b/rules/opentitan/cc.bzl index 55893260f35a8..e926338726f46 100644 --- a/rules/opentitan/cc.bzl +++ b/rules/opentitan/cc.bzl @@ -422,6 +422,14 @@ opentitan_test = rv_rule( allow_files = True, cfg = "exec", ), + "needs_jtag": attr.bool( + default = False, + doc = "JTAG is required for this test", + ), + "openocd_adapter_config": attr.label( + allow_single_file = True, + doc = "OpenOCD adapter configuration override for this test", + ), "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), }.items()), fragments = ["cpp"], diff --git a/rules/opentitan/defs.bzl b/rules/opentitan/defs.bzl index 7e1c8ce1d797d..7def020b2e499 100644 --- a/rules/opentitan/defs.bzl +++ b/rules/opentitan/defs.bzl @@ -15,17 +15,14 @@ load( ) load( "@lowrisc_opentitan//rules/opentitan:fpga_cw310.bzl", - _cw310_jtag_params = "cw310_jtag_params", _cw310_params = "cw310_params", _fpga_cw305 = "fpga_cw305", _fpga_cw310 = "fpga_cw310", _fpga_cw340 = "fpga_cw340", - _hyper310_jtag_params = "hyper310_jtag_params", ) load( "@lowrisc_opentitan//rules/opentitan:silicon.bzl", _silicon = "silicon", - _silicon_jtag_params = "silicon_jtag_params", _silicon_params = "silicon_params", ) load( @@ -57,12 +54,9 @@ fpga_cw310 = _fpga_cw310 fpga_cw305 = _fpga_cw305 fpga_cw340 = _fpga_cw340 cw310_params = _cw310_params -cw310_jtag_params = _cw310_jtag_params -hyper310_jtag_params = _hyper310_jtag_params silicon = _silicon silicon_params = _silicon_params -silicon_jtag_params = _silicon_jtag_params sim_verilator = _sim_verilator verilator_params = _verilator_params @@ -232,6 +226,7 @@ def opentitan_test( rsa_key = rsa_key, spx_key = spx_key, manifest = manifest, + needs_jtag = getattr(tparam, "needs_jtag", False), ) # Make sure that we used all elements in kwargs diff --git a/rules/opentitan/exec_env.bzl b/rules/opentitan/exec_env.bzl index 5162e5517980a..55580a9b3cddf 100644 --- a/rules/opentitan/exec_env.bzl +++ b/rules/opentitan/exec_env.bzl @@ -32,6 +32,8 @@ _FIELDS = { "otp_data_perm": ("attr.otp_data_perm", False), "flash_scramble_tool": ("attr.flash_scramble_tool", False), "rom_scramble_config": ("file.rom_scramble_config", False), + "openocd": ("attr.openocd", False), + "openocd_adapter_config": ("attr.openocd_adapter_config", False), } ExecEnvInfo = provider( @@ -215,6 +217,17 @@ def exec_env_common_attrs(**kwargs): doc = "ROM scrambling config for this environment", allow_single_file = True, ), + "openocd": attr.label( + doc = "OpenOCD binary for this environment", + default = "//third_party/openocd:openocd_bin", + executable = True, + cfg = "exec", + ), + "openocd_adapter_config": attr.label( + default = kwargs.get("openocd_adapter_config", None), + allow_single_file = True, + doc = "OpenOCD adapter configuration for this environment", + ), } def _do_update(name, file, data_files, param, action_param): @@ -354,4 +367,22 @@ def common_test_setup(ctx, exec_env, firmware): for attr, name in ctx.attr.binaries.items(): update_file_attr(name, attr, exec_env.provider, data_files, param, action_param) + if ctx.attr.needs_jtag: + openocd = exec_env.openocd + jtag_data = [openocd] + jtag_test_cmd = ''' + --openocd="$(rootpath {})" + '''.format(openocd.label) + + openocd_adapter_config = get_fallback(ctx, "attr.openocd_adapter_config", exec_env) + if openocd_adapter_config != None: + jtag_data += [openocd_adapter_config] + jtag_test_cmd += ''' + --openocd-adapter-config="$(rootpath {})" + '''.format(openocd_adapter_config.label) + + data_labels += jtag_data + data_files += get_files(jtag_data) + param["jtag_test_cmd"] = jtag_test_cmd + return test_harness, data_labels, data_files, param, action_param diff --git a/rules/opentitan/fpga_cw310.bzl b/rules/opentitan/fpga_cw310.bzl index 54d1c0215243a..91affcf7ba1f4 100644 --- a/rules/opentitan/fpga_cw310.bzl +++ b/rules/opentitan/fpga_cw310.bzl @@ -25,13 +25,6 @@ load( "convert_to_scrambled_rom_vmem", "convert_to_vmem", ) -load( - "@lowrisc_opentitan//rules/opentitan:openocd.bzl", - "OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS", - "OPENTITANTOOL_OPENOCD_CMSIS_TEST_CMD", - "OPENTITANTOOL_OPENOCD_DATA_DEPS", - "OPENTITANTOOL_OPENOCD_TEST_CMD", -) load("//rules/opentitan:toolchain.bzl", "LOCALTOOLS_TOOLCHAIN") _TEST_SCRIPT = """#!/bin/bash @@ -211,6 +204,8 @@ def cw310_params( rom_ext = None, otp = None, bitstream = None, + changes_otp = False, + needs_jtag = False, test_cmd = "", data = [], **kwargs): @@ -226,6 +221,8 @@ def cw310_params( rom_ext: Use an alternate ROM_EXT for this test. otp: Use an alternate OTP configuration for this test. bitstream: Use an alternate bitstream for this test. + changes_otp: Whether this test may change the OTP. Bitstream will be cleared if True. + needs_jtag: If this test requires JTAG access, set this to True. test_cmd: Use an alternate test_cmd for this test. data: Additional files needed by this test. kwargs: Additional key-value pairs to override in the test `param` dict. @@ -237,60 +234,7 @@ def cw310_params( if not bitstream: bitstream = "@//hw/bitstream/universal:splice" return struct( - tags = ["cw310", "exclusive"] + tags, - timeout = timeout, - local = local, - test_harness = test_harness, - binaries = binaries, - rom = rom, - rom_ext = rom_ext, - otp = otp, - bitstream = bitstream, - test_cmd = test_cmd, - data = data, - param = kwargs, - ) - -def cw310_jtag_params( - tags = [], - timeout = "short", - local = True, - test_harness = None, - binaries = {}, - rom = None, - rom_ext = None, - otp = None, - bitstream = None, - test_cmd = "", - data = [], - **kwargs): - """A macro to create CW310 parameters for OpenTitan JTAG tests. - - This creates version of the CW310 parameter structure pre-initialized - with OpenOCD dependencies and test_cmd parameters. - - Args: - tags: The test tags to apply to the test rule. - timeout: The timeout to apply to the test rule. - local: Whether to set the `local` flag on this test. - test_harness: Use an alternative test harness for this test. - binaries: Dict of binary labels to substitution parameter names. - rom: Use an alternate ROM for this test. - rom_ext: Use an alternate ROM_EXT for this test. - otp: Use an alternate OTP configuration for this test. - bitstream: Use an alternate bitstream for this test. - test_cmd: Use an alternate test_cmd for this test. - data: Additional files needed by this test. - kwargs: Additional key-value pairs to override in the test `param` dict. - Returns: - struct of test parameters. - """ - if bitstream and (rom or otp): - fail("Cannot use rom or otp with bitstream.") - if not bitstream: - bitstream = "@//hw/bitstream/universal:splice" - return struct( - tags = ["cw310", "exclusive"] + tags, + tags = ["cw310", "exclusive"] + (["changes_otp"] if changes_otp else []) + tags, timeout = timeout, local = local, test_harness = test_harness, @@ -299,66 +243,15 @@ def cw310_jtag_params( rom_ext = rom_ext, otp = otp, bitstream = bitstream, - test_cmd = """ + needs_jtag = needs_jtag, + # FIXME: We should clear the bitstream *after* the test rather than before the test. + test_cmd = (""" --clear-bitstream + """ if changes_otp else "") + (""" --bitstream={bitstream} - """ + OPENTITANTOOL_OPENOCD_TEST_CMD + test_cmd, - data = OPENTITANTOOL_OPENOCD_DATA_DEPS + data, - param = kwargs, - ) - -def hyper310_jtag_params( - tags = [], - timeout = "short", - local = True, - test_harness = None, - binaries = {}, - rom = None, - rom_ext = None, - otp = None, - bitstream = None, - test_cmd = "", - data = [], - **kwargs): - """A macro to create Hyper310 parameters for OpenTitan JTAG tests. - - This creates version of the Hyper310 parameter structure pre-initialized - with OpenOCD dependencies and test_cmd parameters. - - Args: - tags: The test tags to apply to the test rule. - timeout: The timeout to apply to the test rule. - local: Whether to set the `local` flag on this test. - test_harness: Use an alternative test harness for this test. - binaries: Dict of binary labels to substitution parameter names. - rom: Use an alternate ROM for this test. - rom_ext: Use an alternate ROM_EXT for this test. - otp: Use an alternate OTP configuration for this test. - bitstream: Use an alternate bitstream for this test. - test_cmd: Use an alternate test_cmd for this test. - data: Additional files needed by this test. - kwargs: Additional key-value pairs to override in the test `param` dict. - Returns: - struct of test parameters. - """ - if bitstream and (rom or otp): - fail("Cannot use rom or otp with bitstream.") - if not bitstream: - bitstream = "@//hw/bitstream/universal:splice" - return struct( - tags = ["hyper310", "exclusive"] + tags, - timeout = timeout, - local = local, - test_harness = test_harness, - binaries = binaries, - rom = rom, - rom_ext = rom_ext, - otp = otp, - bitstream = bitstream, - test_cmd = """ - --clear-bitstream - --bitstream={bitstream} - """ + OPENTITANTOOL_OPENOCD_CMSIS_TEST_CMD + test_cmd, - data = OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS + data, + """ if test_harness != None else "") + (""" + {jtag_test_cmd} + """ if needs_jtag else "") + test_cmd, + data = data, param = kwargs, ) diff --git a/rules/opentitan/openocd.bzl b/rules/opentitan/openocd.bzl deleted file mode 100644 index f7f493ddd4d95..0000000000000 --- a/rules/opentitan/openocd.bzl +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright lowRISC contributors. -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 - -OPENTITANTOOL_OPENOCD_DATA_DEPS = [ - "//third_party/openocd:jtag_olimex_cfg", - "//third_party/openocd:openocd_bin", -] - -OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS = [ - "//third_party/openocd:jtag_cmsis_dap_adapter_cfg", - "//third_party/openocd:openocd_bin", -] - -OPENTITANTOOL_OPENOCD_TEST_CMD = """ - --openocd="$(rootpath //third_party/openocd:openocd_bin)" - --openocd-adapter-config="$(rootpath //third_party/openocd:jtag_olimex_cfg)" -""" - -OPENTITANTOOL_OPENOCD_CMSIS_TEST_CMD = """ - --openocd="$(rootpath //third_party/openocd:openocd_bin)" -""" - -OPENTITANTOOL_OPENOCD_CMSIS_SI_TEST_CMD = """ - --openocd="$(rootpath //third_party/openocd:openocd_bin)" -""" diff --git a/rules/opentitan/silicon.bzl b/rules/opentitan/silicon.bzl index eb40c32048dc1..cc0a2e172fc38 100644 --- a/rules/opentitan/silicon.bzl +++ b/rules/opentitan/silicon.bzl @@ -18,11 +18,6 @@ load( "exec_env_as_dict", "exec_env_common_attrs", ) -load( - "@lowrisc_opentitan//rules/opentitan:openocd.bzl", - "OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS", - "OPENTITANTOOL_OPENOCD_CMSIS_SI_TEST_CMD", -) load("//rules/opentitan:toolchain.bzl", "LOCALTOOLS_TOOLCHAIN") _TEST_SCRIPT = """#!/bin/bash @@ -141,6 +136,8 @@ def silicon_params( rom_ext = None, test_harness = None, binaries = {}, + changes_otp = False, + needs_jtag = False, test_cmd = "", data = [], **kwargs): @@ -153,6 +150,8 @@ def silicon_params( test_harness: Use an alternative test harness for this test. binaries: Dict of binary labels to substitution parameter names. rom_ext: Use an alternate ROM_EXT for this test. + changes_otp: Whether this test may change the OTP. + needs_jtag: If this test requires JTAG access, set this to True. test_cmd: Use an alternate test_cmd for this test. data: Additional files needed by this test. kwargs: Additional key-value pairs to override in the test `param` dict. @@ -160,7 +159,7 @@ def silicon_params( struct of test parameters. """ return struct( - tags = ["silicon", "exclusive"] + tags, + tags = ["silicon", "exclusive"] + (["changes_otp"] if changes_otp else []) + tags, timeout = timeout, local = local, test_harness = test_harness, @@ -169,50 +168,11 @@ def silicon_params( rom_ext = rom_ext, otp = None, bitstream = None, - test_cmd = test_cmd, + changes_otp = None, + needs_jtag = needs_jtag, + test_cmd = (""" + {jtag_test_cmd} + """ if needs_jtag else "") + test_cmd, data = data, param = kwargs, ) - -def silicon_jtag_params( - tags = [], - timeout = "short", - local = True, - rom_ext = None, - test_harness = None, - binaries = {}, - test_cmd = "", - data = [], - **kwargs): - """A macro to create Silicon parameters for OpenTitan JTAG tests. - - This creates version of the Silicon parameter structure pre-initialized - with OpenOCD dependencies and test_cmd parameters. - - Args: - tags: The test tags to apply to the test rule. - timeout: The timeout to apply to the test rule. - local: Whether to set the `local` flag on this test. - test_harness: Use an alternative test harness for this test. - binaries: Dict of binary labels to substitution parameter names. - rom_ext: Use an alternate ROM_EXT for this test. - test_cmd: Use an alternate test_cmd for this test. - data: Additional files needed by this test. - kwargs: Additional key-value pairs to override in the test `param` dict. - Returns: - struct of test parameters. - """ - return struct( - tags = ["silicon", "exclusive"] + tags, - timeout = timeout, - local = local, - test_harness = test_harness, - binaries = binaries, - rom = None, - rom_ext = rom_ext, - otp = None, - bitstream = None, - test_cmd = OPENTITANTOOL_OPENOCD_CMSIS_SI_TEST_CMD + test_cmd, - data = OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS + data, - param = kwargs, - ) diff --git a/sw/device/lib/crypto/drivers/BUILD b/sw/device/lib/crypto/drivers/BUILD index 0c61dd8b8c968..d91970e7bd733 100644 --- a/sw/device/lib/crypto/drivers/BUILD +++ b/sw/device/lib/crypto/drivers/BUILD @@ -8,9 +8,14 @@ load("//rules:opentitan.bzl", "OPENTITAN_CPU") load( "//rules/opentitan:defs.bzl", "EARLGREY_TEST_ENVS", + "cw310_params", "opentitan_test", "verilator_params", ) +load( + "@bazel_skylib//lib:dicts.bzl", + "dicts", +) cc_library( name = "aes", @@ -66,7 +71,14 @@ cc_library( opentitan_test( name = "keymgr_test", srcs = ["keymgr_test.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), diff --git a/sw/device/silicon_creator/lib/BUILD b/sw/device/silicon_creator/lib/BUILD index f04b192e1c551..90c7ddbc73d9a 100644 --- a/sw/device/silicon_creator/lib/BUILD +++ b/sw/device/silicon_creator/lib/BUILD @@ -5,6 +5,10 @@ load("//rules:opentitan.bzl", "OPENTITAN_CPU") load("//rules:autogen.bzl", "autogen_chip_info") load("//rules:cross_platform.bzl", "dual_cc_device_library_of", "dual_cc_library", "dual_inputs") +load( + "@bazel_skylib//lib:dicts.bzl", + "dicts", +) load( "//rules/opentitan:defs.bzl", "EARLGREY_TEST_ENVS", @@ -62,7 +66,14 @@ cc_test( opentitan_test( name = "boot_data_functest", srcs = ["boot_data_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "eternal", tags = ["flaky"], @@ -195,7 +206,14 @@ cc_library( opentitan_test( name = "irq_asm_functest", srcs = ["irq_asm_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), diff --git a/sw/device/silicon_creator/lib/drivers/BUILD b/sw/device/silicon_creator/lib/drivers/BUILD index 6479bcfd01b1c..534ac938bec41 100644 --- a/sw/device/silicon_creator/lib/drivers/BUILD +++ b/sw/device/silicon_creator/lib/drivers/BUILD @@ -15,6 +15,7 @@ load( load( "//rules/opentitan:defs.bzl", "EARLGREY_TEST_ENVS", + "cw310_params", "opentitan_test", "verilator_params", ) @@ -83,7 +84,14 @@ cc_test( opentitan_test( name = "alert_functest", srcs = ["alert_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), @@ -297,9 +305,14 @@ cc_test( opentitan_test( name = "keymgr_functest", srcs = ["keymgr_functest.c"], + broken = cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, - {"//hw/top_earlgrey:silicon_creator": None}, + { + "//hw/top_earlgrey:silicon_creator": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, ), verilator = verilator_params( timeout = "long", @@ -604,7 +617,14 @@ cc_test( opentitan_test( name = "rnd_functest", srcs = ["rnd_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), deps = [ ":otp", ":rnd", @@ -664,7 +684,14 @@ cc_test( opentitan_test( name = "rstmgr_functest", srcs = ["rstmgr_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), @@ -751,7 +778,14 @@ cc_test( opentitan_test( name = "watchdog_functest", srcs = ["watchdog_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), diff --git a/sw/device/silicon_creator/lib/sigverify/BUILD b/sw/device/silicon_creator/lib/sigverify/BUILD index 4fb03773b7349..3707a867bada7 100644 --- a/sw/device/silicon_creator/lib/sigverify/BUILD +++ b/sw/device/silicon_creator/lib/sigverify/BUILD @@ -12,6 +12,10 @@ load( "opentitan_test", "verilator_params", ) +load( + "@bazel_skylib//lib:dicts.bzl", + "dicts", +) package(default_visibility = ["//visibility:public"]) @@ -146,7 +150,14 @@ dual_cc_library( opentitan_test( name = "mod_exp_otbn_functest_hardcoded", srcs = ["mod_exp_otbn_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", tags = [ @@ -226,7 +237,14 @@ cc_library( opentitan_test( name = "rsa_verify_functest", srcs = ["rsa_verify_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", tags = [ @@ -326,7 +344,14 @@ cc_test( opentitan_test( name = "sigverify_dynamic_functest_hardcoded", srcs = ["sigverify_dynamic_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", tags = [ diff --git a/sw/device/silicon_creator/manuf/lib/BUILD b/sw/device/silicon_creator/manuf/lib/BUILD index 05b9e0a3c82e3..633316f907ef7 100644 --- a/sw/device/silicon_creator/manuf/lib/BUILD +++ b/sw/device/silicon_creator/manuf/lib/BUILD @@ -7,7 +7,6 @@ load( "//rules/opentitan:defs.bzl", "OPENTITAN_CPU", "cw310_params", - "hyper310_jtag_params", "opentitan_test", ) load( @@ -204,11 +203,10 @@ opentitan_test( srcs = ["individualize_sw_cfg_functest.c"], cw310 = cw310_params( bitstream = "//hw/bitstream:rom_with_fake_keys_otp_test_unlocked1", + changes_otp = True, tags = ["manuf"], test_cmd = """ - --clear-bitstream - --bitstream={bitstream} - --bootstrap={firmware} + --bootstrap={firmware} """, test_harness = "//sw/host/tests/manuf/individualize_sw_cfg", ), @@ -264,8 +262,10 @@ cc_library( opentitan_test( name = "personalize_functest", srcs = ["personalize_functest.c"], - cw310 = hyper310_jtag_params( + cw310 = cw310_params( + changes_otp = True, data = ["//sw/device/silicon_creator/manuf/keys/fake:rma_unlock_token_export_key.sk_hsm.der"], + needs_jtag = True, otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival_bringup:otp_img_dev_manuf_individualized", tags = [ "lc_dev", diff --git a/sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/BUILD b/sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/BUILD index 962c6bbc9a5ec..7ad775fa9045c 100644 --- a/sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/BUILD +++ b/sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/BUILD @@ -8,11 +8,10 @@ load("//rules:manifest.bzl", "manifest") load("//rules:signing.bzl", "offline_presigning_artifacts", "offline_signature_attach") load( "//rules/opentitan:defs.bzl", - "cw310_jtag_params", - "hyper310_jtag_params", + "cw310_params", "opentitan_binary", "opentitan_test", - "silicon_jtag_params", + "silicon_params", ) load( "//sw/device/silicon_creator/manuf:provisioning_inputs.bzl", @@ -114,8 +113,10 @@ _CP_PROVISIONING_CMD_ARGS = """ opentitan_test( name = "cp_provision", - cw310 = hyper310_jtag_params( + cw310 = cw310_params( binaries = {":sram_cp_provision": "sram_cp_provision"}, + changes_otp = True, + needs_jtag = True, otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival_bringup:otp_img_test_unlocked0_manuf_empty", tags = ["manuf"], test_cmd = _CP_PROVISIONING_CMD_ARGS, @@ -125,9 +126,11 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw310_sival": None, "//hw/top_earlgrey:silicon_creator": None, }, - silicon = silicon_jtag_params( + silicon = silicon_params( binaries = {":sram_cp_provision": "sram_cp_provision"}, + changes_otp = True, interface = "hyper310", + needs_jtag = True, test_cmd = _CP_PROVISIONING_CMD_ARGS, test_harness = "//sw/host/tests/manuf/provisioning/cp", ), @@ -135,12 +138,14 @@ opentitan_test( opentitan_test( name = "cp_provision_functest", - cw310 = cw310_jtag_params( + cw310 = cw310_params( binaries = { ":sram_cp_provision": "sram_cp_provision", ":sram_cp_provision_functest": "sram_cp_provision_functest", }, bitstream = "//hw/bitstream:rom_with_fake_keys_otp_raw", + changes_otp = True, + needs_jtag = True, tags = ["manuf"], test_cmd = """ --provisioning-sram-elf={sram_cp_provision} @@ -302,9 +307,11 @@ _FT_PROVISIONING_CMD_ARGS = """ opentitan_test( name = "ft_provision", - cw310 = hyper310_jtag_params( + cw310 = cw310_params( binaries = _FT_PROVISIONING_BINARIES, + changes_otp = True, data = FT_PERSONALIZE_KEYS, + needs_jtag = True, otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival_bringup:otp_img_test_locked0_manuf_initialized", tags = [ "lc_test_locked0", @@ -317,10 +324,12 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw310_sival": None, "//hw/top_earlgrey:silicon_creator": None, }, - silicon = silicon_jtag_params( + silicon = silicon_params( binaries = _FT_PROVISIONING_BINARIES, + changes_otp = True, data = FT_PERSONALIZE_KEYS, interface = "hyper310", + needs_jtag = True, test_cmd = _FT_PROVISIONING_CMD_ARGS, test_harness = "//sw/host/tests/manuf/provisioning/ft", ), diff --git a/sw/device/silicon_creator/manuf/tests/BUILD b/sw/device/silicon_creator/manuf/tests/BUILD index 83bf8f6d613e1..f19d97b112cc0 100644 --- a/sw/device/silicon_creator/manuf/tests/BUILD +++ b/sw/device/silicon_creator/manuf/tests/BUILD @@ -11,11 +11,11 @@ load( load("//rules:otp.bzl", "otp_image") load( "//rules/opentitan:defs.bzl", - "cw310_jtag_params", + "cw310_params", "opentitan_binary", "opentitan_test", "rsa_key_for_lc_state", - "silicon_jtag_params", + "silicon_params", ) package(default_visibility = ["//visibility:public"]) @@ -69,9 +69,11 @@ _MANUF_TEST_LOCKED_KEY = None opentitan_test( name = "manuf_scrap_functest_{}".format(lc_state.lower()), srcs = ["empty_functest.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( bitstream = "//hw/bitstream:rom_with_fake_keys_otp_{}".format(lc_state.lower()), + changes_otp = True, lc_state = lc_state, # will be expanded in test_cmd + needs_jtag = True, tags = ["manuf"], test_cmd = ( "" if ( @@ -108,8 +110,10 @@ lc_raw_unlock_token( opentitan_test( name = "manuf_cp_unlock_raw_functest", srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( bitstream = "//hw/bitstream:rom_with_fake_keys_otp_raw", + changes_otp = True, + needs_jtag = True, tags = ["manuf"], test_harness = "//sw/host/tests/manuf/manuf_cp_unlock_raw", ), @@ -128,8 +132,10 @@ opentitan_test( opentitan_test( name = "manuf_cp_volatile_unlock_raw_functest", srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( bitstream = "//hw/bitstream:rom_with_fake_keys_otp_raw", + changes_otp = True, + needs_jtag = True, tags = ["manuf"], test_harness = "//sw/host/tests/manuf/manuf_cp_volatile_unlock_raw", ), @@ -163,8 +169,10 @@ opentitan_test( opentitan_test( name = "manuf_cp_yield_test_functest_{}".format(lc_state.lower()), srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( + changes_otp = True, lc_state = lc_state, # will be expanded in test_cmd + needs_jtag = True, otp = ":otp_img_rom_exec_disabled_{}".format(lc_state.lower()), tags = ["manuf"], test_cmd = "--initial-lc-state={lc_state}", @@ -210,7 +218,8 @@ cc_library( opentitan_test( name = "manuf_sram_program_crc_{}_functest".format(lc_state.lower()), srcs = ["sram_empty_functest.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( + needs_jtag = True, otp = ":otp_img_rom_exec_disabled_{}".format(lc_state.lower()), test_cmd = "--elf={firmware}", test_harness = "//sw/host/tests/manuf/manuf_sram_program_crc_check", @@ -221,8 +230,9 @@ cc_library( }, kind = "ram", linker_script = "//sw/device/silicon_creator/manuf/lib:sram_program_linker_script", - silicon = silicon_jtag_params( + silicon = silicon_params( interface = "hyper310", + needs_jtag = True, test_cmd = "--elf={firmware}", test_harness = "//sw/host/tests/manuf/manuf_sram_program_crc_check", ), @@ -291,10 +301,12 @@ opentitan_binary( target_lc_state.lower(), ), srcs = ["flash_device_info_flash_wr_functest.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( binaries = { ":sram_device_info_flash_wr_functest": "sram_program", }, + changes_otp = True, + needs_jtag = True, otp = ":otp_img_rom_exec_disabled_{}".format(init_lc_state.lower()), tags = ["manuf"], target_lc_state = target_lc_state, # will be expanded in test_cmd @@ -373,10 +385,11 @@ opentitan_binary( opentitan_test( name = "manuf_cp_ast_test_execution_{}_functest".format(lc_state.lower()), srcs = ["idle_functest.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( binaries = { ":sram_exec_test": "sram_program", }, + needs_jtag = True, otp = ":otp_img_rom_exec_disabled_{}".format(lc_state.lower()), tags = ["manuf"], test_cmd = """ @@ -409,7 +422,9 @@ test_suite( opentitan_test( name = "manuf_cp_test_lock_functest", srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( + changes_otp = True, + needs_jtag = True, otp = ":otp_img_otp_ctrl_functest", tags = ["manuf"], test_harness = "//sw/host/tests/manuf/manuf_cp_test_lock", @@ -435,7 +450,9 @@ otp_image( opentitan_test( name = "otp_ctrl_functest", srcs = [":empty_functest.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( + changes_otp = True, + needs_jtag = True, otp = ":otp_img_otp_ctrl_functest", tags = ["manuf"], test_harness = "//sw/host/tests/manuf/otp_ctrl:otp_ctrl", diff --git a/sw/device/silicon_creator/rom/e2e/bootstrap/BUILD b/sw/device/silicon_creator/rom/e2e/bootstrap/BUILD index 5d4e02902b0f0..d93b940ef71b8 100644 --- a/sw/device/silicon_creator/rom/e2e/bootstrap/BUILD +++ b/sw/device/silicon_creator/rom/e2e/bootstrap/BUILD @@ -4,7 +4,6 @@ load( "//rules/opentitan:defs.bzl", - "cw310_jtag_params", "cw310_params", "opentitan_test", "rsa_key_for_lc_state", @@ -72,10 +71,10 @@ otp_image( opentitan_test( name = "e2e_bootstrap_rma", srcs = ["rom_e2e_bootstrap_rma_test.c"], - cw310 = cw310_jtag_params( + cw310 = cw310_params( + changes_otp = True, + needs_jtag = True, otp = "otp_img_bootstrap_rma", - # We need to clear the bitstream between consecutive runs of this - # test since it modifies OTP state (i.e., the LC state). test_cmd = """ --bootstrap="{firmware}" """, @@ -108,9 +107,6 @@ opentitan_test( "//sw/device/silicon_creator/rom/e2e:new_empty_test_slot_a": "firmware", }, otp = "//hw/ip/otp_ctrl/data:img_bootstrap_disabled", - test_cmd = """ - --bitstream="{bitstream}" - """, test_harness = "//sw/host/tests/rom/e2e_bootstrap_disabled", ), exec_env = { diff --git a/sw/device/silicon_creator/rom/e2e/chip_specific_startup/BUILD b/sw/device/silicon_creator/rom/e2e/chip_specific_startup/BUILD index 855cedb6aec1b..05eda96ecda5c 100644 --- a/sw/device/silicon_creator/rom/e2e/chip_specific_startup/BUILD +++ b/sw/device/silicon_creator/rom/e2e/chip_specific_startup/BUILD @@ -31,7 +31,6 @@ package(default_visibility = ["//visibility:public"]) otp = "//sw/device/silicon_creator/rom/e2e/rom_e2e_bootstrap_entry:otp_img_e2e_bootstrap_entry_{}".format(lc_state), tags = maybe_skip_in_ci(lc_state_val), test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" --otp-unprogrammed """, diff --git a/sw/device/silicon_creator/rom/e2e/jtag_inject/BUILD b/sw/device/silicon_creator/rom/e2e/jtag_inject/BUILD index 7c1890b8b01f3..8f39af2ec60a3 100644 --- a/sw/device/silicon_creator/rom/e2e/jtag_inject/BUILD +++ b/sw/device/silicon_creator/rom/e2e/jtag_inject/BUILD @@ -4,8 +4,8 @@ load( "//rules/opentitan:defs.bzl", - "cw310_jtag_params", "opentitan_test", + new_cw310_params = "cw310_params", ) load( "//rules:opentitan_test.bzl", @@ -45,11 +45,12 @@ package(default_visibility = ["//visibility:public"]) opentitan_test( name = "sram_program_fpga_cw310_test_otp_{}".format(lc_state), srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test"], - cw310 = cw310_jtag_params( + cw310 = new_cw310_params( binaries = { "//sw/device/examples/sram_program:sram_program": "sram_program", }, logging = "debug", + needs_jtag = True, otp = ":img_{}_exec_disabled".format(lc_state), tags = ["cw310_rom_with_fake_keys"], test_cmd = """ @@ -96,9 +97,10 @@ LC_STATES_DEBUG_DISALLOWED = [ opentitan_test( name = "openocd_debug_test_otp_" + lc_state, srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test"], - cw310 = cw310_jtag_params( + cw310 = new_cw310_params( timeout = "moderate", logging = "debug", + needs_jtag = True, otp = ":img_{}_exec_disabled".format(lc_state), tags = ["cw310_rom_with_fake_keys"], test_cmd = " --elf={rom:elf}" + (" --expect-fail" if lc_state_val in LC_STATES_DEBUG_DISALLOWED else " "), diff --git a/sw/device/silicon_creator/rom/e2e/rom_e2e_bootstrap_entry/BUILD b/sw/device/silicon_creator/rom/e2e/rom_e2e_bootstrap_entry/BUILD index 14b56338f1755..f91f40c50bf8c 100644 --- a/sw/device/silicon_creator/rom/e2e/rom_e2e_bootstrap_entry/BUILD +++ b/sw/device/silicon_creator/rom/e2e/rom_e2e_bootstrap_entry/BUILD @@ -41,7 +41,6 @@ package(default_visibility = ["//visibility:public"]) otp = ":otp_img_e2e_bootstrap_entry_{}".format(lc_state), tags = maybe_skip_in_ci(lc_state_val), test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/rom/e2e_bootstrap_entry", diff --git a/sw/device/tests/BUILD b/sw/device/tests/BUILD index 91c3d49285947..f827e3361737e 100644 --- a/sw/device/tests/BUILD +++ b/sw/device/tests/BUILD @@ -36,12 +36,9 @@ load( "//rules/opentitan:defs.bzl", "EARLGREY_SILICON_OWNER_ROM_EXT_ENVS", "EARLGREY_TEST_ENVS", - "cw310_jtag_params", - "hyper310_jtag_params", "opentitan_binary", "opentitan_test", "rsa_key_for_lc_state", - "silicon_jtag_params", "silicon_params", new_cw310_params = "cw310_params", new_dv_params = "dv_params", @@ -548,6 +545,7 @@ opentitan_test( opentitan_test( name = "chip_power_idle_load", srcs = ["chip_power_idle_load.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { @@ -555,6 +553,8 @@ opentitan_test( "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_proda_rom_ext": "silicon_owner", + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon_owner = silicon_params( @@ -582,7 +582,14 @@ opentitan_test( opentitan_test( name = "chip_power_sleep_load", srcs = ["chip_power_sleep_load.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = new_cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), # TODO(#16374): test doesn't make progress after enabling PWM verilator = new_verilator_params(tags = ["broken"]), deps = [ @@ -954,11 +961,12 @@ opentitan_test( opentitan_test( name = "csrng_edn_concurrency_test", srcs = ["csrng_edn_concurrency_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { "//hw/top_earlgrey:fpga_cw310_sival": None, - "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None, + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", "//hw/top_earlgrey:silicon_creator": None, "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", @@ -994,11 +1002,14 @@ opentitan_test( opentitan_test( name = "csrng_kat_test", srcs = ["csrng_kat_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_creator": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon = silicon_params( @@ -1140,6 +1151,8 @@ opentitan_test( opentitan_test( name = "edn_kat", srcs = ["edn_kat.c"], + # Remove this line when fixed. + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { @@ -1147,6 +1160,8 @@ opentitan_test( "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_proda_rom_ext": "silicon_owner", + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon_owner = silicon_params( @@ -1282,11 +1297,12 @@ opentitan_test( opentitan_test( name = "entropy_src_csrng_test", srcs = ["entropy_src_csrng_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { "//hw/top_earlgrey:fpga_cw310_sival": None, - "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None, + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", "//hw/top_earlgrey:silicon_creator": None, "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", @@ -1350,6 +1366,7 @@ opentitan_test( opentitan_test( name = "entropy_src_edn_reqs_test", srcs = ["entropy_src_edn_reqs_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { @@ -1357,6 +1374,8 @@ opentitan_test( "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_proda_rom_ext": "silicon_owner", + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon_owner = silicon_params( @@ -1408,7 +1427,6 @@ opentitan_test( srcs = ["example_mem_ujcmd.c"], cw310 = new_cw310_params( test_cmd = " ".join([ - "--bitstream=\"{bitstream}\"", "--bootstrap=\"{firmware}\"", "\"{firmware:elf}\"", ]), @@ -1504,11 +1522,14 @@ opentitan_test( opentitan_test( name = "flash_ctrl_ops_test", srcs = ["flash_ctrl_ops_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_owner_sival_rom_ext": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), deps = [ @@ -1646,11 +1667,14 @@ test_suite( opentitan_test( name = "flash_ctrl_clock_freqs_test", srcs = ["flash_ctrl_clock_freqs_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_owner_sival_rom_ext": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), verilator = new_verilator_params(timeout = "long"), @@ -1671,11 +1695,14 @@ opentitan_test( opentitan_test( name = "flash_ctrl_test", srcs = ["flash_ctrl_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_creator": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon = silicon_params(tags = ["broken"]), @@ -1718,10 +1745,13 @@ opentitan_test( opentitan_test( name = "flash_ctrl_mem_protection_test", srcs = ["flash_ctrl_mem_protection_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { "//hw/top_earlgrey:silicon_owner_sival_rom_ext": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), verilator = new_verilator_params(timeout = "long"), @@ -1741,7 +1771,9 @@ opentitan_test( opentitan_test( name = "flash_ctrl_rma_test", srcs = ["flash_ctrl_rma_test.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + changes_otp = True, + needs_jtag = True, otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival_bringup:otp_img_dev_manuf_personalized", tags = [ "broken", @@ -1804,7 +1836,6 @@ opentitan_test( srcs = ["gpio_pinmux_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream={bitstream} --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/gpio", @@ -1835,7 +1866,6 @@ opentitan_test( srcs = ["gpio_intr_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream={bitstream} --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/gpio_intr", @@ -1937,12 +1967,15 @@ opentitan_test( opentitan_test( name = "keymgr_key_derivation_test", srcs = ["keymgr_key_derivation_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { # This test is not supported by the silicon_owner_sival_rom_ext # configuration. "//hw/top_earlgrey:silicon_creator": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), verilator = new_verilator_params(timeout = "long"), @@ -1965,11 +1998,14 @@ opentitan_test( opentitan_test( name = "keymgr_sideload_aes_test", srcs = ["keymgr_sideload_aes_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_creator": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon = silicon_params(tags = ["broken"]), @@ -1997,11 +2033,14 @@ opentitan_test( opentitan_test( name = "keymgr_sideload_kmac_test", srcs = ["keymgr_sideload_kmac_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_creator": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, ), silicon = silicon_params(tags = ["broken"]), @@ -2202,7 +2241,14 @@ opentitan_test( opentitan_test( name = "lc_ctrl_otp_hw_cfg_test", srcs = ["lc_ctrl_otp_hw_cfg_test.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = new_cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), deps = [ "//hw/top_earlgrey/sw/autogen:top_earlgrey", "//sw/device/lib/base:bitfield", @@ -2388,7 +2434,14 @@ opentitan_test( opentitan_test( name = "otp_ctrl_smoketest", srcs = ["otp_ctrl_smoketest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = new_cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), deps = [ "//hw/top_earlgrey/sw/autogen:top_earlgrey", "//sw/device/lib/base:bitfield", @@ -2427,7 +2480,14 @@ opentitan_test( opentitan_test( name = "pmp_smoketest_napot", srcs = ["pmp_smoketest_napot.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = new_cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), deps = [ "//hw/top_earlgrey/sw/autogen:top_earlgrey", "//sw/device/lib/base:csr", @@ -2441,7 +2501,14 @@ opentitan_test( opentitan_test( name = "pmp_smoketest_tor", srcs = ["pmp_smoketest_tor.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = new_cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), deps = [ "//hw/top_earlgrey/sw/autogen:top_earlgrey", "//sw/device/lib/base:csr", @@ -2500,7 +2567,6 @@ opentitan_test( test_harness = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_all_resets", ), @@ -2543,7 +2609,6 @@ opentitan_test( test_harness = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_all_resets", ), @@ -2570,7 +2635,6 @@ opentitan_test( cw310 = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_all_resets", ), @@ -2608,7 +2672,6 @@ opentitan_test( cw310 = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_all_resets", ), @@ -2639,7 +2702,6 @@ opentitan_test( cw310 = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_por", ), @@ -2680,7 +2742,6 @@ opentitan_test( cw310 = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_por", ), @@ -2721,7 +2782,6 @@ opentitan_test( cw310 = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_all_wakeups", ), @@ -2769,7 +2829,6 @@ opentitan_test( cw310 = new_cw310_params( test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """, test_harness = "//sw/host/tests/chip/pwrmgr:sleep_all_wakeups", ), @@ -3074,7 +3133,6 @@ opentitan_test( cw310 = new_cw310_params( otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival:otp_img_prod_manuf_personalized", test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -3120,7 +3178,6 @@ opentitan_test( "manual", ], test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -3159,7 +3216,6 @@ opentitan_test( srcs = ["spi_device_flash_smoketest.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -3393,10 +3449,12 @@ opentitan_test( opentitan_test( name = "sram_ctrl_execution_test", srcs = ["sram_ctrl_execution_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = { "//hw/top_earlgrey:fpga_cw310_test_rom": None, "//hw/top_earlgrey:fpga_cw310_sival": None, - "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", }, deps = [ "//hw/top_earlgrey/sw/autogen:top_earlgrey", @@ -3457,10 +3515,13 @@ opentitan_test( opentitan_test( name = "sram_ctrl_sleep_sram_ret_contents_scramble_test", srcs = ["sram_ctrl_sleep_sram_ret_contents_scramble_test.c"], + broken = new_cw310_params(tags = ["broken"]), exec_env = dicts.add( EARLGREY_TEST_ENVS, { "//hw/top_earlgrey:fpga_cw310_sival": None, + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", "//hw/top_earlgrey:silicon_creator": None, "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", @@ -3642,7 +3703,6 @@ opentitan_test( cw310 = new_cw310_params( tags = ["manual"], test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/usb:usbdev_aon_wake", @@ -3901,7 +3961,14 @@ opentitan_test( "rv_core_ibex_address_translation_test.S", "rv_core_ibex_address_translation_test.c", ], - exec_env = EARLGREY_TEST_ENVS, + broken = new_cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), deps = [ "//hw/top_earlgrey/sw/autogen:top_earlgrey", "//sw/device/lib/base:csr", @@ -4020,7 +4087,6 @@ opentitan_test( cw310 = new_cw310_params( otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival_bringup:otp_img_prod_manuf_personalized", test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/power_virus", @@ -4101,8 +4167,6 @@ opentitan_test( # interface = "hyper310", # tags = ["manual"], test_cmd = """ - --bitstream={bitstream} - --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/spi_passthru", ), @@ -4175,7 +4239,8 @@ _RV_DM_JTAG_LC_STATES = get_lc_items( opentitan_test( name = "rv_dm_jtag_{}".format(lc_state), srcs = ["example_test_from_flash.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4206,7 +4271,8 @@ test_suite( opentitan_test( name = "rv_dm_jtag_tap_sel_{}".format(lc_state), srcs = ["example_test_from_flash.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4294,7 +4360,8 @@ test_suite( opentitan_test( name = "rv_dm_lc_disabled_jtag_{}".format(lc_state), srcs = ["example_test_from_flash.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4326,7 +4393,8 @@ test_suite( opentitan_test( name = "rv_dm_ndm_reset_req_{}".format(lc_state), srcs = ["rv_dm_ndm_reset_req.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4379,7 +4447,8 @@ test_suite( opentitan_test( name = "rv_dm_ndm_reset_req_when_cpu_halted_{}".format(lc_state), srcs = ["rv_dm_ndm_reset_req_when_cpu_halted.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4419,7 +4488,8 @@ test_suite( opentitan_test( name = "rv_dm_dtm_{}".format(lc_state), srcs = ["example_test_from_flash.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4459,7 +4529,8 @@ test_suite( opentitan_test( name = "rv_dm_control_status_{}".format(lc_state), srcs = ["example_test_from_flash.c"], - cw310 = hyper310_jtag_params( + cw310 = new_cw310_params( + needs_jtag = True, otp = _SIVAL_OTP_IMAGE[lc_state], tags = [ "lc_{}".format(lc_state), @@ -4498,60 +4569,19 @@ test_suite( opentitan_test( name = "openocd_test", srcs = ["example_test_from_flash.c"], - cw310 = cw310_jtag_params( - bitstream = "//hw/bitstream:rom_with_fake_keys_otp_test_unlocked0", + cw310 = new_cw310_params( + needs_jtag = True, + otp = "//hw/ip/otp_ctrl/data:img_test_unlocked0", test_cmd = """ --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/jtag:openocd_test", ), exec_env = { - "//hw/top_earlgrey:fpga_cw310_sival": "hyper310", + "//hw/top_earlgrey:fpga_cw310_sival": None, "//hw/top_earlgrey:fpga_cw310_rom_with_fake_keys": None, }, - hyper310 = hyper310_jtag_params( - bitstream = "//hw/bitstream/hyperdebug:rom_with_fake_keys_otp_test_unlocked0", - test_cmd = """ - --bootstrap="{firmware}" - """, - test_harness = "//sw/host/tests/chip/jtag:openocd_test", - ), - deps = [ - "//sw/device/lib/runtime:log", - "//sw/device/lib/testing/test_framework:ottf_main", - ], -) - -# TODO(#19902): Migrate to `opentitan_test` once there is support for the -# hyperdebug310 target. #19903 covers support for hyperdebug340, and #19901 -# covers support for cw340_params. -opentitan_functest( - name = "spi_device_ottf_console_test", - srcs = ["spi_device_ottf_console_test.c"], - cw310 = cw310_params( - interface = "hyper310", - test_cmds = [ - "--bitstream=\"$(location {bitstream})\"", - "--bootstrap=\"$(location {flash})\"", - ], - ), - cw340 = cw340_params( - interface = "hyper340", - tags = ["manual"], - test_cmds = [ - "--bitstream=\"$(location {bitstream})\"", - "--bootstrap=\"$(location {flash})\"", - ], - ), - targets = [ - "cw310_rom_with_fake_keys", - "cw310_test_rom", - "cw340_test_rom", - ], - test_harness = "//sw/host/tests/chip/spi_device_ottf_console", deps = [ - "//hw/top_earlgrey/sw/autogen:top_earlgrey", - "//sw/device/lib/dif:spi_device", "//sw/device/lib/runtime:log", "//sw/device/lib/testing/test_framework:ottf_main", ], @@ -4567,7 +4597,6 @@ opentitan_test( cw310 = new_cw310_params( # otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival:otp_img_prod_manuf_personalized", test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/i2c_target", @@ -4648,7 +4677,6 @@ opentitan_test( srcs = ["example_sival.c"], cw310 = new_cw310_params( test_cmd = " ".join([ - "--bitstream=\"{bitstream}\"", "--bootstrap=\"{firmware}\"", "\"{firmware:elf}\"", ]), @@ -4666,7 +4694,6 @@ opentitan_test( srcs = ["sysrst_ctrl_inputs_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -4704,7 +4731,6 @@ opentitan_test( srcs = ["sysrst_ctrl_outputs_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -4743,7 +4769,6 @@ opentitan_test( srcs = ["sysrst_ctrl_in_irq_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -4783,7 +4808,6 @@ opentitan_test( srcs = ["sysrst_ctrl_ec_rst_l_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" """, test_harness = "//sw/host/tests/chip/sysrst_ctrl:sysrst_ctrl_ec_rst_l", @@ -4822,7 +4846,6 @@ opentitan_test( srcs = ["sysrst_ctrl_ulp_z3_wakeup_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -4865,7 +4888,6 @@ opentitan_test( srcs = ["sysrst_ctrl_reset_test.c"], cw310 = new_cw310_params( test_cmd = """ - --bitstream="{bitstream}" --bootstrap="{firmware}" "{firmware:elf}" """, @@ -4923,10 +4945,11 @@ opentitan_test( opentitan_test( name = "rv_core_ibex_isa_test_functest", srcs = ["//sw/device/silicon_creator/manuf/tests:idle_functest.c"], - cw310 = cw310_jtag_params( + cw310 = new_cw310_params( binaries = { ":rv_core_ibex_isa_test": "sram_program", }, + needs_jtag = True, otp = "//sw/device/silicon_creator/manuf/tests:otp_img_rom_exec_disabled_test_unlocked0", tags = ["manual"], test_cmd = "--elf={sram_program}", @@ -4940,16 +4963,18 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw310_sival": "hyper310", "//hw/top_earlgrey:silicon_creator": None, }, - hyper310 = hyper310_jtag_params( + hyper310 = new_cw310_params( binaries = { ":rv_core_ibex_isa_test": "sram_program", }, + needs_jtag = True, otp = "//sw/device/silicon_creator/manuf/tests:otp_img_rom_exec_disabled_test_unlocked0", tags = ["manual"], test_cmd = "--elf={sram_program}", test_harness = "//sw/host/tests/chip/rv_core_ibex_isa", ), - silicon = silicon_jtag_params( + silicon = silicon_params( + needs_jtag = True, tags = ["manual"], test_cmd = "--elf={firmware}", test_harness = "//sw/host/tests/chip/rv_core_ibex_isa", @@ -4983,10 +5008,11 @@ opentitan_binary( opentitan_test( name = "rv_core_ibex_epmp_test_functest", srcs = ["//sw/device/silicon_creator/manuf/tests:idle_functest.c"], - cw310 = cw310_jtag_params( + cw310 = new_cw310_params( binaries = { ":rv_core_ibex_epmp_test": "sram_program", }, + needs_jtag = True, otp = "//sw/device/silicon_creator/manuf/tests:otp_img_rom_exec_disabled_test_unlocked0", tags = ["manual"], test_cmd = "--elf={sram_program}", @@ -4995,20 +5021,12 @@ opentitan_test( exec_env = { # This test is not compatible with the test_rom because the test_rom # does not respect the exec_disabled OTP config word. - "//hw/top_earlgrey:fpga_cw310_sival": "hyper310", - "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "hyper310", + "//hw/top_earlgrey:fpga_cw310_sival": None, + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None, "//hw/top_earlgrey:fpga_cw310_rom_with_fake_keys": None, }, - hyper310 = hyper310_jtag_params( - binaries = { - ":rv_core_ibex_epmp_test": "sram_program", - }, - otp = "//sw/device/silicon_creator/manuf/tests:otp_img_rom_exec_disabled_test_unlocked0", - tags = ["manual"], - test_cmd = "--elf={sram_program}", - test_harness = "//sw/host/tests/chip/rv_core_ibex_epmp", - ), - silicon = silicon_jtag_params( + silicon = silicon_params( + needs_jtag = True, test_cmd = "--elf={firmware}", test_harness = "//sw/host/tests/chip/rv_core_ibex_epmp", ), @@ -5050,10 +5068,10 @@ opentitan_binary( opentitan_test( name = "uart_tx_rx_test", srcs = ["uart_tx_rx_test.c"], + broken = new_cw310_params(tags = ["broken"]), cw310 = new_cw310_params( otp = "//hw/ip/otp_ctrl/data/earlgrey_a0_skus/sival:otp_img_prod_manuf_personalized", test_cmd = " ".join([ - "--bitstream=\"{bitstream}\"", "--bootstrap=\"{firmware}\"", "--firmware-elf=\"{firmware:elf}\"", ]), @@ -5061,7 +5079,8 @@ opentitan_test( ), exec_env = { "//hw/top_earlgrey:fpga_cw310_sival": None, - "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None, + # FIXME broken in sival ROM_EXT, change this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", "//hw/top_earlgrey:silicon_creator": None, "//hw/top_earlgrey:silicon_owner_sival_rom_ext": "silicon_owner", "//hw/top_earlgrey:silicon_owner_prodc_rom_ext": "silicon_owner", @@ -5102,10 +5121,11 @@ opentitan_test( opentitan_test( name = "rv_core_ibex_mem_test_functest", srcs = ["//sw/device/silicon_creator/manuf/tests:idle_functest.c"], - cw310 = cw310_jtag_params( + cw310 = new_cw310_params( binaries = { ":rv_core_ibex_mem_test": "sram_program", }, + needs_jtag = True, otp = "//sw/device/silicon_creator/manuf/tests:otp_img_rom_exec_disabled_test_unlocked0", tags = [ "broken", @@ -5122,19 +5142,21 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "hyper310", "//hw/top_earlgrey:fpga_cw310_rom_with_fake_keys": None, }, - hyper310 = hyper310_jtag_params( + hyper310 = new_cw310_params( binaries = { ":rv_core_ibex_epmp_test": "sram_program", }, + needs_jtag = True, otp = "//sw/device/silicon_creator/manuf/tests:otp_img_rom_exec_disabled_test_unlocked0", tags = ["manual"], test_cmd = "--elf={sram_program}", test_harness = "//sw/host/tests/chip/rv_core_ibex_epmp", ), - silicon = silicon_jtag_params( + silicon = silicon_params( binaries = { ":rv_core_ibex_mem_test": "sram_program", }, + needs_jtag = True, tags = ["manual"], test_cmd = "--elf={sram_program}", test_harness = "//sw/host/tests/chip/rv_core_ibex_epmp", @@ -5176,16 +5198,17 @@ opentitan_binary( opentitan_test( name = "uart_baud_rate_test", srcs = ["uart_baud_rate_test.c"], + broken = new_cw310_params(tags = ["broken"]), cw310 = new_cw310_params( test_cmd = " ".join([ - "--bitstream=\"{bitstream}\"", "--bootstrap=\"{firmware}\"", "--firmware-elf=\"{firmware:elf}\"", ]), test_harness = "//sw/host/tests/chip/uart:uart_baud_rate", ), exec_env = dicts.add( - {"//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None}, + # FIXME broken in sival ROM_EXT, change this line when fixed. See #21706. + {"//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken"}, EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, ), silicon = silicon_params( @@ -5214,7 +5237,6 @@ opentitan_test( srcs = ["uart_loopback_test.c"], cw310 = new_cw310_params( test_cmd = " ".join([ - "--bitstream=\"{bitstream}\"", "--bootstrap=\"{firmware}\"", "--firmware-elf=\"{firmware:elf}\"", ]), diff --git a/sw/device/tests/crypto/BUILD b/sw/device/tests/crypto/BUILD index e70aa5cf96a05..f7242171c103a 100644 --- a/sw/device/tests/crypto/BUILD +++ b/sw/device/tests/crypto/BUILD @@ -10,6 +10,10 @@ load( "opentitan_test", "verilator_params", ) +load( + "@bazel_skylib//lib:dicts.bzl", + "dicts", +) load("@ot_python_deps//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) @@ -62,7 +66,14 @@ opentitan_test( opentitan_test( name = "aes_kwp_sideload_functest", srcs = ["aes_kwp_sideload_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), @@ -79,7 +90,14 @@ opentitan_test( opentitan_test( name = "aes_sideload_functest", srcs = ["aes_sideload_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "long", ), @@ -199,7 +217,14 @@ opentitan_test( opentitan_test( name = "ecdh_p256_sideload_functest", srcs = ["ecdh_p256_sideload_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "eternal", ), @@ -237,7 +262,14 @@ opentitan_test( opentitan_test( name = "ecdsa_p256_sideload_functest", srcs = ["ecdsa_p256_sideload_functest.c"], - exec_env = EARLGREY_TEST_ENVS, + broken = cw310_params(tags = ["broken"]), + exec_env = dicts.add( + EARLGREY_TEST_ENVS, + { + # FIXME broken in sival ROM_EXT, remove this line when fixed. See #21706. + "//hw/top_earlgrey:fpga_cw310_sival_rom_ext": "broken", + }, + ), verilator = verilator_params( timeout = "eternal", ), diff --git a/sw/device/tests/crypto/cryptotest/BUILD b/sw/device/tests/crypto/cryptotest/BUILD index 6eaff0df6ada2..475b51717bf04 100644 --- a/sw/device/tests/crypto/cryptotest/BUILD +++ b/sw/device/tests/crypto/cryptotest/BUILD @@ -30,7 +30,6 @@ opentitan_test( data = testvector_targets, test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """ + testvector_args, test_harness = "//sw/host/tests/crypto/aes_nist_kat:harness", ), @@ -82,7 +81,6 @@ opentitan_test( data = HASH_TESTVECTOR_TARGETS, test_cmd = """ --bootstrap={firmware} - --bitstream={bitstream} """ + HASH_TESTVECTOR_ARGS, test_harness = "//sw/host/tests/crypto/hash_kat:harness", ), diff --git a/sw/host/tests/manuf/provisioning/cp/BUILD b/sw/host/tests/manuf/provisioning/cp/BUILD index ce9b0387fdd12..5fa5cd65252ce 100644 --- a/sw/host/tests/manuf/provisioning/cp/BUILD +++ b/sw/host/tests/manuf/provisioning/cp/BUILD @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 load("@rules_rust//rust:defs.bzl", "rust_binary") -load("//rules/opentitan:openocd.bzl", "OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS") package(default_visibility = ["//visibility:public"]) @@ -13,7 +12,7 @@ rust_binary( srcs = ["src/main.rs"], data = [ "//sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup:sram_cp_provision", - ] + OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS, + ], deps = [ "//sw/host/opentitanlib", "//sw/host/provisioning/cp_lib", diff --git a/sw/host/tests/manuf/provisioning/ft/BUILD b/sw/host/tests/manuf/provisioning/ft/BUILD index d8c67eaf2a56b..54d3e2181e72e 100644 --- a/sw/host/tests/manuf/provisioning/ft/BUILD +++ b/sw/host/tests/manuf/provisioning/ft/BUILD @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 load("@rules_rust//rust:defs.bzl", "rust_binary") -load("//rules/opentitan:openocd.bzl", "OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS") load( "//sw/device/silicon_creator/manuf:provisioning_inputs.bzl", "FT_PERSONALIZE_KEYS", @@ -22,7 +21,7 @@ rust_binary( "//sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/binaries:ft_personalize_1_prod_signed", "//sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/binaries:ft_personalize_2_prod_signed", "//sw/device/silicon_creator/manuf/skus/earlgrey_a0/sival_bringup/binaries:ft_personalize_3_prod_signed", - ] + OPENTITANTOOL_OPENOCD_CMSIS_DATA_DEPS + FT_PERSONALIZE_KEYS, + ] + FT_PERSONALIZE_KEYS, deps = [ "//sw/host/opentitanlib", "//sw/host/provisioning/ft_lib",