From ddcbc33e63cad7cf9ce6e347564d5487e8abd3d7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 12 Feb 2020 11:17:38 +0100 Subject: [PATCH] test/test_gen: update --- test/test_gen.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/test/test_gen.py b/test/test_gen.py index 08d263b..7b4a417 100644 --- a/test/test_gen.py +++ b/test/test_gen.py @@ -1,15 +1,22 @@ -# This file is Copyright (c) 2019 Florent Kermarrec +# This file is Copyright (c) 2019-2020 Florent Kermarrec # License: BSD import unittest import os -root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..") +def build_config(name): + errors = 0 + os.system("rm -rf examples/build") + os.system("cd examples && python3 ../liteeth/gen.py {}.yml".format(name)) + errors += not os.path.isfile("examples/build/gateware/liteeth_core.v") + os.system("rm -rf examples/build") + return errors -class TestGen(unittest.TestCase): - def test(self): - for phy in ["mii", "gmii", "rgmii"]: - for core in ["wishbone", "udp"]: - os.system("rm -rf {}/build".format(root_dir)) - os.system("python3 {}/liteeth/gen.py --phy={} --core={}".format(root_dir, phy, core)) - self.assertEqual(os.path.isfile("{}/build/gateware/liteeth_core.v".format(root_dir)), True) +class TestExamples(unittest.TestCase): + def test_udp_s7phyrgmii(self): + errors = build_config("udp_s7phyrgmii") + self.assertEqual(errors, 0) + + def test_wishbone_mii(self): + errors = build_config("wishbone_mii") + self.assertEqual(errors, 0)