Skip to content

Commit b67996c

Browse files
committed
Add smoke tests for a selection of iCE40, ECP5, Xilinx, Intel boards.
The purpose of these tests is just to ensure that Amaranth changes do not blatantly break the boards repository. They are not intended to exhaustively test even a single board. Everything Gowin-related is removed due to Apicula's problematic use of numpy.
1 parent 5b2cb8e commit b67996c

File tree

8 files changed

+48
-14
lines changed

8 files changed

+48
-14
lines changed

.env.toolchain

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ NEXTPNR_ICE40=yowasp-nextpnr-ice40
44
ICEPACK=yowasp-icepack
55
NEXTPNR_ECP5=yowasp-nextpnr-ecp5
66
ECPPACK=yowasp-ecppack
7-
NEXTPNR_GOWIN=yowasp-nextpnr-gowin

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ jobs:
4242
- name: Install Amaranth release
4343
if: ${{ matrix.amaranth-version != 'git' }}
4444
run: |
45-
pip install 'amaranth==${{ matrix.amaranth-version }}'
45+
pip install 'amaranth[builtin-yosys] ==${{ matrix.amaranth-version }}'
4646
- name: Install Amaranth from git
4747
if: ${{ matrix.amaranth-version == 'git' }}
4848
run: |
49-
pip install git+https://github.com/amaranth-lang/amaranth.git
50-
- name: Test
49+
pip install 'amaranth[builtin-yosys] @ git+https://github.com/amaranth-lang/amaranth.git'
50+
- name: Run tests
5151
run: |
5252
python -m unittest discover -t . -s amaranth_boards -p '*.py'
5353
54-
required: # group all required workflows into one for the required status check
54+
required: # group all required workflows into one to avoid reconfiguring this in Actions settings
5555
needs:
5656
- test
57+
if: ${{ always() && !contains(needs.*.result, 'cancelled') }}
5758
runs-on: ubuntu-latest
5859
steps:
59-
- run: |
60-
true
60+
- run: ${{ contains(needs.*.result, 'failure') && 'false' || 'true' }}

amaranth_boards/arty_a7.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import subprocess
3+
import unittest
34

45
from amaranth.build import *
56
from amaranth.vendor import XilinxPlatform
@@ -225,6 +226,12 @@ class ArtyA7_100Platform(_ArtyA7Platform):
225226
device = "xc7a100ti"
226227

227228

229+
class TestCase(unittest.TestCase):
230+
def test_smoke(self):
231+
from .test.blinky import Blinky
232+
ArtyA7_35Platform().build(Blinky(), do_build=False)
233+
234+
228235
if __name__ == "__main__":
229236
from .test.blinky import *
230237
ArtyA7_35Platform().build(Blinky(), do_program=True)

amaranth_boards/de10_nano.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import subprocess
3+
import unittest
34

45
from amaranth.build import *
56
from amaranth.vendor import IntelPlatform
@@ -90,6 +91,12 @@ def toolchain_program(self, products, name):
9091
"--operation", "P;" + bitstream_filename + "@2"])
9192

9293

94+
class TestCase(unittest.TestCase):
95+
def test_smoke(self):
96+
from .test.blinky import Blinky
97+
DE10NanoPlatform().build(Blinky(), do_build=False)
98+
99+
93100
if __name__ == "__main__":
94101
from .test.blinky import Blinky
95102
DE10NanoPlatform().build(Blinky(), do_program=True)

amaranth_boards/ice40_hx8k_b_evn.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import subprocess
3+
import unittest
34

45
from amaranth.build import *
56
from amaranth.vendor import LatticeICE40Platform
@@ -63,6 +64,12 @@ def toolchain_program(self, products, name):
6364
subprocess.check_call([iceprog, "-S", bitstream_filename])
6465

6566

67+
class TestCase(unittest.TestCase):
68+
def test_smoke(self):
69+
from .test.blinky import Blinky
70+
ICE40HX8KBEVNPlatform().build(Blinky(), do_build=False)
71+
72+
6673
if __name__ == "__main__":
67-
from .test.blinky import *
74+
from .test.blinky import Blinky
6875
ICE40HX8KBEVNPlatform().build(Blinky(), do_program=True)

amaranth_boards/ulx3s.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import argparse
33
import subprocess
44
import shutil
5+
import unittest
56

67
from amaranth.build import *
78
from amaranth.vendor import LatticeECP5Platform
@@ -44,7 +45,7 @@ class _ULX3SPlatform(LatticeECP5Platform):
4445
Resource("button_right", 0, Pins("H16", dir="i"), Attrs(IO_TYPE="LVCMOS33", PULLMODE="DOWN")),
4546

4647
# FTDI connection.
47-
UARTResource(0,
48+
UARTResource(0,
4849
rx="M1", tx="L4", rts="M3", dtr="N1", role="dce",
4950
attrs=Attrs(IO_TYPE="LVCMOS33")
5051
),
@@ -103,7 +104,7 @@ class _ULX3SPlatform(LatticeECP5Platform):
103104
Resource("diff_gpio", 1, DiffPairs("A10", "A11"), Attrs(IO_TYPE="LVCMOS33")),
104105
Resource("diff_gpio", 2, DiffPairs("A9", "B10"), Attrs(IO_TYPE="LVCMOS33")),
105106
Resource("diff_gpio", 3, DiffPairs("B9", "C10"), Attrs(IO_TYPE="LVCMOS33")),
106-
107+
107108
# HDMI (only TX, due to the top bank of ECP5 only supporting diff. outputs)
108109
Resource("hdmi", 0,
109110
Subsignal("cec", Pins("A18", dir="io"),
@@ -177,16 +178,22 @@ class ULX3S_85F_Platform(_ULX3SPlatform):
177178
device = "LFE5U-85F"
178179

179180

181+
class TestCase(unittest.TestCase):
182+
def test_smoke(self):
183+
from .test.blinky import Blinky
184+
ULX3S_45F_Platform().build(Blinky(), do_build=False)
185+
186+
180187
if __name__ == "__main__":
181188
from .test.blinky import *
182-
189+
183190
variants = {
184191
'12F': ULX3S_12F_Platform,
185192
'25F': ULX3S_25F_Platform,
186193
'45F': ULX3S_45F_Platform,
187194
'85F': ULX3S_85F_Platform
188195
}
189-
196+
190197
# Figure out which FPGA variant we want to target...
191198
parser = argparse.ArgumentParser()
192199
parser.add_argument('variant', choices=variants.keys())

amaranth_boards/versa_ecp5.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import subprocess
3+
import unittest
34

45
from amaranth.build import *
56
from amaranth.vendor import LatticeECP5Platform
@@ -171,6 +172,12 @@ def toolchain_program(self, products, name):
171172
])
172173

173174

175+
class TestCase(unittest.TestCase):
176+
def test_smoke(self):
177+
from .test.blinky import Blinky
178+
VersaECP5Platform().build(Blinky(), do_build=False)
179+
180+
174181
if __name__ == "__main__":
175-
from .test.blinky import *
182+
from .test.blinky import Blinky
176183
VersaECP5Platform().build(Blinky(), do_program=True)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ toolchain = [
4040
"yowasp-yosys",
4141
"yowasp-nextpnr-ice40",
4242
"yowasp-nextpnr-ecp5",
43-
"yowasp-nextpnr-gowin",
4443
]
4544

4645
[tool.pdm.scripts]
4746
_.env_file = ".env.toolchain"
47+
test.cmd = "python -m unittest discover -t . -s amaranth_boards -p *.py"

0 commit comments

Comments
 (0)