From a255bc28ed07d236b3b0d24d0de6bda1820d0363 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sat, 23 Nov 2019 11:16:32 +0100 Subject: [PATCH] test: replace Makefile with test_examples, also integrate fast_scope_arty example --- test/Makefile | 11 ----------- test/test_examples.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) delete mode 100644 test/Makefile create mode 100644 test/test_examples.py diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index c4dbfee..0000000 --- a/test/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -COREDIR = ../ -PYTHON = python3 - -CMD = PYTHONPATH=$(COREDIR) $(PYTHON) - -examples: - cd ../examples && $(PYTHON) make.py -t simple -p de0nano -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t simple -p kc705 -Ob run False build-bitstream - cd ../examples && $(PYTHON) make.py -t core build-core - -all: examples diff --git a/test/test_examples.py b/test/test_examples.py new file mode 100644 index 0000000..141b7e6 --- /dev/null +++ b/test/test_examples.py @@ -0,0 +1,32 @@ +# This file is Copyright (c) 2019 Florent Kermarrec +# License: BSD + +import unittest +import os +import subprocess + +from litescope.software.dump import * + +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 test_simple_de0nano(self): + os.system("rm -rf {}/build".format(root_dir)) + os.system("python3 {} -t simple -p de0nano -Ob run False build-bitstream".format(make_script)) + self.assertEqual(os.path.isfile("{}/build/litescopesoc_de0nano.v".format(root_dir)), True) + + def test_simple_705(self): + os.system("rm -rf {}/build".format(root_dir)) + os.system("python3 {} -t simple -p kc705 -Ob run False build-bitstream".format(make_script)) + self.assertEqual(os.path.isfile("{}/build/litescopesoc_kc705.v".format(root_dir)), True) + + def test_core(self): + os.system("rm -rf {}/build".format(root_dir)) + os.system("python3 {} -t core build-core".format(make_script)) + self.assertEqual(os.path.isfile("{}/build/litescope.v".format(root_dir)), True) + + def test_fast_scope_arty(self): + os.system("rm -rf {}/build".format(root_dir)) + os.system("python3 {}/examples/fast_scope_arty.py no-compile".format(root_dir)) + self.assertEqual(os.path.isfile("{}/build/top.v".format(root_dir)), True)