diff options
author | Zachary Turner <zturner@google.com> | 2015-10-27 22:33:47 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-10-27 22:33:47 +0000 |
commit | af383ff70c30b422d919210cfd7e6a61e62405b9 (patch) | |
tree | defb02a15e66e52301f03dc61ac9c9e8a3f5ed1f /lldb | |
parent | 4c1f1c33b16b3b7236444661a6bd48933cf7c2dd (diff) | |
download | bcm5719-llvm-af383ff70c30b422d919210cfd7e6a61e62405b9.tar.gz bcm5719-llvm-af383ff70c30b422d919210cfd7e6a61e62405b9.zip |
Preparation for turning lldbsuite into a Python package.
The idea behind this patch is to expose the meat of
LLDB's Python infrastructure (test suite, scripts, etc)
as a single package. This makes reusability and code
sharing among sub-packages easy.
Differential Revision: http://reviews.llvm.org/D14131
llvm-svn: 251460
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/packages/Python/lldbsuite/__init__.py | 20 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/__init__.py | 1 | ||||
-rwxr-xr-x | lldb/test/dosep.py | 2 | ||||
-rwxr-xr-x | lldb/test/dotest.py | 63 | ||||
-rw-r--r-- | lldb/test/use_lldb_suite.py | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lldb/third_party/Python/module/progress/progress.py (renamed from lldb/test/progress.py) | 0 | ||||
-rw-r--r-- | lldb/use_lldb_suite_root.py | 7 |
7 files changed, 92 insertions, 3 deletions
diff --git a/lldb/packages/Python/lldbsuite/__init__.py b/lldb/packages/Python/lldbsuite/__init__.py new file mode 100644 index 00000000000..3258a17aadc --- /dev/null +++ b/lldb/packages/Python/lldbsuite/__init__.py @@ -0,0 +1,20 @@ +# Module level initialization for the `lldbsuite` module.
+
+import inspect
+import os
+import sys
+
+def find_lldb_root():
+ lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
+ while True:
+ lldb_root = os.path.dirname(lldb_root)
+ if lldb_root is None:
+ return None
+
+ test_path = os.path.join(lldb_root, "lldb.root")
+ if os.path.isfile(test_path):
+ return lldb_root
+ return None
+
+# lldbsuite.lldb_root refers to the root of the git/svn source checkout
+lldb_root = find_lldb_root()
diff --git a/lldb/packages/Python/lldbsuite/test/__init__.py b/lldb/packages/Python/lldbsuite/test/__init__.py new file mode 100644 index 00000000000..5ae1a7ef632 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/__init__.py @@ -0,0 +1 @@ +# Module level initialization for the `lldbsuite.test` module.
diff --git a/lldb/test/dosep.py b/lldb/test/dosep.py index 716adbc3c28..0342d7e97a6 100755 --- a/lldb/test/dosep.py +++ b/lldb/test/dosep.py @@ -1205,7 +1205,7 @@ def adjust_inferior_options(dotest_argv): # every dotest invocation from creating its own directory import datetime # The windows platforms don't like ':' in the pathname. - timestamp_started = datetime.datetime.now().strftime("%F-%H_%M_%S") + timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") dotest_argv.append('-s') dotest_argv.append(timestamp_started) dotest_options.s = timestamp_started diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index 7524ee433c8..2571af20127 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -1048,6 +1048,8 @@ def setupSysPath(): # Set up the LLDB_SRC environment variable, so that the tests can locate # the LLDB source code. + # When this changes over to a package instead of a standalone script, this + # will be `lldbsuite.lldb_root` os.environ["LLDB_SRC"] = os.path.join(scriptPath, os.pardir) pluginPath = os.path.join(scriptPath, 'plugins') @@ -1063,6 +1065,8 @@ def setupSysPath(): # to "import lldbgdbserverutils" from the lldb-server tests # This is the root of the lldb git/svn checkout + # When this changes over to a package instead of a standalone script, this + # will be `lldbsuite.lldb_root` lldbRootDirectory = os.path.abspath(os.path.join(scriptPath, os.pardir)) # Some of the tests can invoke the 'lldb' command directly. @@ -1294,6 +1298,7 @@ def visit(prefix, dir, names): def disabledynamics(): + import lldb ci = lldb.DBG.GetCommandInterpreter() res = lldb.SBCommandReturnObject() ci.HandleCommand("setting set target.prefer-dynamic-value no-dynamic-values", res, False) @@ -1301,6 +1306,7 @@ def disabledynamics(): raise Exception('disabling dynamic type support failed') def lldbLoggings(): + import lldb """Check and do lldb loggings if necessary.""" # Turn on logging for debugging purposes if ${LLDB_LOG} environment variable is @@ -1366,6 +1372,7 @@ def checkDsymForUUIDIsNotOn(): sys.exit(0) def exitTestSuite(exitCode = None): + import lldb lldb.SBDebugger.Terminate() if exitCode: sys.exit(exitCode) @@ -1378,7 +1385,58 @@ def isMultiprocessTestRunner(): # test runner return not (is_inferior_test_runner or no_multiprocess_test_runner) -if __name__ == "__main__": +def run_suite(): + global just_do_benchmarks_test + global dont_do_dsym_test + global dont_do_dwarf_test + global dont_do_dwo_test + global blacklist + global blacklistConfig + global categoriesList + global validCategories + global useCategories + global skipCategories + global lldbFrameworkPath + global configFile + global archs + global compilers + global count + global dumpSysPath + global bmExecutable + global bmBreakpointSpec + global bmIterationCount + global failed + global failfast + global filters + global fs4all + global ignore + global progress_bar + global runHooks + global skip_build_and_cleanup + global skip_long_running_test + global noHeaders + global parsable + global regexp + global rdir + global sdir_name + global svn_silent + global verbose + global testdirs + global lldb_platform_name + global lldb_platform_url + global lldb_platform_working_dir + global setCrashInfoHook + global is_inferior_test_runner + global multiprocess_test_subdir + global num_threads + global output_on_success + global no_multiprocess_test_runner + global test_runner_name + global results_filename + global results_formatter_name + global results_formatter_options + global results_port + # On MacOS X, check to make sure that domain for com.apple.DebugSymbols defaults # does not exist before proceeding to running the test suite. if sys.platform.startswith("darwin"): @@ -1976,3 +2034,6 @@ if __name__ == "__main__": # Exiting. exitTestSuite(failed) + +if __name__ == "__main__": + run_suite()
\ No newline at end of file diff --git a/lldb/test/use_lldb_suite.py b/lldb/test/use_lldb_suite.py index daeafe80dd5..3dbcbb91700 100644 --- a/lldb/test/use_lldb_suite.py +++ b/lldb/test/use_lldb_suite.py @@ -19,4 +19,4 @@ if lldb_root is not None: import imp module = imp.find_module("use_lldb_suite_root", [lldb_root]) if module is not None: - imp.load_module("use_lldb_suite_root", *module)
\ No newline at end of file + imp.load_module("use_lldb_suite_root", *module) diff --git a/lldb/test/progress.py b/lldb/third_party/Python/module/progress/progress.py index 734627d4b16..734627d4b16 100755..100644 --- a/lldb/test/progress.py +++ b/lldb/third_party/Python/module/progress/progress.py diff --git a/lldb/use_lldb_suite_root.py b/lldb/use_lldb_suite_root.py index 466de5d7a4a..5492d4081ac 100644 --- a/lldb/use_lldb_suite_root.py +++ b/lldb/use_lldb_suite_root.py @@ -11,5 +11,12 @@ def add_third_party_module_dirs(lldb_root): for module_dir in module_dirs: module_dir = os.path.join(third_party_modules_dir, module_dir) sys.path.insert(0, module_dir) + +def add_lldbsuite_packages_dir(lldb_root): + packages_dir = os.path.join(lldb_root, "packages", "Python") + sys.path.insert(0, packages_dir) + lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe())) + add_third_party_module_dirs(lldb_root) +add_lldbsuite_packages_dir(lldb_root) |