Skip to content

Commit c107d5d

Browse files
committed
[lldb][test] Set target and host OS for API tests in case of remote testing
Makefile.rules uses HOST_OS and OS variables for determining host and target OSes for API tests compilation. This commit starts moving the platform detection logic from Makefile to Python lldb test suite. When lldb's target is set to remote-linux, Makefile.rules script should be executed with the target OS variable set to Linux. This is useful for the case of Windows-to-Linux cross-testing.
1 parent 857700f commit c107d5d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lldb/packages/Python/lldbsuite/test/lldbplatformutil.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ def target_is_android():
5656
return configuration.lldb_platform_name == "remote-android"
5757

5858

59+
def target_is_remote_linux():
60+
return configuration.lldb_platform_name == "remote-linux"
61+
62+
5963
def android_device_api():
6064
if not hasattr(android_device_api, "result"):
6165
assert configuration.lldb_platform_url is not None
@@ -92,11 +96,22 @@ def match_android_device(device_arch, valid_archs=None, valid_api_levels=None):
9296

9397

9498
def finalize_build_dictionary(dictionary):
99+
if dictionary is None:
100+
dictionary = {}
95101
if target_is_android():
96-
if dictionary is None:
97-
dictionary = {}
98102
dictionary["OS"] = "Android"
99103
dictionary["PIE"] = 1
104+
elif platformIsDarwin():
105+
dictionary["OS"] = "Darwin"
106+
else:
107+
# Provide uname-like platform name
108+
platform_name_to_uname = { "linux": "Linux",
109+
"netbsd": "NetBSD",
110+
"freebsd": "FreeBSD",
111+
"windows": "Windows_NT",
112+
}
113+
dictionary["OS"] = platform_name_to_uname[getPlatform()]
114+
dictionary["HOST_OS"] = platform_name_to_uname[getHostPlatform()]
100115
return dictionary
101116

102117

0 commit comments

Comments
 (0)