test/test_gen: update

This commit is contained in:
Florent Kermarrec 2020-02-12 11:17:38 +01:00
parent fcadd60cea
commit ddcbc33e63
1 changed files with 16 additions and 9 deletions

View File

@ -1,15 +1,22 @@
# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr> # This file is Copyright (c) 2019-2020 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD # License: BSD
import unittest import unittest
import os 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): class TestExamples(unittest.TestCase):
def test(self): def test_udp_s7phyrgmii(self):
for phy in ["mii", "gmii", "rgmii"]: errors = build_config("udp_s7phyrgmii")
for core in ["wishbone", "udp"]: self.assertEqual(errors, 0)
os.system("rm -rf {}/build".format(root_dir))
os.system("python3 {}/liteeth/gen.py --phy={} --core={}".format(root_dir, phy, core)) def test_wishbone_mii(self):
self.assertEqual(os.path.isfile("{}/build/gateware/liteeth_core.v".format(root_dir)), True) errors = build_config("wishbone_mii")
self.assertEqual(errors, 0)