@@ -69,6 +69,7 @@ def __init__(self, path, clean=False, command=['python', 'test.py'], name=None):
6969 self .path_ = path
7070 self .output_ = []
7171 self .clean = clean
72+ self .properties_ = {"time_sensitive" : False , "intrusive" : False }
7273 # Extract category and type from the path variable
7374 # Category is linked to the top level folder e.g. net, fs, hw
7475 # Type is linked to the type of test e.g. integration, unit, stress
@@ -97,7 +98,7 @@ def __init__(self, path, clean=False, command=['python', 'test.py'], name=None):
9798 # Check if the test is valid or not
9899 self .check_valid ()
99100
100- # Check if the test is time sensitive
101+ # Check for test properties in vm.json
101102 json_file = os .path .join (self .path_ , "vm.json" )
102103 json_file = os .path .abspath (json_file )
103104 try :
@@ -106,11 +107,10 @@ def __init__(self, path, clean=False, command=['python', 'test.py'], name=None):
106107 except IOError :
107108 json_output = []
108109
109- if 'time_sensitive' in json_output :
110- self .time_sensitive_ = True
111- else :
112- self .time_sensitive_ = False
113-
110+ for test_property in self .properties_ .keys ():
111+ if test_property in json_output :
112+ if json_output [test_property ]:
113+ self .properties_ [test_property ] = True
114114
115115
116116 def __str__ (self ):
@@ -125,7 +125,7 @@ def __str__(self):
125125 'type_: {x[type_]} \n '
126126 'skip: {x[skip_]} \n '
127127 'skip_reason: {x[skip_reason_]} \n '
128- 'time_sensitive : {x[time_sensitive_ ]} \n '
128+ 'properties : {x[properties_ ]} \n '
129129 ).format (x = self .__dict__ )
130130
131131 def start (self ):
@@ -277,7 +277,7 @@ def integration_tests(tests):
277277 if len (tests ) == 0 :
278278 return 0
279279
280- time_sensitive_tests = [ x for x in tests if x .time_sensitive_ ]
280+ time_sensitive_tests = [ x for x in tests if x .properties_ [ "time_sensitive" ] ]
281281 tests = [ x for x in tests if x not in time_sensitive_tests ]
282282
283283 # Print info before starting to run
@@ -410,7 +410,17 @@ def filter_tests(all_tests, arguments):
410410 tests_added = [ x for x in all_tests
411411 if x .type_ in add_args
412412 or x .category_ in add_args
413- or x .name_ in add_args ]
413+ or x .name_ in add_args ]
414+
415+ # Deal with specific properties
416+ add_properties = list (set (add_args ).intersection (all_tests [0 ].properties_ .keys ()))
417+ for test in all_tests :
418+ for argument in add_properties :
419+ if test .properties_ [argument ] and test not in tests_added :
420+ tests_added .append (test )
421+
422+
423+
414424
415425 # 2) Remove tests defined by the skip argument
416426 print pretty .INFO ("Tests marked skip on command line" ), ", " .join (skip_args )
@@ -420,6 +430,13 @@ def filter_tests(all_tests, arguments):
420430 or x .name_ in skip_args
421431 or x .skip_ ]
422432
433+ # Deal with specific properties
434+ skip_properties = list (set (skip_args ).intersection (all_tests [0 ].properties_ .keys ()))
435+ for test in tests_added :
436+ for argument in skip_properties :
437+ if test .properties_ [argument ] and test not in skipped_tests :
438+ skipped_tests .append (test )
439+
423440 # Print all the skipped tests
424441 print_skipped (skipped_tests )
425442
0 commit comments