diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40699986..076ec499 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,16 +7,22 @@ jobs: test: strategy: matrix: - os: ['ubuntu'] + os: ['ubuntu', 'windows'] pyver: ['3.8', '3.9', '3.10', '3.11', '3.12'] + exclude: + - os: 'windows' + pyver: '3.8' + - os: 'windows' + pyver: '3.9' + - os: 'windows' + pyver: '3.10' + - os: 'windows' + pyver: '3.11' runs-on: ${{ matrix.os }}-latest name: ${{ matrix.os }} | ${{ matrix.pyver }} steps: - name: Checkout repository uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - name: Set up Python ${{ matrix.pyver }} uses: actions/setup-python@v5 with: @@ -24,4 +30,6 @@ jobs: - name: Install dependencies run: pip install . && pip install pytest - name: Run tests - run: source tests/mocks/source-me.sh && make test + run: | + make test + cd examples/projects && bash regress.sh --notool diff --git a/examples/projects/diamond.py b/examples/projects/diamond.py index 0128d7c3..464be7ff 100644 --- a/examples/projects/diamond.py +++ b/examples/projects/diamond.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Diamond(odir=f'results/diamond/{args.source}/{args.board}') @@ -43,8 +46,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/ise.py b/examples/projects/ise.py index 279a5db0..1955d34d 100644 --- a/examples/projects/ise.py +++ b/examples/projects/ise.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Ise(odir=f'results/ise/{args.source}/{args.board}') @@ -45,8 +48,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/libero.py b/examples/projects/libero.py index dd2c5861..8bb94b7a 100644 --- a/examples/projects/libero.py +++ b/examples/projects/libero.py @@ -14,6 +14,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Libero(odir=f'results/libero/{args.source}/{args.board}') @@ -43,8 +46,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/openflow.py b/examples/projects/openflow.py index 56a6b2ab..98e2e999 100644 --- a/examples/projects/openflow.py +++ b/examples/projects/openflow.py @@ -16,6 +16,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Openflow(odir=f'results/openflow/{args.source}/{args.board}') @@ -59,8 +62,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/quartus.py b/examples/projects/quartus.py index eb7e889e..258fa8e6 100644 --- a/examples/projects/quartus.py +++ b/examples/projects/quartus.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Quartus(odir=f'results/quartus/{args.source}/{args.board}') @@ -44,8 +47,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/regress.sh b/examples/projects/regress.sh index 45b7d848..a260b52e 100644 --- a/examples/projects/regress.sh +++ b/examples/projects/regress.sh @@ -13,7 +13,24 @@ TOOLS["vivado"]="zybo arty" SOURCES=("vlog" "vhdl" "slog") -SPECIFIED_TOOL=$1 +SPECIFIED_TOOL="" +NOTOOL=false +while [[ "$#" -gt 0 ]]; do + case $1 in + --tool) + SPECIFIED_TOOL="$2" + shift 2 + ;; + --notool) + NOTOOL=true + shift + ;; + *) + echo "Invalid option: $1" + exit 1 + ;; + esac +done for TOOL in "${!TOOLS[@]}"; do if [[ -n "$SPECIFIED_TOOL" && "$TOOL" != "$SPECIFIED_TOOL" ]]; then @@ -26,7 +43,11 @@ for TOOL in "${!TOOLS[@]}"; do continue fi echo "> $TOOL - $BOARD - $SOURCE" - python3 $TOOL.py --board $BOARD --source $SOURCE + if [[ "$NOTOOL" == true ]]; then + python3 $TOOL.py --board $BOARD --source $SOURCE --notool + else + python3 $TOOL.py --board $BOARD --source $SOURCE + fi done done done diff --git a/examples/projects/vivado.py b/examples/projects/vivado.py index af497b91..33fba3f3 100644 --- a/examples/projects/vivado.py +++ b/examples/projects/vivado.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Vivado(odir=f'results/vivado/{args.source}/{args.board}') @@ -50,8 +53,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/tests/test_tools.py b/tests/test_tools.py index ad28632a..98f00055 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -85,9 +85,9 @@ def generate(tool, part): prj.add_hook('postbit', 'HOOK16') try: prj.make() - except Exception: + except RuntimeError: pass try: prj.prog() - except Exception: + except RuntimeError: pass