Skip to content

Commit

Permalink
Dynamic generation of the CI test matrix (#52)
Browse files Browse the repository at this point in the history
* Added a Python script for test name extraction

Signed-off-by: Maciej Kurc <[email protected]>

* Added dynamic building of the CI regression test matrix

Signed-off-by: Maciej Kurc <[email protected]>

* Changed rv32imac to rv32imc in the Makefile for tests

Signed-off-by: Maciej Kurc <[email protected]>

---------

Signed-off-by: Maciej Kurc <[email protected]>
  • Loading branch information
mkurc-ant authored Apr 24, 2023
1 parent fa91d66 commit 51be55d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/scripts/build_tests_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
import yaml

def main():

# Load and parse YAML description
file_name = "src/integration/stimulus/L0_regression.yml"
with open(file_name, "r") as fp:
yaml_root = yaml.safe_load(fp)

# Get test list
content = yaml_root["contents"][0]
tests = content["tests"]
paths = tests["paths"]

# Extract test names from paths
test_list = []
for path in paths:
parts = path.split("/")

for i, part in enumerate(parts):
if part == "test_suites" and i + 1 < len(parts):
test_list.append(parts[i+1])
break

# Output names
print(test_list)

if __name__ == "__main__":
main()
24 changes: 23 additions & 1 deletion .github/workflows/build-test-verilator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,31 @@ on:
workflow_dispatch:

jobs:
build_matrix:
name: Build Smoke Test matrix
runs-on: ubuntu-22.04
outputs:
test_names: ${{ steps.output-matrix.outputs.test_names }}
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
sudo apt-get update -qy && sudo apt-get install -qy --no-install-recommends \
python3-minimal python3-yaml
- name: Build matrix
id: output-matrix
run: |
echo "test_names=$(python3 .github/scripts/build_tests_matrix.py)" >> $GITHUB_OUTPUT
build_and_test:
name: Verilator Smoke Test
runs-on: ubuntu-22.04
needs: build_matrix

strategy:
fail-fast: false
matrix:
test_name: ${{fromJSON(needs.build_matrix.outputs.test_names)}}

env:
CARGO_INCREMENTAL: 0
Expand Down Expand Up @@ -123,4 +145,4 @@ jobs:
# Running a simple test to make sure that there aren't any elaboration issues
CALIPTRA_ROOT=$(pwd)
cd tools/scripts
make verilator CALIPTRA_ROOT=$CALIPTRA_ROOT TESTNAME=smoke_test_kv_uds_reset
make verilator CALIPTRA_ROOT=$CALIPTRA_ROOT TESTNAME=${{ matrix.test_name }}
2 changes: 1 addition & 1 deletion tools/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

TEST_CFLAGS = -g -O3
ABI = -mabi=ilp32 -march=rv32imac
ABI = -mabi=ilp32 -march=rv32imc

VERILATOR = verilator
GCC_PREFIX = riscv64-unknown-elf
Expand Down

0 comments on commit 51be55d

Please sign in to comment.