test: replace Makefile with test_examples, also integrate fast_scope_arty example

This commit is contained in:
Florent Kermarrec 2019-11-23 11:16:32 +01:00
parent 63c15167e1
commit a255bc28ed
2 changed files with 32 additions and 11 deletions

View File

@ -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

32
test/test_examples.py Normal file
View File

@ -0,0 +1,32 @@
# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
# 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)