5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-10 07:31:32 +08:00

SQOOP-2458: Sqoop2: Precommit: Stop copying test results directly inside the pre-commit hook

(Jarek Jarcec Cecho via Richard Zhou)
This commit is contained in:
Richard Zhou 2015-08-05 10:08:02 +08:00
parent e908d15977
commit 30b3e47098

View File

@ -269,7 +269,6 @@ def run_mvn_test(command, test_type, result, output_dir):
command += " -Pprecommit" # We need special test profile for precommit hook command += " -Pprecommit" # We need special test profile for precommit hook
test_file_name = "test_%s.txt" % (test_type) test_file_name = "test_%s.txt" % (test_type)
test_output = "%s/%s" % (output_dir, test_file_name) test_output = "%s/%s" % (output_dir, test_file_name)
test_results_dir = "test-results"
# Execute the test run # Execute the test run
rc = execute("mvn %s 1>%s 2>&1" % (command, test_output)) rc = execute("mvn %s 1>%s 2>&1" % (command, test_output))
@ -288,14 +287,10 @@ def run_mvn_test(command, test_type, result, output_dir):
if rc == 0: if rc == 0:
result.success("All %s tests passed (executed %d tests)" % (test_type ,executed_tests) ) result.success("All %s tests passed (executed %d tests)" % (test_type ,executed_tests) )
else: else:
archive_dir = os.path.join(output_dir, test_results_dir, test_type)
if not os.path.exists(archive_dir):
os.makedirs(archive_dir)
failed_tests = [] failed_tests = []
for path in list(find_all_files(".")): for path in list(find_all_files(".")):
file_name = os.path.basename(path) file_name = os.path.basename(path)
if file_name.startswith("TEST-") and file_name.endswith(".xml") and test_results_dir not in path: if file_name.startswith("TEST-") and file_name.endswith(".xml"):
shutil.copy(path, archive_dir)
fd = open(path) fd = open(path)
for line in fd: for line in fd:
if "<failure" in line or "<error" in line: if "<failure" in line or "<error" in line: