[Lldb-commits] [PATCH] D73384: [lldb/Lit] Change the lldbtest format to behave more like shell test.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 24 16:27:17 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe3a7c7713cd8: [lldb/Lit] Change the lldbtest format to behave more like shell test. (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73384/new/

https://reviews.llvm.org/D73384

Files:
  lldb/test/API/lldbtest.py


Index: lldb/test/API/lldbtest.py
===================================================================
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -86,33 +86,46 @@
                 shutil.copy(python, copied_python)
             cmd[0] = copied_python
 
+        timeoutInfo = None
         try:
             out, err, exitCode = lit.util.executeCommand(
                 cmd,
                 env=test.config.environment,
                 timeout=litConfig.maxIndividualTestTime)
         except lit.util.ExecuteCommandTimeoutException:
-            return (lit.Test.TIMEOUT, 'Reached timeout of {} seconds'.format(
-                litConfig.maxIndividualTestTime))
+            timeoutInfo = 'Reached timeout of {} seconds'.format(
+                litConfig.maxIndividualTestTime)
+
+        output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
+            ' '.join(cmd), exitCode)
+        if timeoutInfo is not None:
+            output += """Timeout: %s\n""" % (timeoutInfo,)
+        output += "\n"
+
+        if out:
+            output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+        if err:
+            output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+        if timeoutInfo:
+            return lit.Test.TIMEOUT, output
 
         if exitCode:
             # Match FAIL but not XFAIL.
             for line in out.splitlines() + err.splitlines():
                 if line.startswith('FAIL:'):
-                    return lit.Test.FAIL, out + err
+                    return lit.Test.FAIL, output
 
             if 'XPASS:' in out or 'XPASS:' in err:
-                return lit.Test.XPASS, out + err
+                return lit.Test.XPASS, output
 
         has_unsupported_tests = 'UNSUPPORTED:' in out or 'UNSUPPORTED:' in err
         has_passing_tests = 'PASS:' in out or 'PASS:' in err
         if has_unsupported_tests and not has_passing_tests:
-            return lit.Test.UNSUPPORTED, out + err
+            return lit.Test.UNSUPPORTED, output
 
         passing_test_line = 'RESULT: PASSED'
         if passing_test_line not in out and passing_test_line not in err:
-            msg = ('Unable to find %r in dotest output (exit code %d):\n\n%s%s'
-                   % (passing_test_line, exitCode, out, err))
-            return lit.Test.UNRESOLVED, msg
+            return lit.Test.UNRESOLVED, output
 
-        return lit.Test.PASS, ''
+        return lit.Test.PASS, output


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73384.240322.patch
Type: text/x-patch
Size: 2457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200125/dbad4eb8/attachment-0001.bin>


More information about the lldb-commits mailing list