|
23 | 23 |
|
24 | 24 | # System modules
|
25 | 25 | import atexit
|
26 |
| -import os |
| 26 | +import datetime |
27 | 27 | import errno
|
28 | 28 | import logging
|
| 29 | +import os |
29 | 30 | import platform
|
30 | 31 | import re
|
31 | 32 | import signal
|
@@ -387,9 +388,11 @@ def parseOptionsAndInitTestdirs():
|
387 | 388 | configuration.regexp = args.p
|
388 | 389 |
|
389 | 390 | if args.s:
|
390 |
| - if args.s.startswith('-'): |
391 |
| - usage(parser) |
392 | 391 | configuration.sdir_name = args.s
|
| 392 | + else: |
| 393 | + timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") |
| 394 | + configuration.sdir_name = os.path.join(os.getcwd(), timestamp_started) |
| 395 | + |
393 | 396 | configuration.session_file_format = args.session_file_format
|
394 | 397 |
|
395 | 398 | if args.t:
|
@@ -1019,6 +1022,9 @@ def run_suite():
|
1019 | 1022 | # lldb.SBDebugger.Initialize()/Terminate() pair.
|
1020 | 1023 | import lldb
|
1021 | 1024 |
|
| 1025 | + # Now we can also import lldbutil |
| 1026 | + from lldbsuite.test import lldbutil |
| 1027 | + |
1022 | 1028 | # Create a singleton SBDebugger in the lldb namespace.
|
1023 | 1029 | lldb.DBG = lldb.SBDebugger.Create()
|
1024 | 1030 |
|
@@ -1078,7 +1084,6 @@ def run_suite():
|
1078 | 1084 |
|
1079 | 1085 | # Set up the working directory.
|
1080 | 1086 | # Note that it's not dotest's job to clean this directory.
|
1081 |
| - import lldbsuite.test.lldbutil as lldbutil |
1082 | 1087 | build_dir = configuration.test_build_dir
|
1083 | 1088 | lldbutil.mkdir_p(build_dir)
|
1084 | 1089 |
|
@@ -1120,33 +1125,15 @@ def run_suite():
|
1120 | 1125 | # Install the control-c handler.
|
1121 | 1126 | unittest2.signals.installHandler()
|
1122 | 1127 |
|
1123 |
| - # If sdir_name is not specified through the '-s sdir_name' option, get a |
1124 |
| - # timestamp string and export it as LLDB_SESSION_DIR environment var. This will |
1125 |
| - # be used when/if we want to dump the session info of individual test cases |
1126 |
| - # later on. |
1127 |
| - # |
1128 |
| - # See also TestBase.dumpSessionInfo() in lldbtest.py. |
1129 |
| - import datetime |
1130 |
| - # The windows platforms don't like ':' in the pathname. |
1131 |
| - timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") |
1132 |
| - if not configuration.sdir_name: |
1133 |
| - configuration.sdir_name = timestamp_started |
1134 |
| - os.environ["LLDB_SESSION_DIRNAME"] = os.path.join( |
1135 |
| - os.getcwd(), configuration.sdir_name) |
| 1128 | + lldbutil.mkdir_p(configuration.sdir_name) |
| 1129 | + os.environ["LLDB_SESSION_DIRNAME"] = configuration.sdir_name |
1136 | 1130 |
|
1137 | 1131 | sys.stderr.write(
|
1138 | 1132 | "\nSession logs for test failures/errors/unexpected successes"
|
1139 | 1133 | " will go into directory '%s'\n" %
|
1140 | 1134 | configuration.sdir_name)
|
1141 | 1135 | sys.stderr.write("Command invoked: %s\n" % getMyCommandLine())
|
1142 | 1136 |
|
1143 |
| - if not os.path.isdir(configuration.sdir_name): |
1144 |
| - try: |
1145 |
| - os.mkdir(configuration.sdir_name) |
1146 |
| - except OSError as exception: |
1147 |
| - if exception.errno != errno.EEXIST: |
1148 |
| - raise |
1149 |
| - |
1150 | 1137 | #
|
1151 | 1138 | # Invoke the default TextTestRunner to run the test suite
|
1152 | 1139 | #
|
|
0 commit comments