Skip to content

Commit

Permalink
[ci] Check that the FPGA jobs have exclusive and exhaustive
Browse files Browse the repository at this point in the history
Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Aug 27, 2024
1 parent 0b26bff commit 1f4b9ba
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
18 changes: 18 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,24 @@ jobs:
parameters: { job_name: execute_manuf_fpga_tests_cw340, display_name: CW340 Manufacturing Tests, bitstream: chip_earlgrey_cw340,
interface: cw340, board: cw340, tag_filters: "manuf,-hyper310", timeout: 60 }

# Verify that we have indeed run all jobs without duplication
- template: ci/verify-fpga-jobs.yml
parameters:
fpga_tags: cw310|cw340
fpga_jobs:
- execute_test_rom_fpga_tests_cw310
- execute_rom_fpga_tests_cw310
- execute_rom_ext_fpga_tests_cw310
- execute_sival_fpga_tests_cw310
- execute_sival_rom_ext_fpga_tests_cw310
- execute_manuf_fpga_tests_cw310
- execute_test_rom_fpga_tests_cw340
- execute_rom_fpga_tests_cw340
- execute_rom_ext_fpga_tests_cw340
- execute_sival_fpga_tests_cw340
- execute_sival_rom_ext_fpga_tests_cw340
- execute_manuf_fpga_tests_cw340

- job: deploy_release_artifacts
displayName: Package & deploy release
pool:
Expand Down
63 changes: 63 additions & 0 deletions ci/verify-fpga-jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Azure template for an FPGA test job verification.
# This script downloads the target pattern file from all FPGA jobs that are
# dependencies and performs some checks on them.

parameters:
# List of all FPGA jobs
- name: 'fpga_jobs'
type: object
# Test tag filter to find all FPGA tests
- name: 'fpga_tags'
type: string

jobs:
- job: verify_fpga_jobs
displayName: Verify FPGA jobs
pool:
vmImage: ubuntu-20.04
dependsOn: ${{ parameters.fpga_jobs }}
# Run even if dependencies failed: some flaky tests might cause the job to fail
# but we still want to verify the FPGA jobs.
condition: succeededOrFailed()
steps:
- ${{ each job in parameters.fpga_jobs }}:
- task: DownloadPipelineArtifact@2
inputs:
buildType: current
targetPath: '$(Pipeline.Workspace)/verify_fpga_jobs/${{ job }}'
artifact: "${{ job }}"
patterns: target_pattern_file.txt
displayName: Download target pattern files from job ${{ job }}
- bash: |
ls -R $(Pipeline.Workspace)/verify_fpga_jobs
- bash: |
# Find and display all duplicates:
# - for each target file and each line, print '<job_name> <target>'
# - then sort by the target name
# - then keep all duplicated lines
pattern_files=$(find $(Pipeline.Workspace)/verify_fpga_jobs -name target_pattern_file.txt)
awk '{ print(gensub(/.*\/(.+)\/target_pattern_file.txt/, "\\1", "g", FILENAME) " " $0) }' $pattern_files | sort -k2 | uniq -D -f1 > duplicates.txt
if [ -s duplicates.txt ]; then
echo "The following tests ran in two or more jobs:"
cat duplicates.txt
false
fi
displayName: Checking for duplicate test runs
- bash: |
# Find and display tests that did not run:
./ci/scripts/run-bazel-test-query.sh all_fpga.txt "${{ parameters.fpga_tags }}",-manual,-broken,-skip_in_ci //... @manufacturer_test_hooks//...
sort -o all_fpga.txt all_fpga.txt
pattern_files=$(find $(Pipeline.Workspace)/verify_fpga_jobs -name target_pattern_file.txt)
sort $pattern_files > all_run.txt
comm -23 all_fpga.txt all_run.txt > missing.txt
if [ -s missing.txt ]; then
echo "The following tests did not run in any job:"
cat missing.txt
false
fi
displayName: Checking for missing test runs
condition: succeededOrFailed()

0 comments on commit 1f4b9ba

Please sign in to comment.