2021-01-04 08:35:45 -05:00
|
|
|
#
|
|
|
|
# This file is part of LiteX-Boards.
|
|
|
|
#
|
2021-07-28 06:03:37 -04:00
|
|
|
# This file is Copyright (c) 2017-2021 Florent Kermarrec <florent@enjoy-digital.fr>
|
2019-06-24 06:38:58 -04:00
|
|
|
# This file is Copyright (c) 2019 Tim 'mithro' Ansell <me@mith.ro>
|
2020-08-23 09:00:17 -04:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
2019-06-24 06:38:58 -04:00
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import unittest
|
|
|
|
import os
|
|
|
|
|
|
|
|
from migen import *
|
|
|
|
|
|
|
|
from litex.soc.integration.builder import *
|
|
|
|
|
|
|
|
class TestTargets(unittest.TestCase):
|
2021-10-01 07:53:05 -04:00
|
|
|
excluded_platforms = ["qmtech_daughterboard", "quicklogic_quickfeather"]
|
|
|
|
excluded_targets = ["simple", "quicklogic_quickfeather"]
|
|
|
|
|
2021-07-28 06:03:37 -04:00
|
|
|
# Build simple design for all platforms.
|
2021-07-28 06:13:40 -04:00
|
|
|
def test_platforms(self):
|
2021-07-28 06:03:37 -04:00
|
|
|
# Collect platforms.
|
2019-06-24 06:38:58 -04:00
|
|
|
platforms = []
|
2021-07-28 06:03:37 -04:00
|
|
|
for file in os.listdir("./litex_boards/platforms/"):
|
|
|
|
if file.endswith(".py"):
|
|
|
|
file = file.replace(".py", "")
|
2021-10-01 07:53:05 -04:00
|
|
|
if file not in ["__init__"] + self.excluded_platforms:
|
2021-07-28 06:03:37 -04:00
|
|
|
platforms.append(file)
|
2019-06-24 06:38:58 -04:00
|
|
|
|
2021-07-28 06:03:37 -04:00
|
|
|
# Test platforms with simple design.
|
2020-02-03 03:44:22 -05:00
|
|
|
for name in platforms:
|
|
|
|
with self.subTest(platform=name):
|
2021-09-09 05:36:18 -04:00
|
|
|
os.system("rm -rf build")
|
2019-06-24 06:38:58 -04:00
|
|
|
cmd = """\
|
2021-07-28 06:03:37 -04:00
|
|
|
python3 -m litex_boards.targets.simple litex_boards.platforms.{} \
|
2019-06-24 06:38:58 -04:00
|
|
|
--no-compile-software \
|
|
|
|
--no-compile-gateware \
|
2020-01-13 11:00:01 -05:00
|
|
|
--uart-name="stub" \
|
2021-07-28 06:13:40 -04:00
|
|
|
""".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", "")
|
2021-10-01 07:53:05 -04:00
|
|
|
if file not in ["__init__"] + self.excluded_targets:
|
2021-07-28 06:13:40 -04:00
|
|
|
targets.append(file)
|
|
|
|
|
|
|
|
# Test targets.
|
|
|
|
for name in targets:
|
|
|
|
with self.subTest(target=name):
|
2021-09-09 05:36:18 -04:00
|
|
|
os.system("rm -rf build")
|
2021-07-28 06:13:40 -04:00
|
|
|
cmd = """\
|
|
|
|
python3 -m litex_boards.targets.{} \
|
|
|
|
--no-compile-software \
|
|
|
|
--no-compile-gateware \
|
2020-02-03 03:44:22 -05:00
|
|
|
""".format(name)
|
2019-06-24 06:38:58 -04:00
|
|
|
subprocess.check_call(cmd, shell=True)
|