diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index 7f24427..0000000 --- a/test/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -PYTHON = python3 - -CMD = $(PYTHON) - -examples: - cd ../examples && $(PYTHON) make.py -t base -s BaseSoC -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t base -s BaseSoCDevel -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t udp -s UDPSoC -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t udp -s UDPSoCDevel -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t etherbone -s EtherboneSoC -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t etherbone -s EtherboneSoCDevel -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t tty -s TTYSoC -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t tty -s TTYSoCDevel -p kc705 -Ob run False build-bitstream - -all: examples \ No newline at end of file diff --git a/test/test_examples.py b/test/test_examples.py new file mode 100644 index 0000000..4c0d4f6 --- /dev/null +++ b/test/test_examples.py @@ -0,0 +1,36 @@ +# This file is Copyright (c) 2019 Florent Kermarrec +# License: BSD + +import unittest +import os + +root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..") +make_script = os.path.join(root_dir, "examples", "make.py") + +class TestExamples(unittest.TestCase): + def example_test(self, t, s): + os.system("rm -rf {}/build".format(root_dir)) + cmd = "python3 " + make_script + " " + cmd += "-t {} ".format(t) + cmd += "-s {} ".format(s) + cmd += "-p kc705 " + cmd += "-Ob run False " + cmd += "build-bitstream" + os.system(cmd) + self.assertEqual(os.path.isfile("{}/build/{}_kc705.v".format(root_dir, s.lower())), True) + + def test_base_example(self): + self.example_test("base", "BaseSoC") + self.example_test("base", "BaseSoCDevel") + + def test_udp_example(self): + self.example_test("udp", "UDPSoC") + self.example_test("udp", "UDPSoCDevel") + + def test_etherbone_example(self): + self.example_test("etherbone", "EtherboneSoC") + self.example_test("etherbone", "EtherboneSoCDevel") + + def test_tty_example(self): + self.example_test("tty", "TTYSoC") + self.example_test("tty", "TTYSoCDevel")