You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2016/12/08 17:25:31 UTC
kudu git commit: dist-test: allow collecting the tmp dir of failed
tests
Repository: kudu
Updated Branches:
refs/heads/master fe4f157b1 -> 2c43f9596
dist-test: allow collecting the tmp dir of failed tests
When debugging certain types of failures, especially with randomized
tests, it can be very useful to grab the TEST_TMPDIR of any failed
runs, since that includes the WAL, data files, etc, of any minicluster
servers used in the test.
This adds a --collect-tmpdir flag to our dist_test wrapper which causes
the dist test task to create a tarball of its test tmpdir if the task
fails. It puts the tarball in the log directory which is considered the
"artifact" of the task, so that the 'fetch' command downloads them.
Change-Id: I57d42d93e2459bafebe433ade3a9aa7a45eaeabe
Reviewed-on: http://gerrit.cloudera.org:8080/2336
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/2c43f959
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/2c43f959
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/2c43f959
Branch: refs/heads/master
Commit: 2c43f95963c19ed56f2d0857d5cbae17a6932f06
Parents: fe4f157
Author: Todd Lipcon <to...@apache.org>
Authored: Sat Feb 27 16:39:38 2016 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Thu Dec 8 17:25:15 2016 +0000
----------------------------------------------------------------------
build-support/dist_test.py | 16 +++++++++++-----
build-support/run_dist_test.py | 9 ++++++++-
2 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/2c43f959/build-support/dist_test.py
----------------------------------------------------------------------
diff --git a/build-support/dist_test.py b/build-support/dist_test.py
index 0be81fe..a91d7d3 100755
--- a/build-support/dist_test.py
+++ b/build-support/dist_test.py
@@ -39,7 +39,7 @@ import subprocess
import time
TEST_TIMEOUT_SECS = int(os.environ.get('TEST_TIMEOUT_SECS', '900'))
-ARTIFACT_ARCHIVE_GLOBS = ["build/*/test-logs/*"]
+ARTIFACT_ARCHIVE_GLOBS = ["build/*/test-logs/**/*"]
ISOLATE_SERVER = os.environ.get('ISOLATE_SERVER',
"http://isolate.cloudera.org:4242/")
DIST_TEST_HOME = os.environ.get('DIST_TEST_HOME',
@@ -222,7 +222,8 @@ def ldd_deps(exe):
def create_archive_input(staging, argv,
- disable_sharding=False):
+ disable_sharding=False,
+ collect_tmpdir=False):
"""
Generates .gen.json and .isolate files corresponding to the
test command 'argv'. The outputs are placed in the specified
@@ -275,6 +276,8 @@ def create_archive_input(staging, argv,
'-e', 'KUDU_ALLOW_SLOW_TESTS=%s' % os.environ.get('KUDU_ALLOW_SLOW_TESTS', 1),
'-e', 'KUDU_COMPRESS_TEST_OUTPUT=%s' % \
os.environ.get('KUDU_COMPRESS_TEST_OUTPUT', 0)]
+ if collect_tmpdir:
+ command += ["--collect-tmpdir"]
command.append('--')
command += argv[1:]
@@ -386,8 +389,8 @@ def run_all_tests(parser, options):
staging = StagingDir.new()
for command in commands:
create_archive_input(staging, command,
- disable_sharding=options.disable_sharding)
-
+ disable_sharding=options.disable_sharding,
+ collect_tmpdir=options.collect_tmpdir)
run_isolate(staging)
create_task_json(staging, flaky_test_set=get_flakies())
submit_tasks(staging, options)
@@ -405,7 +408,8 @@ def loop_test(parser, options):
command = ["run-test.sh", options.cmd] + options.args
staging = StagingDir.new()
create_archive_input(staging, command,
- disable_sharding=options.disable_sharding)
+ disable_sharding=options.disable_sharding,
+ collect_tmpdir=options.collect_tmpdir)
run_isolate(staging)
create_task_json(staging, options.num_instances)
submit_tasks(staging, options)
@@ -427,6 +431,8 @@ def main(argv):
p = argparse.ArgumentParser()
p.add_argument("--disable-sharding", dest="disable_sharding", action="store_true",
help="Disable automatic sharding of tests", default=False)
+ p.add_argument("--collect-tmpdir", dest="collect_tmpdir", action="store_true",
+ help="Collect the test tmpdir of failed tasks as test artifacts", default=False)
p.add_argument("--no-wait", dest="no_wait", action="store_true",
help="Return without waiting for the job to complete", default=False)
sp = p.add_subparsers()
http://git-wip-us.apache.org/repos/asf/kudu/blob/2c43f959/build-support/run_dist_test.py
----------------------------------------------------------------------
diff --git a/build-support/run_dist_test.py b/build-support/run_dist_test.py
index 08a9856..8694785 100755
--- a/build-support/run_dist_test.py
+++ b/build-support/run_dist_test.py
@@ -94,6 +94,9 @@ def main():
p.add_option("-e", "--env", dest="env", type="string", action="append",
help="key=value pairs for environment variables",
default=[])
+ p.add_option("--collect-tmpdir", dest="collect_tmpdir", action="store_true",
+ help="whether to collect the test tmpdir as an artifact if the test fails",
+ default=False)
options, args = p.parse_args()
if len(args) < 1:
p.print_help(sys.stderr)
@@ -131,11 +134,15 @@ def main():
# Don't pollute /tmp in dist-test setting. If a test crashes, the dist-test slave
# will clear up our working directory but won't be able to find and clean up things
# left in /tmp.
- env['TEST_TMPDIR'] = os.path.abspath(os.path.join(ROOT, "test-tmp"))
+ test_tmpdir = os.path.abspath(os.path.join(ROOT, "test-tmp"))
+ env['TEST_TMPDIR'] = test_tmpdir
env['ASAN_SYMBOLIZER_PATH'] = os.path.join(ROOT, "thirdparty/installed/uninstrumented/bin/llvm-symbolizer")
rc = subprocess.call([os.path.join(ROOT, "build-support/run-test.sh")] + args,
env=env)
+
+ if rc != 0 and options.collect_tmpdir:
+ os.system("tar czf %s %s" % (os.path.join(test_dir, "..", "test-logs", "test_tmpdir.tgz"), test_tmpdir))
sys.exit(rc)