The informational message for where to find the session logs for failed/errored
tests should be near the test summary message, instead of way up in the beginning.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117726 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/dotest.py b/test/dotest.py
index 21161e5..ec38e4b 100755
--- a/test/dotest.py
+++ b/test/dotest.py
@@ -80,6 +80,9 @@
 # run.  Use '-s session-dir-name' to specify a specific dir name.
 sdir_name = None
 
+# Set this flag if there is any session info dumped during the test run.
+sdir_has_content = False
+
 # Default verbosity is 0.
 verbose = 0
 
@@ -568,7 +571,6 @@
     timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")
     sdir_name = timestamp
 os.environ["LLDB_SESSION_DIRNAME"] = sdir_name
-sys.stderr.write("\nSession info for test failures/errors will go into directory '%s'\n" % sdir_name)
 
 #
 # Invoke the default TextTestRunner to run the test suite, possibly iterating
@@ -680,12 +682,16 @@
                 lldb.test_result = self
 
             def addError(self, test, err):
+                global sdir_has_content
+                sdir_has_content = True
                 super(LLDBTestResult, self).addError(test, err)
                 method = getattr(test, "markError", None)
                 if method:
                     method()
 
             def addFailure(self, test, err):
+                global sdir_has_content
+                sdir_has_content = True
                 super(LLDBTestResult, self).addFailure(test, err)
                 method = getattr(test, "markFailure", None)
                 if method:
@@ -695,6 +701,9 @@
                                           resultclass=LLDBTestResult).run(suite)
         
 
+if sdir_has_content:
+    sys.stderr.write("\nSession logs for test failures/errors can be found in directory '%s'\n" % sdir_name)
+
 # Terminate the test suite if ${LLDB_TESTSUITE_FORCE_FINISH} is defined.
 # This should not be necessary now.
 if ("LLDB_TESTSUITE_FORCE_FINISH" in os.environ):