forked from OSchip/llvm-project
[lldb/test] Use SBPlatform info for lldbplatformutil.getPlatform()
Previously, we just used the platform name. This worked mostly OK, but it required adding special handling for any unusual (and potentially downstream) platform plugins, as evidenced by the hardcoding of the qemu-user platform. The current implementation was added in D121605/21c5bb0a636c23ec75b13681c0a6fdb03ecd9c0d, which this essentially reverts and goes back to the previous method of retrieving the platform name from the platform triple (the "OS" field). The motivation for D121605 was the ability to retrieve the process without constructing an SBDebugger object (which would be necessary in a world where SBPlatforms are managed by SBDebuggers). However, this world did not arrive (mainly due to other commitments on my part), and I now think that if we do want to go in that direction, that we should just create a dummy/empty SBDebugger object for holding the initial SBPlatform. One benefit of D121605 was the unification of getPlatform and getHostPlatform code paths, and I preserve that benefit by unifying them in the other direction -- using the host SBPlatform for getHostPlatform. Differential Revision: https://reviews.llvm.org/D138430
This commit is contained in:
parent
1147e70e7e
commit
6335deb68b
|
@ -849,14 +849,14 @@ def checkDebugServerSupport():
|
||||||
skip_msg = "Skipping %s tests, as they are not compatible with remote testing on this platform"
|
skip_msg = "Skipping %s tests, as they are not compatible with remote testing on this platform"
|
||||||
if lldbplatformutil.platformIsDarwin():
|
if lldbplatformutil.platformIsDarwin():
|
||||||
configuration.skip_categories.append("llgs")
|
configuration.skip_categories.append("llgs")
|
||||||
if configuration.lldb_platform_name:
|
if lldb.remote_platform:
|
||||||
# <rdar://problem/34539270>
|
# <rdar://problem/34539270>
|
||||||
configuration.skip_categories.append("debugserver")
|
configuration.skip_categories.append("debugserver")
|
||||||
if configuration.verbose:
|
if configuration.verbose:
|
||||||
print(skip_msg%"debugserver");
|
print(skip_msg%"debugserver");
|
||||||
else:
|
else:
|
||||||
configuration.skip_categories.append("debugserver")
|
configuration.skip_categories.append("debugserver")
|
||||||
if configuration.lldb_platform_name and lldbplatformutil.getPlatform() == "windows":
|
if lldb.remote_platform and lldbplatformutil.getPlatform() == "windows":
|
||||||
configuration.skip_categories.append("llgs")
|
configuration.skip_categories.append("llgs")
|
||||||
if configuration.verbose:
|
if configuration.verbose:
|
||||||
print(skip_msg%"lldb-server");
|
print(skip_msg%"lldb-server");
|
||||||
|
@ -891,14 +891,6 @@ def run_suite():
|
||||||
lldb.SBDebugger.Initialize()
|
lldb.SBDebugger.Initialize()
|
||||||
lldb.SBDebugger.PrintStackTraceOnError()
|
lldb.SBDebugger.PrintStackTraceOnError()
|
||||||
|
|
||||||
checkLibcxxSupport()
|
|
||||||
checkLibstdcxxSupport()
|
|
||||||
checkWatchpointSupport()
|
|
||||||
checkDebugInfoSupport()
|
|
||||||
checkDebugServerSupport()
|
|
||||||
checkObjcSupport()
|
|
||||||
checkForkVForkSupport()
|
|
||||||
|
|
||||||
# Use host platform by default.
|
# Use host platform by default.
|
||||||
lldb.remote_platform = None
|
lldb.remote_platform = None
|
||||||
lldb.selected_platform = lldb.SBPlatform.GetHostPlatform()
|
lldb.selected_platform = lldb.SBPlatform.GetHostPlatform()
|
||||||
|
@ -957,8 +949,16 @@ def run_suite():
|
||||||
# Note that it's not dotest's job to clean this directory.
|
# Note that it's not dotest's job to clean this directory.
|
||||||
lldbutil.mkdir_p(configuration.test_build_dir)
|
lldbutil.mkdir_p(configuration.test_build_dir)
|
||||||
|
|
||||||
|
checkLibcxxSupport()
|
||||||
|
checkLibstdcxxSupport()
|
||||||
|
checkWatchpointSupport()
|
||||||
|
checkDebugInfoSupport()
|
||||||
|
checkDebugServerSupport()
|
||||||
|
checkObjcSupport()
|
||||||
|
checkForkVForkSupport()
|
||||||
|
|
||||||
skipped_categories_list = ", ".join(configuration.skip_categories)
|
skipped_categories_list = ", ".join(configuration.skip_categories)
|
||||||
print("Skipping the following test categories: {}".format(skipped_categories_list))
|
print("Skipping the following test categories: {}".format(configuration.skip_categories))
|
||||||
|
|
||||||
for testdir in configuration.testdirs:
|
for testdir in configuration.testdirs:
|
||||||
for (dirpath, dirnames, filenames) in os.walk(testdir):
|
for (dirpath, dirnames, filenames) in os.walk(testdir):
|
||||||
|
|
|
@ -98,21 +98,23 @@ def finalize_build_dictionary(dictionary):
|
||||||
return dictionary
|
return dictionary
|
||||||
|
|
||||||
|
|
||||||
|
def _get_platform_os(p):
|
||||||
|
# Use the triple to determine the platform if set.
|
||||||
|
triple = p.GetTriple()
|
||||||
|
if triple:
|
||||||
|
platform = triple.split('-')[2]
|
||||||
|
if platform.startswith('freebsd'):
|
||||||
|
platform = 'freebsd'
|
||||||
|
elif platform.startswith('netbsd'):
|
||||||
|
platform = 'netbsd'
|
||||||
|
return platform
|
||||||
|
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def getHostPlatform():
|
def getHostPlatform():
|
||||||
"""Returns the host platform running the test suite."""
|
"""Returns the host platform running the test suite."""
|
||||||
# Attempts to return a platform name matching a target Triple platform.
|
return _get_platform_os(lldb.SBPlatform("host"))
|
||||||
if sys.platform.startswith('linux'):
|
|
||||||
return 'linux'
|
|
||||||
elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
|
|
||||||
return 'windows'
|
|
||||||
elif sys.platform.startswith('darwin'):
|
|
||||||
return 'macosx'
|
|
||||||
elif sys.platform.startswith('freebsd'):
|
|
||||||
return 'freebsd'
|
|
||||||
elif sys.platform.startswith('netbsd'):
|
|
||||||
return 'netbsd'
|
|
||||||
else:
|
|
||||||
return sys.platform
|
|
||||||
|
|
||||||
|
|
||||||
def getDarwinOSTriples():
|
def getDarwinOSTriples():
|
||||||
|
@ -130,16 +132,7 @@ def getPlatform():
|
||||||
platform = 'ios'
|
platform = 'ios'
|
||||||
return platform
|
return platform
|
||||||
|
|
||||||
platform = configuration.lldb_platform_name
|
return _get_platform_os(lldb.selected_platform)
|
||||||
if platform is None:
|
|
||||||
platform = "host"
|
|
||||||
if platform == "qemu-user":
|
|
||||||
platform = "host"
|
|
||||||
if platform == "host":
|
|
||||||
return getHostPlatform()
|
|
||||||
if platform.startswith("remote-"):
|
|
||||||
return platform[7:]
|
|
||||||
return platform
|
|
||||||
|
|
||||||
|
|
||||||
def platformIsDarwin():
|
def platformIsDarwin():
|
||||||
|
|
Loading…
Reference in New Issue