Skip to content

Commit fd11b53

Browse files
committed
scripts: enhance test.py to allow blacklisting tests and specifying test manifest
Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
1 parent 6e20241 commit fd11b53

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

scripts/test.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
]
2424

2525
qemu_blacklist= [
26-
"tcp_close_without_reading_on_firecracker"
26+
"tcp_close_without_reading_on_fc"
2727
]
2828

2929
firecracker_blacklist= [
@@ -51,16 +51,18 @@ def __init__(self, name):
5151
test_files = []
5252
is_comment = re.compile("^[ \t]*(|#.*|\[manifest])$")
5353
is_test = re.compile("^/tests/tst-.*.so")
54-
with open('modules/tests/usr.manifest', 'r') as f:
55-
for line in f:
56-
line = line.rstrip();
57-
if is_comment.match(line): continue;
58-
components = line.split(": ", 2);
59-
guestpath = components[0].strip();
60-
hostpath = components[1].strip()
61-
if is_test.match(guestpath):
62-
test_files.append(guestpath);
63-
add_tests((TestRunnerTest(os.path.basename(x)) for x in test_files))
54+
55+
def collect_tests():
56+
with open(cmdargs.manifest, 'r') as f:
57+
for line in f:
58+
line = line.rstrip();
59+
if is_comment.match(line): continue;
60+
components = line.split(": ", 2);
61+
guestpath = components[0].strip();
62+
hostpath = components[1].strip()
63+
if is_test.match(guestpath):
64+
test_files.append(guestpath);
65+
add_tests((TestRunnerTest(os.path.basename(x)) for x in test_files))
6466

6567
def run_test(test):
6668
sys.stdout.write(" TEST %-35s" % test.name)
@@ -183,6 +185,7 @@ def run_tests():
183185
print(("OK (%d %s run, %.3f s)" % (len(tests_to_run), pluralize("test", len(tests_to_run)), duration)))
184186

185187
def main():
188+
collect_tests()
186189
while True:
187190
run_tests()
188191
if not cmdargs.repeat:
@@ -197,6 +200,8 @@ def main():
197200
parser.add_argument("-p", "--hypervisor", action="store", default="qemu", help="choose hypervisor to run: qemu, firecracker")
198201
parser.add_argument("--name", action="store", help="run all tests whose names match given regular expression")
199202
parser.add_argument("--run_options", action="store", help="pass extra options to run.py")
203+
parser.add_argument("-m", "--manifest", action="store", default="modules/tests/usr.manifest", help="test manifest")
204+
parser.add_argument("-b", "--blacklist", action="append", help="test to be blacklisted", default=[])
200205
cmdargs = parser.parse_args()
201206
set_verbose_output(cmdargs.verbose)
202207
if cmdargs.run_options != None:
@@ -207,4 +212,5 @@ def main():
207212
blacklist.extend(firecracker_blacklist)
208213
else:
209214
blacklist.extend(qemu_blacklist)
215+
blacklist.extend(cmdargs.blacklist)
210216
main()

scripts/tests/test_net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ def tcp_close_without_reading_on_qemu():
2828
tcp_close_without_reading('qemu', 'localhost')
2929

3030
@test
31-
def tcp_close_without_reading_on_firecracker():
31+
def tcp_close_without_reading_on_fc():
3232
tcp_close_without_reading('firecracker', '172.16.0.2')

0 commit comments

Comments
 (0)