You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ab...@apache.org on 2015/07/25 01:43:10 UTC
sqoop git commit: SQOOP-2427: Sqoop2: Precommit: Use the precommit
maven profile to run tests
Repository: sqoop
Updated Branches:
refs/heads/sqoop2 cb40f5c67 -> 72b8ef1f3
SQOOP-2427: Sqoop2: Precommit: Use the precommit maven profile to run tests
(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/72b8ef1f
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/72b8ef1f
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/72b8ef1f
Branch: refs/heads/sqoop2
Commit: 72b8ef1f3bb4c63826f1a333e3df53b81d75313c
Parents: cb40f5c
Author: Abraham Elmahrek <ab...@apache.org>
Authored: Fri Jul 24 16:42:37 2015 -0700
Committer: Abraham Elmahrek <ab...@apache.org>
Committed: Fri Jul 24 16:42:37 2015 -0700
----------------------------------------------------------------------
dev-support/test-patch.py | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/72b8ef1f/dev-support/test-patch.py
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.py b/dev-support/test-patch.py
index 5336352..b3b6e55 100755
--- a/dev-support/test-patch.py
+++ b/dev-support/test-patch.py
@@ -255,23 +255,24 @@ def find_all_files(top):
for f in files:
yield os.path.join(root, f)
-def mvn_test(result, output_dir, category):
- run_mvn_test("test", "unit", result, output_dir, category)
+def mvn_test(result, output_dir):
+ run_mvn_test("test", "unit", result, output_dir)
-def mvn_integration(result, output_dir, category):
- run_mvn_test("integration-test -pl test", "integration", result, output_dir, category)
+def mvn_integration(result, output_dir):
+ run_mvn_test("integration-test -pl test", "integration", result, output_dir)
-def run_mvn_test(command, test_type, result, output_dir, category):
- command += " -P%s" % category
- test_file_name = "%s_%s" % (test_type, category)
+def run_mvn_test(command, test_type, result, output_dir):
+ command += " -Pprecommit" # We need special test profile for precommit hook
+ test_file_name = "test_%s.txt" % (test_type)
+ test_output = "%s/%s" % (output_dir, test_file_name)
test_results_dir = "test-results"
# Execute the test run
- rc = execute("mvn %s 1>%s/test_%s.txt 2>&1" % (command, output_dir, test_file_name))
+ rc = execute("mvn %s 1>%s 2>&1" % (command, test_output))
# Test run statistics (number of executed/skipped tests)
executed_tests = 0
- fd = open("%s/test_%s.txt" % (output_dir, test_file_name))
+ fd = open(test_output)
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)
@@ -281,12 +282,12 @@ def run_mvn_test(command, test_type, result, output_dir, category):
# Based on whether they are
if rc == 0:
- result.success("All %s %s tests passed (executed %d tests)" % (category, test_type ,executed_tests) )
+ result.success("All %s tests passed (executed %d tests)" % (test_type ,executed_tests) )
else:
- archive_dir = os.path.join(output_dir, test_results_dir, test_type, category)
+ archive_dir = os.path.join(output_dir, test_results_dir, test_type)
if not os.path.exists(archive_dir):
os.makedirs(archive_dir)
- result.error("Some of %s %s tests failed (%s, executed %d tests)" % (category, test_type, jenkins_file_link_for_jira("report", "test_%s.txt" % test_file_name), executed_tests))
+ result.error("Some of %s tests failed (%s, executed %d tests)" % (test_type, jenkins_file_link_for_jira("report", test_file_name), executed_tests))
failed_tests = []
for path in list(find_all_files(".")):
file_name = os.path.basename(path)
@@ -300,7 +301,7 @@ def run_mvn_test(command, test_type, result, output_dir, category):
failed_tests += [ matcher.groups()[0] ]
fd.close()
for failed_test in set(failed_tests):
- result.error("Failed %s %s test: {{%s}}" % (category, test_type, failed_test))
+ result.error("Failed %s test: {{%s}}" % (test_type, failed_test))
def clean_folder(folder):
for the_file in os.listdir(folder):
@@ -470,10 +471,8 @@ static_test(result, patch_file, output_dir)
mvn_rat(result, output_dir)
mvn_install(result, output_dir)
if run_tests:
- mvn_test(result, output_dir, category="fast")
- mvn_test(result, output_dir, category="slow")
- mvn_integration(result, output_dir, category="fast")
- mvn_integration(result, output_dir, category="slow")
+ mvn_test(result, output_dir)
+ mvn_integration(result, output_dir)
else:
result.info("patch applied and built but tests did not execute")