forked from cirosantilli/linux-kernel-module-cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgem5-regression
executable file
·57 lines (52 loc) · 1.59 KB
/
gem5-regression
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
54
55
56
57
#!/usr/bin/env python3
from shell_helpers import LF
import os
import pathlib
import subprocess
import common
from shell_helpers import LF
class Main(common.LkmcCliFunction):
def __init__(self):
super().__init__(
description='''\
Run gem5 regression tests.
https://cirosantilli.com/linux-kernel-module-cheat#gem5-regression-tests
'''
)
self.add_argument(
'--cmd',
default='run',
help='''
List tests instead of running them.
''',
)
self.add_argument(
'extra_args',
metavar='extra-args',
nargs='*',
)
def timed_main(self):
if self.env['cmd'] == 'run':
extra_args = [
'--base-dir', self.env['gem5_source_dir'], LF,
'--bin-path', self.env['gem5_test_binaries_dir'], LF,
'--build-dir', self.env['gem5_build_build_dir'], LF,
'-j', str(self.env['nproc']), LF,
'-t', str(self.env['nproc']), LF,
]
else:
extra_args = []
return self.sh.run_cmd(
[
os.path.join(self.env['gem5_source_dir'], 'tests', 'main.py'), LF,
self.env['cmd'], LF,
'--isa', self.env['gem5_arch'], LF,
'--variant', self.env['gem5_build_type'], LF,
] +
extra_args +
self.sh.add_newlines(self.env['extra_args']),
cwd=os.path.join(self.env['gem5_source_dir'], 'tests'),
raise_on_failure=False,
)
if __name__ == '__main__':
Main().cli()