From 2f3c886280f259d179806fa3eac1f6a0f2b72d77 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 28 Jul 2021 12:13:40 +0200 Subject: [PATCH] test/test_targets: Rename test_simple to test_platforms and add test_targets. --- test/test_targets.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/test/test_targets.py b/test/test_targets.py index 77366e7..e73e31d 100644 --- a/test/test_targets.py +++ b/test/test_targets.py @@ -13,20 +13,9 @@ from migen import * from litex.soc.integration.builder import * -def build_test(socs): - errors = 0 - for soc in socs: - os.system("rm -rf build") - builder = Builder(soc, output_dir="./build", compile_software=False, compile_gateware=False) - builder.build() - errors += not os.path.isfile("./build/gateware/top.v") - os.system("rm -rf build") - return errors - - class TestTargets(unittest.TestCase): # Build simple design for all platforms. - def test_simple(self): + def test_platforms(self): # Collect platforms. platforms = [] for file in os.listdir("./litex_boards/platforms/"): @@ -43,5 +32,25 @@ python3 -m litex_boards.targets.simple litex_boards.platforms.{} \ --no-compile-software \ --no-compile-gateware \ --uart-name="stub" \ +""".format(name) + subprocess.check_call(cmd, shell=True) + + # Build default configuration for all targets. + def test_targets(self): + # Collect targets. + targets = [] + for file in os.listdir("./litex_boards/targets/"): + if file.endswith(".py"): + file = file.replace(".py", "") + if file not in ["__init__", "simple"]: + targets.append(file) + + # Test targets. + for name in targets: + with self.subTest(target=name): + cmd = """\ +python3 -m litex_boards.targets.{} \ + --no-compile-software \ + --no-compile-gateware \ """.format(name) subprocess.check_call(cmd, shell=True)