Add DRAMSys' first python unit test.
This commit is contained in:
28
DRAMSys/tests/unit_test.py
Normal file
28
DRAMSys/tests/unit_test.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import unittest
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
import multiprocessing
|
||||
|
||||
devnull = None
|
||||
|
||||
|
||||
class TestBuild(unittest.TestCase):
|
||||
def test_build_project(self):
|
||||
""" The project's build process should succeed """
|
||||
builddir = "../../build"
|
||||
if os.path.exists(builddir):
|
||||
shutil.rmtree(builddir)
|
||||
os.makedirs(builddir)
|
||||
os.chdir(builddir)
|
||||
self.assertEqual(subprocess.call(['qmake',
|
||||
'../DRAMSys/dram.vp.system.pro'], stdout=devnull,
|
||||
stderr=devnull), 0)
|
||||
makejobs = "-j" + str(multiprocessing.cpu_count())
|
||||
self.assertEqual(subprocess.call(['make', makejobs], stdout=devnull,
|
||||
stderr=devnull), 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open(os.devnull, 'wb') as devnull:
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user