verify.py (12937:e79dbd84705f) verify.py (13000:c53f8c81369b)
1#!/usr/bin/env python2
2#
3# Copyright 2018 Google, Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30from __future__ import print_function
31
32import argparse
33import functools
34import inspect
35import itertools
36import json
37import logging
1#!/usr/bin/env python2
2#
3# Copyright 2018 Google, Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30from __future__ import print_function
31
32import argparse
33import functools
34import inspect
35import itertools
36import json
37import logging
38import multiprocessing.pool
38import os
39import subprocess
40import sys
41
42script_path = os.path.abspath(inspect.getfile(inspect.currentframe()))
43script_dir = os.path.dirname(script_path)
44config_path = os.path.join(script_dir, 'config.py')
45

--- 69 unchanged lines hidden (view full) ---

115 scons_args = list(self.args) + targets
116 scons(*scons_args)
117
118class RunPhase(TestPhaseBase):
119 name = 'execute'
120 number = 2
121
122 def run(self, tests):
39import os
40import subprocess
41import sys
42
43script_path = os.path.abspath(inspect.getfile(inspect.currentframe()))
44script_dir = os.path.dirname(script_path)
45config_path = os.path.join(script_dir, 'config.py')
46

--- 69 unchanged lines hidden (view full) ---

116 scons_args = list(self.args) + targets
117 scons(*scons_args)
118
119class RunPhase(TestPhaseBase):
120 name = 'execute'
121 number = 2
122
123 def run(self, tests):
123 for test in tests:
124 if test.compile_only:
125 continue
126 args = [
124 parser = argparse.ArgumentParser()
125 parser.add_argument('--timeout', type=int, metavar='SECONDS',
126 help='Time limit for each run in seconds.',
127 default=0)
128 parser.add_argument('-j', type=int, default=1,
129 help='How many tests to run in parallel.')
130 args = parser.parse_args(self.args)
131
132 timeout_cmd = [
133 'timeout',
134 '--kill-after', str(args.timeout * 2),
135 str(args.timeout)
136 ]
137 def run_test(test):
138 cmd = []
139 if args.timeout:
140 cmd.extend(timeout_cmd)
141 cmd.extend([
127 test.full_path(),
128 '-red', test.m5out_dir(),
129 '--listener-mode=off',
130 config_path
142 test.full_path(),
143 '-red', test.m5out_dir(),
144 '--listener-mode=off',
145 config_path
131 ]
132 subprocess.check_call(args)
146 ])
147 subprocess.check_call(cmd)
133
148
149 runnable = filter(lambda t: not t.compile_only, tests)
150 if args.j == 1:
151 map(run_test, runnable)
152 else:
153 tp = multiprocessing.pool.ThreadPool(args.j)
154 map(lambda t: tp.apply_async(run_test, (t,)), runnable)
155 tp.close()
156 tp.join()
157
134class VerifyPhase(TestPhaseBase):
135 name = 'verify'
136 number = 3
137
138 def run(self, tests):
139 for test in tests:
140 if test.compile_only:
141 continue

--- 86 unchanged lines hidden ---
158class VerifyPhase(TestPhaseBase):
159 name = 'verify'
160 number = 3
161
162 def run(self, tests):
163 for test in tests:
164 if test.compile_only:
165 continue

--- 86 unchanged lines hidden ---