Repository: sqoop Updated Branches: refs/heads/sqoop2 62a5e8baa -> 4c38dd384
SQOOP-2124: Sqoop2: Pre-Commit hook should report how many tests are executed (Jarek Jarcec Cecho via Abraham Elmahrek) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/4c38dd38 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/4c38dd38 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/4c38dd38 Branch: refs/heads/sqoop2 Commit: 4c38dd384b0f3866573438749b5f681170810af0 Parents: 62a5e8b Author: Abraham Elmahrek <[email protected]> Authored: Fri Feb 20 15:30:46 2015 -0800 Committer: Abraham Elmahrek <[email protected]> Committed: Fri Feb 20 15:30:46 2015 -0800 ---------------------------------------------------------------------- dev-support/test-patch.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/4c38dd38/dev-support/test-patch.py ---------------------------------------------------------------------- diff --git a/dev-support/test-patch.py b/dev-support/test-patch.py index 5d61576..ab3161d 100755 --- a/dev-support/test-patch.py +++ b/dev-support/test-patch.py @@ -270,11 +270,24 @@ def run_mvn_test(command, test_type, result, output_dir, slow): test_file_name = "%s_fast" % test_type test_type = "fast %s" % test_type + # Execute the test run rc = execute("mvn %s 1>%s/test_%s.txt 2>&1" % (command, output_dir, test_file_name)) + + # Test run statistics (number of executed/skipped tests) + executed_tests = 0 + fd = open("%s/test_%s.txt" % (output_dir, test_file_name)) + for line in fd: + if "Tests run:" in line: + matcher = re.search("^Tests run: ([0-9+]), Failures: ([0-9+]), Errors: ([0-9+]), Skipped: ([0-9+]), Time elapsed:", line) + if matcher: + executed_tests += int(matcher.group(1)) + fd.close() + + # Based on whether they are if rc == 0: - result.success("All %s tests passed" % test_type) + result.success("All %s tests passed (executed %d tests)" % (test_type ,executed_tests) ) else: - result.error("Some %s tests failed (%s)" % (test_type, jenkins_file_link_for_jira("report", "test_%s.txt" % test_file_name))) + result.error("Some of %s tests failed (%s, executed %d tests)" % (test_type, jenkins_file_link_for_jira("report", "test_%s.txt" % test_file_name), executed_tests)) failed_tests = [] for path in list(find_all_files(".")): file_name = os.path.basename(path)
