Skip to content

Commit 1962fd1

Browse files
authored
Merge pull request #829 from mnordsletten/dev
Changes to filtering of test categories
2 parents d49910b + 6ddc68a commit 1962fd1

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

test/test.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
parser.add_argument("-c", "--clean-all", dest="clean", action="store_true",
2727
help="Run make clean before building test")
2828

29-
parser.add_argument("-s", "--skip", nargs="*", dest="skip",
29+
parser.add_argument("-s", "--skip", nargs="*", dest="skip", default=[],
3030
help="Tests to skip. Valid names: 'unit' (all unit tests), \
3131
'stress' (stresstest), 'integration' (all integration tests), examples \
3232
or the name of a single integration test folder (leaf node name, e.g. 'udp') ")
3333

34-
parser.add_argument("-t", "--tests", nargs="*", dest="tests",
34+
parser.add_argument("-t", "--tests", nargs="*", dest="tests", default=[],
3535
help="Tests to do. Valid names: see '--skip' ")
3636

3737
parser.add_argument("-f", "--fail-early", dest="fail", action="store_true",
@@ -45,11 +45,8 @@ def print_skipped(name, reason):
4545
print pretty.WARNING("* Skipping " + name)
4646
print " Reason: {0:40}".format(reason)
4747

48-
def valid_tests():
48+
def valid_tests(subfolder=None):
4949
"""Returns a list of all the valid integration tests in */integration/*"""
50-
if not args.skip:
51-
args.skip = []
52-
5350
if "integration" in args.skip:
5451
return []
5552

@@ -62,6 +59,9 @@ def valid_tests():
6259

6360
valid_tests = [ x for x in validate_all.valid_tests() if not x in args.skip ]
6461

62+
if subfolder:
63+
return [x for x in valid_tests if x.split('/')[0] == subfolder]
64+
6565
if args.tests:
6666
return [x for x in valid_tests if x.split("/")[-1] in args.tests]
6767

@@ -120,12 +120,15 @@ def wait_status(self):
120120

121121

122122

123-
def integration_tests():
123+
def integration_tests(subfolder=None):
124124
"""
125125
Loops over all valid tests as defined by ./validate_all.py. Runs them one by one and gives an update of the statuses at the end.
126126
"""
127127
global test_count
128-
valid = valid_tests()
128+
if subfolder:
129+
valid = valid_tests(subfolder)
130+
else:
131+
valid = valid_tests()
129132
if not valid:
130133
print pretty.WARNING("Integration tests skipped")
131134
return 0
@@ -219,17 +222,24 @@ def main():
219222

220223

221224
test_categories = ["integration", "examples", "unit", "stress"]
225+
if "integration" not in args.tests:
226+
test_folders = ["fs", "hw", "kernel", "net", "platform", "stl", "util"]
227+
else:
228+
test_folders = []
229+
tests_combined = test_categories + test_folders
222230
if args.tests:
223-
test_categories = [x for x in test_categories if x in args.tests or x == "integration"]
231+
test_categories = [x for x in tests_combined if x in args.tests ]
224232
if args.skip:
225-
test_categories = [x for x in test_categories if not x in args.skip]
233+
test_categories = [x for x in tests_combined if not x in args.skip]
234+
226235

227236
integration = integration_tests() if "integration" in test_categories else 0
228237
stress = stress_test() if "stress" in test_categories else 0
229238
unit = unit_tests() if "unit" in test_categories else 0
230239
examples = examples_working() if "examples" in test_categories else 0
240+
folders = integration_tests(subfolder=args.tests[0]) if args.tests[0] in test_categories else 0
231241

232-
status = max(integration, stress, unit, examples)
242+
status = max(integration, stress, unit, examples, folders)
233243

234244
if (not test_count):
235245
print "No tests selected"

0 commit comments

Comments
 (0)