-
Notifications
You must be signed in to change notification settings - Fork 0
/
runTest.py
executable file
·41 lines (34 loc) · 1.04 KB
/
runTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from hwlib.testbench import Testbench
import os
import sys
def importFile(fn):
mod = fn[2:-3].replace("/", ".")
__import__(mod)
for root, dirs, files in os.walk('./hwlib/'):
for file in files:
if file.endswith(".py"):
importFile(os.path.join(root, file))
showNetlist = False
if len(sys.argv) > 1:
tests = []
for testname in sys.argv[1:]:
if testname[0] == "-":
optname = testname[1:].lower()
if optname == "shownetlist":
showNetlist = True
elif testname not in Testbench.RegisteredTests:
print "Error: could not find test named \"%s\"" % testname
else:
tests.append(Testbench.RegisteredTests[testname])
for Test in tests:
print "%s running..." % str(Test)
t = Test()
if showNetlist:
t.printNetlist(sys.stdout)
t.run()
else:
print "Available tests:"
for testname in Testbench.RegisteredTests.keys():
print "\t%s" % testname