Skip to content

Commit

Permalink
Update testing README with tuttest (#2563)
Browse files Browse the repository at this point in the history
This PR refactors verifying `README` with `tuttest`. Now CI:
- checks Synlig and tools installation from `README`,
- checks `README` examples,
- verifies downloadable release correctness.

This PR also removes some deprecated `README` tests.
  • Loading branch information
tgorochowik authored Sep 16, 2024
2 parents 6506579 + a65d54c commit 4955ac3
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 158 deletions.
32 changes: 32 additions & 0 deletions .ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,38 @@ ibex_synth_f4pga_large_design:
- eval $SETUP_TOOLS && export PATH="$PATH:$TOOLS_HOME/bin"
- ./tests/scripts/run_large_designs.sh --name ibex_f4pga load_submodules run

check_README:
stage: "Optional tests"
only:
- main
- merge_requests
variables:
SCALENODE_RAM: 8000
SCALENODE_CPU: 6
script:
- echo "##/ Install Prerequisites \##"
- apt update && apt install -y pipx git wget
- pipx install git+https://github.com/antmicro/tuttest#egg=tuttest
- export PATH=$PATH:/root/.local/bin
- echo "##/ Set pipefail \##"
- set -o pipefail
- echo "##/ Install dependencies \##"
- tuttest README.md install-dependencies | bash -
- echo "##/ Test make install \##"
- tuttest README.md make-install | bash -
- echo "##/ Test make tools \##"
- tuttest README.md get-haskell | bash -
- tuttest README.md install-tools | bash -
- echo "##/ Test counter.sv synthesis \##"
- tuttest README.md counter.sv > counter.sv
- tuttest README.md synthesis-example | grep ">" | cut -d ">" -f 2 | synlig
- echo "##/ Test parsing multiple files \##"
- tuttest README.md example-multiple-files | synlig
- echo "##/ Test testing scripts commands \##"
- tuttest README.md formal-verification-help | bash -
- tuttest README.md large-designs-help | bash -
- tuttest README.md parsing-tests-help | bash -

bsg_test_diff:
stage: "Optional tests"
dependencies: [build_plugin]
Expand Down
194 changes: 45 additions & 149 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,60 +377,10 @@ jobs:
overwrite: true
file_glob: true

# Synlig requires yosys version 0.40 or later
# which is currently not available in debian repositories.
# This test can be uncommented when required version will be available.
# test-release-with-packaged-yosys:
# name: Release Package Installation Test
# runs-on: [self-hosted, Linux, X64]
# container: debian:sid
# needs: release
# env:
# DEBIAN_FRONTEND: noninteractive
# PIPX_BIN_DIR: /usr/local/bin
#
# steps:
# - name: Prepare Repository
# uses: actions/checkout@v2
# with:
# fetch-depth: 1
#
# - name: Install Prerequisites
# run: |
# apt update -qq
# apt install -y --no-install-recommends pipx git
# pipx install git+https://github.com/antmicro/tuttest#egg=tuttest
#
# - name: Install Dependencies
# run: |
# tuttest README.md install-yosys-debian | bash -
#
# - name: Install Plugin
# run: |
# tuttest README.md download-plugin | bash -
# tuttest README.md install-plugin | bash -
#
# - name: Load Plugin
# run: |
# tuttest README.md load-plugin | yosys -Q | tee log.txt
# grep ^ERROR log.txt || exit 0
# exit 1
#
# - name: Test Plugin
# run: |
# tuttest README.md example-verilog | bash -
# tuttest README.md example-multiple-files | yosys
#
# - name: Test sv2v pull and build
# run: |
# export PATH=`pwd`/out/current/bin:$PATH
# tuttest README.md sv2v-update | bash -
# tuttest README.md sv2v-build | bash -

test-readme-install-from-source:
name: Test "Installation from source" from README
verify-README:
name: Verify README Correctness (Installation From Sources)
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: debian:trixie
container: debian:bookworm
env:
DEBIAN_FRONTEND: noninteractive
PIPX_BIN_DIR: /usr/local/bin
Expand All @@ -444,126 +394,72 @@ jobs:
- name: Install Prerequisites
run: |
apt update -qq
apt install -y --no-install-recommends pipx git
apt install -y --no-install-recommends pipx git wget
pipx install git+https://github.com/antmicro/tuttest#egg=tuttest
- name: Set Pipefail
run: |
set -o pipefail
- name: Install Dependencies
run: |
tuttest README.md dependencies | bash -
tuttest README.md install-dependencies | bash -
- name: Test Synlig Installation
run: |
tuttest README.md make-install | bash -
- name: Test Tools Installation
run: |
tuttest README.md get-haskell | bash -
tuttest README.md install-tools | bash -
- name: Build Binaries
- name: Test counter.sv Synthesis
run: |
tuttest README.md build-binaries | bash -
tuttest README.md counter.sv > counter.sv
tuttest README.md synthesis-example | grep ">" | cut -d ">" -f 2 | synlig
- name: Test Binaries
- name: Test Parsing Multiple Files
run: |
tuttest README.md load-plugin | (. <(tuttest README.md path-setup) && yosys)
(tuttest README.md path-setup; tuttest README.md example-verilog) | bash -
(tuttest README.md path-setup; tuttest README.md example-uhdm-ver1) | bash -
(tuttest README.md path-setup; tuttest README.md example-uhdm-ver2) | bash -
tuttest README.md example-multiple-files | (. <(tuttest README.md path-setup) && yosys)
# Synlig requires yosys version 0.40 or later
# which is currently not available in debian repositories.
# This test can be uncommented when required version will be available.
# test-plugin-with-packaged-yosys:
# name: Test With Packaged Yosys
# runs-on: [self-hosted, Linux, X64]
# container: debian:sid
# needs: build-binaries
# env:
# DEBIAN_FRONTEND: noninteractive
# PIPX_BIN_DIR: /usr/local/bin
#
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: false
# fetch-depth: 1
#
# - name: Download binaries
# uses: actions/download-artifact@v2
# with:
# name: binaries-debian
#
# - name: Extract
# run: tar -xf binaries-debian.tar
#
# - name: Install Yosys & Plugin
# run: |
# apt update -q
# apt install -y yosys yosys-dev
# ./install_plugin.sh
#
# - name: Load Plugin
# run: |
# yosys -Q -m systemverilog \
# -p "help read_systemverilog" \
# -p "help read_uhdm" 2>&1 | tee log.txt
# grep ^ERROR log.txt || exit 0
# exit 1

test-plugin-with-bundled-yosys:
name: Test With Bundled Yosys
tuttest README.md example-multiple-files | synlig
- name: Test Testing Scripts Commands
run: |
tuttest README.md formal-verification-help | bash -
tuttest README.md large-designs-help | bash -
tuttest README.md parsing-tests-help | bash -
test-package:
name: Verify README Correctness (Download And Run Release)
needs: release
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: debian:trixie
needs: build-binaries
container: debian:bookworm
env:
DEBIAN_FRONTEND: noninteractive
PIPX_BIN_DIR: /usr/local/bin

steps:
- uses: actions/checkout@v3
- name: Prepare Repository
uses: actions/checkout@v2
with:
submodules: false
fetch-depth: 1

- name: Install Prerequisites
run: |
apt update -qq
apt install -y --no-install-recommends pipx git
apt install -y --no-install-recommends pipx jq curl wget
pipx install git+https://github.com/antmicro/tuttest#egg=tuttest
- name: Install Dependencies
- name: Set Pipefail
run: |
# Don't need all the build dependencies, but will ensure everything
# yosys needs at runtime will be installed
tuttest README.md dependencies | bash -
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: binaries-plugin
set -o pipefail
- name: Extract
run: |
# Extract into a different directory than it was built in
# to ensure no path dependencies
tar --one-top-level -xf binaries-plugin.tar
- name: Verify yosys-config
- name: Download Release And Set PATH
run: |
# Check that the directories reported by yosys-config exist
echo "yosys-config reports data directory is" $(binaries-debian/out/current/bin/yosys-config --datdir)
ls $(binaries-debian/out/current/bin/yosys-config --datdir) > /dev/null
tuttest README.md download-release | bash -
eval $(tuttest README.md path-setup)
- name: Load Plugin
- name: Test counter.sv Synthesis
run: |
binaries-debian/out/current/bin/yosys \
-Q -m systemverilog \
-p "help read_systemverilog" \
-p "help read_uhdm" 2>&1 | tee log.txt
grep ^ERROR log.txt || exit 0
exit 1
# needed for test linting
upload-event-file:
name: Upload GHA event file
runs-on: ubuntu-latest
steps:
- run: cp "$GITHUB_EVENT_PATH" ./event.json
- name: Upload event file as artifact
uses: actions/upload-artifact@v4
with:
name: event.json
path: event.json
tuttest README.md counter.sv > counter.sv
tuttest README.md synthesis-example | grep ">" | cut -d ">" -f 2 | synlig
Loading

0 comments on commit 4955ac3

Please sign in to comment.