Repository: sentry Updated Branches: refs/heads/master cfd4962c8 -> 283fe7c5a
SENTRY-2056: Display test-patch.py output on the standard console to see progress on Jenkins. (Kalyan Kumar kalvagadda, reviewed-by Sergio Pena) Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/283fe7c5 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/283fe7c5 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/283fe7c5 Branch: refs/heads/master Commit: 283fe7c5ad520733f334735c8d3eb70f6907833a Parents: cfd4962 Author: Kalyan Kumar Kalvagadda <[email protected]> Authored: Tue Jun 12 15:30:03 2018 -0500 Committer: Kalyan Kumar Kalvagadda <[email protected]> Committed: Tue Jun 12 15:30:41 2018 -0500 ---------------------------------------------------------------------- dev-support/test-patch.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/283fe7c5/dev-support/test-patch.py ---------------------------------------------------------------------- diff --git a/dev-support/test-patch.py b/dev-support/test-patch.py index 69d8711..05d4936 100644 --- a/dev-support/test-patch.py +++ b/dev-support/test-patch.py @@ -23,10 +23,17 @@ from optparse import OptionParser tmp_dir = None BASE_JIRA_URL = 'https://issues.apache.org/jira' -def execute(cmd, log=True): +def execute(cmd, output_file="", log=True): + processes = list() if log: print "INFO: Executing %s" % (cmd) - return subprocess.call(cmd, shell=True) + if len(output_file) > 0 : + processes.append(subprocess.Popen(cmd, shell=True)) + processes.append(subprocess.Popen('tail -f ' + output_file, shell=True)) + if processes[0].poll() is None: + return processes[0].wait() + else: + return subprocess.call(cmd, shell=True) def jira_request(result, url, username, password, data, headers): request = urllib2.Request(url, data, headers) @@ -120,7 +127,7 @@ def git_checkout(result, branch): def git_apply(result, cmd, patch_file, output_dir): output_file = "%s/apply.txt" % (output_dir) - rc = execute("%s %s 1>%s 2>&1" % (cmd, patch_file, output_file)) + rc = execute("%s %s 1>%s 2>&1" % (cmd, patch_file, output_file), output_file) output = "" if os.path.exists(output_file): with open(output_file) as fh: @@ -131,12 +138,14 @@ def git_apply(result, cmd, patch_file, output_dir): result.fatal("failed to apply patch (exit code %d):\n%s\n" % (rc, output)) def mvn_clean(result, mvn_repo, output_dir, mvn_profile): - rc = execute("mvn clean -Dmaven.repo.local=%s %s 1>%s/clean.txt 2>&1" % (mvn_repo, mvn_profile, output_dir)) + output_file = output_dir+'/clean.txt' + rc = execute("mvn clean -Dmaven.repo.local=%s %s 1>%s 2>&1" % (mvn_repo, mvn_profile, output_file), output_file) if rc != 0: result.fatal("failed to clean project (exit code %d)" % (rc)) def mvn_install(result, mvn_repo, output_dir, mvn_profile): - rc = execute("mvn install -U -DskipTests -Dmaven.repo.local=%s %s 1>%s/install.txt 2>&1" % (mvn_repo, mvn_profile, output_dir)) + output_file = output_dir+'/install.txt' + rc = execute("mvn install -U -DskipTests -Dmaven.repo.local=%s %s 1>%s 2>&1" % (mvn_repo, mvn_profile, output_file), output_file) if rc != 0: result.fatal("failed to build with patch (exit code %d)" % (rc)) @@ -146,7 +155,8 @@ def find_all_files(top): yield os.path.join(root, f) def mvn_test(result, mvn_repo, output_dir, mvn_profile): - rc = execute("mvn verify --fail-at-end -Dmaven.repo.local=%s %s 1>%s/test.txt 2>&1" % (mvn_repo, mvn_profile, output_dir)) + output_file = output_dir+'/test.txt' + rc = execute("mvn verify --fail-at-end -Dmaven.repo.local=%s %s 1>%s 2>&1" % (mvn_repo, mvn_profile, output_file), output_file) if rc == 0: result.success("all tests passed") else:
