2018-05-12 01:32:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2019-06-14 17:43:41 +02:00
|
|
|
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
|
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
2019-04-26 21:21:50 +02:00
|
|
|
#
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import unittest
|
2020-10-06 00:56:12 +02:00
|
|
|
import sys, os
|
2019-05-31 19:51:42 +02:00
|
|
|
sys.path.append(os.getenv("OPENRAM_HOME"))
|
2016-11-08 18:57:35 +01:00
|
|
|
import globals
|
|
|
|
|
|
|
|
|
|
(OPTS, args) = globals.parse_args()
|
|
|
|
|
del sys.argv[1:]
|
|
|
|
|
|
2019-05-31 19:51:42 +02:00
|
|
|
from testutils import *
|
2016-11-15 17:57:06 +01:00
|
|
|
header(__file__, OPTS.tech_name)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# get a list of all files in the tests directory
|
|
|
|
|
files = os.listdir(sys.path[0])
|
|
|
|
|
|
2020-06-10 01:09:15 +02:00
|
|
|
# load a file with all tests to skip in a given technology
|
|
|
|
|
# since tech_name is dynamically loaded, we can't use @skip directives
|
|
|
|
|
try:
|
2020-06-10 19:23:05 +02:00
|
|
|
skip_file_name = "{0}/tests/skip_tests_{1}.txt".format(os.getenv("OPENRAM_HOME"), OPTS.tech_name)
|
2020-06-10 01:33:59 +02:00
|
|
|
skip_file = open(skip_file_name, "r")
|
2020-06-10 01:09:15 +02:00
|
|
|
skip_tests = skip_file.read().splitlines()
|
|
|
|
|
for st in skip_tests:
|
|
|
|
|
debug.warning("Skipping: " + st)
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
skip_tests = []
|
|
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
# assume any file that ends in "test.py" in it is a regression test
|
|
|
|
|
nametest = re.compile("test\.py$", re.IGNORECASE)
|
2020-06-10 01:09:15 +02:00
|
|
|
all_tests = list(filter(nametest.search, files))
|
|
|
|
|
filtered_tests = list(filter(lambda i: i not in skip_tests, all_tests))
|
|
|
|
|
filtered_tests.sort()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# import all of the modules
|
|
|
|
|
filenameToModuleName = lambda f: os.path.splitext(f)[0]
|
2020-06-10 01:09:15 +02:00
|
|
|
moduleNames = map(filenameToModuleName, filtered_tests)
|
2016-11-08 18:57:35 +01:00
|
|
|
modules = map(__import__, moduleNames)
|
|
|
|
|
suite = unittest.TestSuite()
|
|
|
|
|
load = unittest.defaultTestLoader.loadTestsFromModule
|
|
|
|
|
suite.addTests(map(load, modules))
|
2018-07-11 01:39:32 +02:00
|
|
|
|
2020-10-06 00:56:12 +02:00
|
|
|
test_runner = unittest.TextTestRunner(verbosity=2, stream=sys.stderr)
|
2018-07-11 18:51:28 +02:00
|
|
|
test_result = test_runner.run(suite)
|
2018-07-11 20:59:24 +02:00
|
|
|
|
|
|
|
|
import verify
|
|
|
|
|
verify.print_drc_stats()
|
|
|
|
|
verify.print_lvs_stats()
|
2020-10-06 00:56:12 +02:00
|
|
|
verify.print_pex_stats()
|
2018-07-11 20:59:24 +02:00
|
|
|
|
2018-07-11 18:51:28 +02:00
|
|
|
sys.exit(not test_result.wasSuccessful())
|