sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2215: Sqoop2: Remember all test logs in pre-commit hook
Date Tue, 17 Mar 2015 00:22:36 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 118007106 -> b1dcdcbe2


SQOOP-2215: Sqoop2: Remember all test logs in pre-commit hook

(Abraham Elmahrek via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/b1dcdcbe
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/b1dcdcbe
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/b1dcdcbe

Branch: refs/heads/sqoop2
Commit: b1dcdcbe24e63d884dc84418f07835a2feb3557c
Parents: 1180071
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon Mar 16 17:21:11 2015 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Mon Mar 16 17:21:11 2015 -0700

----------------------------------------------------------------------
 dev-support/test-patch.py | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/b1dcdcbe/dev-support/test-patch.py
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.py b/dev-support/test-patch.py
index f30d1a8..e55c6eb 100755
--- a/dev-support/test-patch.py
+++ b/dev-support/test-patch.py
@@ -255,20 +255,16 @@ def find_all_files(top):
         for f in files:
             yield os.path.join(root, f)
 
-def mvn_test(result, output_dir, slow):
-  run_mvn_test("test", "unit", result, output_dir, slow)
+def mvn_test(result, output_dir, category):
+  run_mvn_test("test", "unit", result, output_dir, category)
 
-def mvn_integration(result, output_dir, slow):
-  run_mvn_test("integration-test -pl test", "integration", result, output_dir, slow)
+def mvn_integration(result, output_dir, category):
+  run_mvn_test("integration-test -pl test", "integration", result, output_dir, category)
 
-def run_mvn_test(command, test_type, result, output_dir, slow):
-  if slow:
-    command += " -Pslow"
-    test_file_name = "%s_slow" % test_type
-    test_type = "slow %s" % test_type
-  else:
-    test_file_name = "%s_fast" % test_type
-    test_type = "fast %s" % test_type
+def run_mvn_test(command, test_type, result, output_dir, category):
+  command += " -P%s" % category
+  test_file_name = "%s_%s" % (test_type, category)
+  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))
@@ -285,13 +281,17 @@ def run_mvn_test(command, test_type, result, output_dir, slow):
 
   # Based on whether they are
   if rc == 0:
-    result.success("All %s tests passed (executed %d tests)" % (test_type ,executed_tests)
)
+    result.success("All %s %s tests passed (executed %d tests)" % (category, test_type ,executed_tests)
)
   else:
-    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))
+    archive_dir = os.path.join(output_dir, test_results_dir, test_type, category)
+    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))
     failed_tests = []
     for path in list(find_all_files(".")):
       file_name = os.path.basename(path)
-      if file_name.startswith("TEST-") and file_name.endswith(".xml"):
+      if file_name.startswith("TEST-") and file_name.endswith(".xml") and test_results_dir
not in path:
+        shutil.copy(path, archive_dir)
         fd = open(path)
         for line in fd:
           if "<failure" in line or "<error" in line:
@@ -300,7 +300,7 @@ def run_mvn_test(command, test_type, result, output_dir, slow):
               failed_tests += [ matcher.groups()[0] ]
         fd.close()
     for failed_test in set(failed_tests):
-      result.error("Failed %s test: {{%s}}" % (test_type, failed_test))
+      result.error("Failed %s %s test: {{%s}}" % (category, test_type, failed_test))
 
 def clean_folder(folder):
   for the_file in os.listdir(folder):
@@ -470,10 +470,10 @@ 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, slow=False)
-  mvn_test(result, output_dir, slow=True)
-  mvn_integration(result, output_dir, slow=False)
-  mvn_integration(result, output_dir, slow=True)
+  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")
 else:
   result.info("patch applied and built but tests did not execute")
 


Mime
View raw message