[zorg] r257711 - update lldb xcode build test phase to generate 0 exit code on test failure

Todd Fiala via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 15:40:34 PST 2016


Author: tfiala
Date: Wed Jan 13 17:40:34 2016
New Revision: 257711

URL: http://llvm.org/viewvc/llvm-project?rev=257711&view=rev
Log:
update lldb xcode build test phase to generate 0 exit code on test failure

The Green Dragon Jenkins builders will pick up the JUnit-style output
and flag a build failure on that for Xcode builds.  Without changing this,
the build will fail unconditionally, and the unit test post-processor
will never run.

Modified:
    zorg/trunk/zorg/jenkins/build.py

Modified: zorg/trunk/zorg/jenkins/build.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/jenkins/build.py?rev=257711&r1=257710&r2=257711&view=diff
==============================================================================
--- zorg/trunk/zorg/jenkins/build.py (original)
+++ zorg/trunk/zorg/jenkins/build.py Wed Jan 13 17:40:34 2016
@@ -303,7 +303,9 @@ def lldb_builder():
         "DEBUGSERVER_USE_FROM_SYSTEM=1"]
 
     header("Build Xcode lldb-python-test-suite target")
-    run_cmd("lldb", xcodebuild_cmd)
+    # For the unit tests, we don't want to stop the build if there are
+    # build errors.  We allow the JUnit/xUnit parser to pick this up.
+    run_cmd_errors_okay("lldb", xcodebuild_cmd)
     footer()
 
 def static_analyzer_benchmarks_builder():
@@ -546,6 +548,27 @@ def run_cmd(working_dir, cmd, env=None):
         (end_time-start_time).seconds))
 
 
+def run_cmd_errors_okay(working_dir, cmd, env=None):
+    """Run a command in a working directory, reporting return value.
+    Non-zero exit codes do not generate an exception.
+    """
+    old_cwd = os.getcwd()
+    cmd_to_print = ' '.join([quote_sh_string(x) for x in cmd])
+    sys.stdout.write("cd {}\n{}\n".format(working_dir, cmd_to_print))
+    sys.stdout.flush()
+
+    start_time = datetime.datetime.now()
+    if not os.environ.get('TESTING', False):
+        try:
+            os.chdir(working_dir)
+            result = subprocess.call(cmd, env=env)
+        finally:
+            os.chdir(old_cwd)
+    end_time = datetime.datetime.now()
+
+    logging.info("Command took {} seconds: return code {}".format(
+        (end_time-start_time).seconds, result))
+
 KNOWN_TARGETS = ['all', 'build', 'test', 'testlong']
 KNOWN_BUILDS = ['clang', 'cmake', 'lldb', 'fetch', 'artifact',
                 'derive', 'derive-llvm+clang', 'derive-lldb', 'derive-llvm',




More information about the llvm-commits mailing list