[LNT] r211719 - [runtest compile] Improve handling of command failures/unexpected stderr.

Daniel Dunbar daniel at zuster.org
Wed Jun 25 10:11:51 PDT 2014


Author: ddunbar
Date: Wed Jun 25 12:11:51 2014
New Revision: 211719

URL: http://llvm.org/viewvc/llvm-project?rev=211719&view=rev
Log:
[runtest compile] Improve handling of command failures/unexpected stderr.

 - We now log a more readable diagnostic in situations that error during normal
   invocation of failing commands.

 - We now treat it as a fatal error when we can't parse timing output in other
   situations, which indicates a bug in the testing logic.

Modified:
    lnt/trunk/lnt/tests/compile.py

Modified: lnt/trunk/lnt/tests/compile.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/compile.py?rev=211719&r1=211718&r2=211719&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/compile.py (original)
+++ lnt/trunk/lnt/tests/compile.py Wed Jun 25 12:11:51 2014
@@ -62,23 +62,23 @@ def runN(args, N, cwd, preprocess_cmd=No
                          env=env,
                          cwd=cwd)
     stdout,stderr = p.communicate()
-    res = p.wait()
+    res = p.returncode
 
-    data = None
+    # If the runN command failed, or it had stderr when we didn't expect it,
+    # fail immediately and don't try to parse the output.
+    if res != 0:
+        g_log.error("command failed with stderr:\n--\n%s\n--" % stderr.strip())
+        return None
+    elif not ignore_stderr and stderr.strip():
+        g_log.error("command had unexpected output on stderr:\n--\n%s\n--" % (
+                stderr.strip(),))
+        return None
+
+    # Otherwise, parse the timing data from runN.
     try:
-        data = eval(stdout)
+        return eval(stdout)
     except:
-        error("failed to parse output: %s\n" % stdout)
-
-    if not ignore_stderr and stderr.strip():
-        error("stderr isn't empty: %s\n" % stderr)
-        data = None
-
-    if res:
-        error("res != 0: %s\n" % res)
-        data = None
-
-    return data
+        fatal("failed to parse output: %s\n" % stdout)
 
 # Test functions.
 def get_input_path(opts, *names):





More information about the llvm-commits mailing list