aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
authorGravatar David G. Quintas <dgq@google.com>2017-02-16 10:22:25 -0800
committerGravatar GitHub <noreply@github.com>2017-02-16 10:22:25 -0800
commit4fe0d977ed1d04cbee6b44d6f30e56e5133287b5 (patch)
treedebdb12b40b5212ebffbe43e415782d573c7c56e /tools/run_tests
parent87682ef26d821b434beec73eb3c6a3487f124c1e (diff)
parent0392025bff4f845607af1c8120117c70a629af67 (diff)
Merge pull request #9733 from dgquintas/runtests_errors
Better error reporting in run_tests.py
Diffstat (limited to 'tools/run_tests')
-rwxr-xr-xtools/run_tests/run_tests.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 8b76193cbe..3d9b538ca7 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -80,6 +80,13 @@ def platform_string():
_DEFAULT_TIMEOUT_SECONDS = 5 * 60
+def run_shell_command(cmd, env=None, cwd=None):
+ try:
+ subprocess.check_output(cmd, shell=True, env=env, cwd=cwd)
+ except subprocess.CalledProcessError as e:
+ print("Error while running command '%s'. Exit status %d. Output:\n%s",
+ e.cmd, e.returncode, e.output)
+ raise
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
class Config(object):
@@ -1199,7 +1206,7 @@ for spec in args.update_submodules:
cwd = 'third_party/%s' % submodule
def git(cmd, cwd=cwd):
print('in %s: git %s' % (cwd, cmd))
- subprocess.check_call('git %s' % cmd, cwd=cwd, shell=True)
+ run_shell_command('git %s' % cmd, cwd=cwd)
git('fetch')
git('checkout %s' % branch)
git('pull origin %s' % branch)
@@ -1207,7 +1214,7 @@ for spec in args.update_submodules:
need_to_regenerate_projects = True
if need_to_regenerate_projects:
if jobset.platform_string() == 'linux':
- subprocess.check_call('tools/buildgen/generate_projects.sh', shell=True)
+ run_shell_command('tools/buildgen/generate_projects.sh')
else:
print('WARNING: may need to regenerate projects, but since we are not on')
print(' Linux this step is being skipped. Compilation MAY fail.')
@@ -1276,9 +1283,7 @@ if args.use_docker:
if not args.travis:
env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins.
- subprocess.check_call(['tools/run_tests/dockerize/build_docker_and_run_tests.sh'],
- shell=True,
- env=env)
+ run_shell_command('tools/run_tests/dockerize/build_docker_and_run_tests.sh', env=env)
sys.exit(0)
_check_arch_option(args.arch)