This repository was archived by the owner on Mar 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathrun_tests.py
More file actions
executable file
·53 lines (41 loc) · 1.39 KB
/
Copy pathrun_tests.py
File metadata and controls
executable file
·53 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import os
import subprocess
import sys
BASE_DIR = os.path.realpath(os.path.dirname(__file__))
def run(*args, **kwargs):
cwd = kwargs.pop("cwd", None)
environ = kwargs.pop("environ", os.environ)
assert not kwargs
print("+ [running] {}".format(list(args)))
subprocess.check_call(list(args), cwd=cwd, env=environ)
def main(argv):
for path in argv[1:] or os.listdir(BASE_DIR):
if (
not os.path.isdir(os.path.join(BASE_DIR, path)) or
not os.path.exists(os.path.join(BASE_DIR, path, "tests"))
):
continue
print("+ [{}]".format(path))
run(
"make", "-C", BASE_DIR,
"TEST_NAME={}_tests".format(path.replace("-", "_")),
"TEST_PATH={}".format(path),
"RUSTFLAGS=-Dwarnings",
)
# TODO: qemu
run(
"cargo", "test", "--no-default-features", "--", "--test-threads=1",
cwd=os.path.join(BASE_DIR, path),
environ=dict(
os.environ,
KERNEL_MODULE=os.path.join(BASE_DIR, "testmodule.ko"),
RUSTFLAGS="-Dwarnings",
CARGO_TARGET_DIR=os.path.relpath(
os.path.join(BASE_DIR, "target-test"),
os.path.join(BASE_DIR, path)
),
)
)
if __name__ == "__main__":
main(sys.argv)