diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 86a3681edc55cf..fa049cd1dc1048 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -173,7 +173,7 @@ jobs: displayName: Verible FPV (Verilog lint) - job: sw_build - displayName: Earl Grey SW Build & Test + displayName: Earl Grey SW Build # Build and test Software for Earl Grey toplevel design timeoutInMinutes: 180 dependsOn: lint @@ -190,17 +190,17 @@ jobs: 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 - # Set the remote cache GCP key path - bash: | set -x -e # Check the entire build graph for conflicts in loading or analysis # phases. For context, see issue #18726. ci/bazelisk.sh build --nobuild //... - # This command builds all software and runs all unit tests that run on the - # host, with a few exceptions: + + # This command selects the unit tests to be executed: # * It excludes //quality because that's the purview of `slow_lints`. # * It excludes //sw/otbn/crypto because that's tested in `otbn_crypto_tests`. # * It excludes the tests from //third_party/riscv-compliance because @@ -225,18 +225,83 @@ jobs: --define DISABLE_VERILATOR_BUILD=true \ -- "rdeps(//..., kind(bitstream_splice, //...))" \ >> "${TARGET_PATTERN_FILE}" + + # Build unit tests and their dependencies. ci/bazelisk.sh build \ --build_tests_only=false \ --define DISABLE_VERILATOR_BUILD=true \ --test_tag_filters=-broken,-cw310,-verilator,-dv \ --target_pattern_file="${TARGET_PATTERN_FILE}" + # Export the "TARGET_PATTERN_FILE" variable to an Azure variable. + echo "##vso[task.setvariable variable=targetPatternFile;isoutput=true]${TARGET_PATTERN_FILE}" + displayName: Build SW + name: prepareTargetPattern + - bash: | + set -x -e + . util/build_consts.sh + # copy the rom to a specific location + ROM_TARGET="${BIN_DIR}/sw/device/silicon_creator/rom" + mkdir -p "${ROM_TARGET}" + # To make the correct query to get the ELF output file, we have to start + # from a node that is built for our usual target platform (the host) and + # follow the edges in the graph across the configuration transition (to + # riscv32). The deps 2 levels down from the opentitan_rom_binary include + # all the important files. + ROM_REAL_TARGETS="deps(//sw/device/silicon_creator/rom:rom_with_real_keys_from_src_fpga_cw310, 2)" + ROM_FAKE_TARGETS="deps(//sw/device/silicon_creator/rom:rom_with_fake_keys_fpga_cw310, 2)" + 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)) + cp -Lvt "${ROM_TARGET}" "${ROM_FAKE_FILES[@]}" "${ROM_REAL_FILES[@]}" + - template: ci/upload-artifacts-template.yml + parameters: + includePatterns: + - "/sw/***" + - publish: '$(prepareTargetPattern.targetPatternFile)' + artifact: target_pattern + +- job: sw_test + displayName: Earl Grey SW Test + # Build and test Software for Earl Grey toplevel design + timeoutInMinutes: 180 + dependsOn: sw_build + condition: succeeded() + pool: ci-public + variables: + - name: targetPatternFile + value: $[ dependencies.sw_build.outputs['prepareTargetPattern.targetPatternFile'] ] + - name: bazelCacheGcpKeyPath + value: '' + steps: + - template: ci/checkout-template.yml + - template: ci/install-package-dependencies.yml + - template: ci/download-artifacts-template.yml + parameters: + downloadPartialBuildBinFrom: + - sw_build + - download: current + artifact: target_pattern + - 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 + - bash: | + set -x -e + export GCP_BAZEL_CACHE_KEY=$(bazelCacheGcpKeyPath) + export TARGET_PATTERN_FILE=$(Pipeline.Workspace)/target_pattern/$(targetPatternFile) + ci/bazelisk.sh test \ --build_tests_only=false \ --test_output=errors \ --define DISABLE_VERILATOR_BUILD=true \ --test_tag_filters=-broken,-cw310,-verilator,-dv \ --target_pattern_file="${TARGET_PATTERN_FILE}" - displayName: Build & test SW + displayName: Test SW - template: ci/publish-bazel-test-results.yml - bash: | set -x -e