sanitycheck: fix support for unit tests

When we moved to yaml, we missed porting the 'unit' architecture. This
is now being added again.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-10-09 13:42:28 -04:00 committed by Kumar Gala
commit 86c8e2330d
3 changed files with 26 additions and 18 deletions

View file

@ -0,0 +1,6 @@
identifier: unit_testing
name: Unit Testing
type: unit
arch: unit
testing:
default: true

View file

@ -17,7 +17,7 @@ mapping:
type: str type: str
"type": "type":
type: str type: str
enum: [ 'mcu', 'qemu', 'sim' ] enum: [ 'mcu', 'qemu', 'sim', 'unit' ]
"arch": "arch":
type: str type: str
"toolchain": "toolchain":

View file

@ -1233,7 +1233,7 @@ class TestSuite:
os.path.join(os.environ['ZEPHYR_BASE'], os.path.join(os.environ['ZEPHYR_BASE'],
"scripts", "sanity_chk", "sanitycheck-tc-schema.yaml")) "scripts", "sanity_chk", "sanitycheck-tc-schema.yaml"))
def __init__(self, board_root, testcase_roots, outdir, coverage): def __init__(self, board_root_list, testcase_roots, outdir, coverage):
# Keep track of which test cases we've filtered out and why # Keep track of which test cases we've filtered out and why
discards = {} discards = {}
self.arches = {} self.arches = {}
@ -1245,8 +1245,6 @@ class TestSuite:
self.discards = None self.discards = None
self.coverage = coverage self.coverage = coverage
board_root = os.path.abspath(board_root)
for testcase_root in testcase_roots: for testcase_root in testcase_roots:
testcase_root = os.path.abspath(testcase_root) testcase_root = os.path.abspath(testcase_root)
@ -1279,6 +1277,9 @@ class TestSuite:
self.testcases[tc.name] = tc self.testcases[tc.name] = tc
for board_root in board_root_list:
board_root = os.path.abspath(board_root)
debug("Reading platform configuration files under %s..." % board_root) debug("Reading platform configuration files under %s..." % board_root)
for dirpath, dirnames, filenames in os.walk(board_root): for dirpath, dirnames, filenames in os.walk(board_root):
for filename in filenames: for filename in filenames:
@ -1528,7 +1529,7 @@ class TestSuite:
discards[instance] = "Not in testcase toolchain whitelist" discards[instance] = "Not in testcase toolchain whitelist"
continue continue
if toolchain and toolchain not in plat.supported_toolchains: if toolchain and toolchain not in plat.supported_toolchains and tc.type != 'unit':
discards[instance] = "Not supported by the toolchain" discards[instance] = "Not supported by the toolchain"
continue continue
@ -1898,8 +1899,9 @@ def parse_arguments():
"testcase.yaml files under here will be processed. May be " "testcase.yaml files under here will be processed. May be "
"called multiple times. Defaults to the 'samples' and " "called multiple times. Defaults to the 'samples' and "
"'tests' directories in the Zephyr tree.") "'tests' directories in the Zephyr tree.")
parser.add_argument("-A", "--board-root", board_root_list = ["%s/boards" % ZEPHYR_BASE , "%s/scripts/sanity_chk/boards" % ZEPHYR_BASE]
default="%s/boards" % ZEPHYR_BASE, parser.add_argument("-A", "--board-root", action="append",
default=board_root_list,
help="Directory to search for board configuration files. All .yaml " help="Directory to search for board configuration files. All .yaml "
"files in the directory will be processed.") "files in the directory will be processed.")
parser.add_argument("-z", "--size", action="append", parser.add_argument("-z", "--size", action="append",