-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·46 lines (38 loc) · 1.69 KB
/
test.py
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
#!/usr/bin/env python3
import argparse
import tests
import tests.requirements as requirements
import tests.templates as templates
import tests.util as util
def get_args():
parser = argparse.ArgumentParser(description='C2Rust testsuite.')
parser.add_argument('--verbose', dest='verbose', action='store_true',
default=False,
help='Enable verbose output')
parser.add_argument('--stages', dest='stages', action='store',
nargs='*', type=str, default=None, choices=tests.Test.STAGES,
help='Only test specified stage(s)')
parser.add_argument('--print-requirements', metavar='PLATFORM',
dest='requirements', choices=['ubuntu'],
action='store', type=str, default=None,
help='Print requirements for platform and exit')
parser.add_argument('--ignore-requirements',
action='store_true',
help='Ignore test requirements')
parser.add_argument('projects', metavar='project', type=str, nargs='*',
help='Project to test (defaults to all projects if none specified)')
return parser.parse_args()
def print_requirements(args):
packages = sorted(requirements.collect(conf, args.requirements))
packages = " \\\n".join(packages)
print(packages)
if __name__ == "__main__":
args = get_args()
conf = tests.Config(args)
if args.requirements:
print_requirements(args)
elif not conf.project_dirs and len(args.projects) > 0:
util.die(f"no such project: {args.project}")
else:
templates.autogen(conf)
tests.run_tests(conf)