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-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", "")
|
|
|
|
if file not in ["__init__", "qmtech_daughterboard"]:
|
|
|
|
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):
|
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", "")
|
|
|
|
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 \
|
2020-02-03 03:44:22 -05:00
|
|
|
""".format(name)
|
2019-06-24 06:38:58 -04:00
|
|
|
subprocess.check_call(cmd, shell=True)
|