Modify the test driver and lldbtest.TestBase so that the dumping of session info
now goes into a timestamp-specific directory instead of the previous .session-*
files.

[17:24:34] johnny:/Volumes/data/lldb/svn/trunk $ ls -l test/2010-10-18-16:56:12.935342
total 48
-rw-r--r--  1 johnny  admin  1695 Oct 18 16:56 TestArrayTypes.ArrayTypesTestCase.test_with_dsym_and_run_command.log
-rw-r--r--  1 johnny  admin  1652 Oct 18 16:56 TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log
-rw-r--r--  1 johnny  admin  2967 Oct 18 16:56 TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.log
-rw-r--r--  1 johnny  admin  1648 Oct 18 16:56 TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_run_command.log
-rw-r--r--  1 johnny  admin  1665 Oct 18 16:56 TestClassTypesDisassembly.IterateFrameAndDisassembleTestCase.test_with_dsym_and_python_api.log
-rw-r--r--  1 johnny  admin  3873 Oct 18 16:58 TestFloatTypesExpr.FloatTypesTestCase.test_float_types_with_dsym.log
[17:24:37] johnny:/Volumes/data/lldb/svn/trunk $ 

Also, the dumping happens when a test errored in additioned to when it failed.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116778 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/dotest.py b/test/dotest.py
index 57a9ef9..3c84042 100755
--- a/test/dotest.py
+++ b/test/dotest.py
@@ -502,6 +502,15 @@
 # Install the control-c handler.
 unittest2.signals.installHandler()
 
+# Now get a timestamp string and export it as LLDB_TIMESTAMP environment var.
+# This will be useful when/if we want to dump the session info of individual
+# test cases later on.
+#
+# See also TestBase.dumpSessionInfo() in lldbtest.py.
+import datetime
+raw_timestamp = str(datetime.datetime.today())
+os.environ["LLDB_TIMESTAMP"] = raw_timestamp.replace(' ', '-')
+
 #
 # Invoke the default TextTestRunner to run the test suite, possibly iterating
 # over different configurations.
@@ -611,6 +620,12 @@
                 # Now put this singleton into the lldb module namespace.
                 lldb.test_result = self
 
+            def addError(self, test, err):
+                super(LLDBTestResult, self).addError(test, err)
+                method = getattr(test, "markError", None)
+                if method:
+                    method()
+
             def addFailure(self, test, err):
                 super(LLDBTestResult, self).addFailure(test, err)
                 method = getattr(test, "markFailure", None)