Skip to content

Commit 7021e44

Browse files
authored
[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 moves the platform detection logic from Makefile to Python lldb test suite. This is useful for the case of Windows-to-Linux cross-testing.
1 parent f35318e commit 7021e44

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,28 @@ def match_android_device(device_arch, valid_archs=None, valid_api_levels=None):
9292

9393

9494
def finalize_build_dictionary(dictionary):
95+
# Provide uname-like platform name
96+
platform_name_to_uname = {
97+
"linux": "Linux",
98+
"netbsd": "NetBSD",
99+
"freebsd": "FreeBSD",
100+
"windows": "Windows_NT",
101+
"macosx": "Darwin",
102+
"darwin": "Darwin",
103+
}
104+
105+
if dictionary is None:
106+
dictionary = {}
95107
if target_is_android():
96-
if dictionary is None:
97-
dictionary = {}
98108
dictionary["OS"] = "Android"
99109
dictionary["PIE"] = 1
110+
elif platformIsDarwin():
111+
dictionary["OS"] = "Darwin"
112+
else:
113+
dictionary["OS"] = platform_name_to_uname[getPlatform()]
114+
115+
dictionary["HOST_OS"] = platform_name_to_uname[getHostPlatform()]
116+
100117
return dictionary
101118

102119

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
5555
# When running tests from Visual Studio, the environment variable isn't
5656
# inherited all the way down to the process spawned for make.
5757
#----------------------------------------------------------------------
58-
HOST_OS := $(shell uname -s)
58+
ifeq "$(HOST_OS)" ""
59+
HOST_OS := $(shell uname -s)
60+
endif
61+
5962
ifneq (,$(findstring windows32,$(HOST_OS)))
6063
HOST_OS := Windows_NT
6164
endif

0 commit comments

Comments
 (0)