|
a/run_tests |
|
b/run_tests |
|
... |
|
... |
27 |
import textwrap
|
27 |
import textwrap
|
28 |
|
28 |
|
29 |
|
29 |
|
30 |
def run_one(cmd, **popen_kwargs):
|
30 |
def run_one(cmd, **popen_kwargs):
|
31 |
print '{} running {} {}'.format(threading.current_thread(), cmd, popen_kwargs)
|
31 |
print '{} running {} {}'.format(threading.current_thread(), cmd, popen_kwargs)
|
|
|
32 |
sys.stdout.flush()
|
|
|
33 |
|
32 |
all_popen_kwargs = dict(shell=True, stderr=subprocess.STDOUT,
|
34 |
all_popen_kwargs = dict(shell=True, stderr=subprocess.STDOUT,
|
33 |
stdout=subprocess.PIPE,
|
35 |
stdout=subprocess.PIPE,
|
34 |
bufsize=1, # 1 == line-buffered
|
36 |
bufsize=1, # 1 == line-buffered
|
35 |
close_fds='posix' in sys.builtin_module_names)
|
37 |
close_fds='posix' in sys.builtin_module_names)
|
36 |
all_popen_kwargs.update(popen_kwargs)
|
38 |
all_popen_kwargs.update(popen_kwargs)
|
|
... |
|
... |
40 |
sys.stdout.write(line)
|
42 |
sys.stdout.write(line)
|
41 |
sys.stdout.flush()
|
43 |
sys.stdout.flush()
|
42 |
# wait for completion and get remainder of output
|
44 |
# wait for completion and get remainder of output
|
43 |
out_remainder, _ = proc.communicate()
|
45 |
out_remainder, _ = proc.communicate()
|
44 |
sys.stdout.write(out_remainder)
|
46 |
sys.stdout.write(out_remainder)
|
|
|
47 |
sys.stdout.flush()
|
|
|
48 |
print 'finished {} {}'.format(cmd, popen_kwargs)
|
45 |
sys.stdout.flush()
|
49 |
sys.stdout.flush()
|
46 |
return proc
|
50 |
return proc
|
47 |
|
51 |
|
48 |
|
52 |
|
49 |
def run_many(cmds, processes=None):
|
53 |
def run_many(cmds, processes=None):
|