]> git.saurik.com Git - apple/xnu.git/blame - tests/Makefile
xnu-7195.81.3.tar.gz
[apple/xnu.git] / tests / Makefile
CommitLineData
39037602
A
1PROJECT := xnu/darwintests
2
3# When building as part of xnu_tests, we get passed a DSTROOT that's got the
4# unit test path in it already. But, BASEDSTROOT doesn't, so use that instead.
5ifdef BASEDSTROOT
6override DSTROOT = $(BASEDSTROOT)
7endif
8
f427ee49 9INVALID_ARCHS = i386
5ba3f43e
A
10ENABLE_LTE_TESTS=YES
11
12OTHER_LTE_INCLUDE_FILES += \
13 /System/Library/PrivateFrameworks/LoggingSupport.framework, \
14 /System/Library/PrivateFrameworks/MobileKeyBag.framework, \
cb323159 15 /System/Library/Frameworks/IOSurface.framework, \
5ba3f43e
A
16 /usr/local/lib/libdarwintest_utils.dylib, \
17 /usr/lib/libapple_crypto.dylib,
18
d9a64523 19DEVELOPER_DIR ?= $(shell xcode-select -p)
39037602
A
20
21# the xnu build system will only ever call us with the default target
22.DEFAULT_GOAL := install
23
24include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
25
26OTHER_CFLAGS = -Weverything -Wno-gnu-union-cast -Wno-missing-field-initializers -Wno-partial-availability
27OTHER_CFLAGS += -Wno-missing-noreturn -Wno-vla -Wno-reserved-id-macro -Wno-documentation-unknown-command
5ba3f43e 28OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused -Wno-covered-switch-default -Wno-nullability-extension
cb323159 29OTHER_CFLAGS += -Wno-gnu-empty-initializer -Wno-unused-macros -Wno-undef -Wno-fixed-enum-extension
f427ee49 30OTHER_CFLAGS += -Wno-gnu-auto-type -Wno-switch-enum -Wno-variadic-macros
39037602 31OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
d9a64523 32OTHER_CFLAGS += -UT_NAMESPACE_PREFIX -DT_NAMESPACE_PREFIX=xnu
5ba3f43e 33OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
813fb2f6 34
f427ee49
A
35OTHER_CFLAGS += -Wl,-sectcreate,__INFO_FILTER,__disable,/dev/null
36
37
813fb2f6 38CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
f427ee49 39CODESIGN_HARDENED_RUNTIME:=$(CODESIGN) -o runtime
813fb2f6 40CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
39037602
A
41
42# to have custom compiler flags to
43# target: OTHER_CFLAGS += <my flags>
44
a39ff7e2
A
45atm_diagnostic_flag: OTHER_CFLAGS += drop_priv.c
46
c6bf4f31
A
47atm_diagnostic_flag_entitled: CODE_SIGN_ENTITLEMENTS = atm_diagnostic_flag.entitlements
48atm_diagnostic_flag_entitled: OTHER_CFLAGS += drop_priv.c
49
f427ee49 50avx: INVALID_ARCHS = $(filter arm%,$(ARCH_CONFIGS))
5ba3f43e
A
51avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
52avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
53avx: CONFIG_FLAGS := $(filter-out -O%,$(CONFIG_FLAGS))
54# Level 2 optimization must be used to prevent compiler from generating
55# invalid instructions when compiling with AVX-512 flags.
56avx: CONFIG_FLAGS += -O2
a39ff7e2
A
57# Disable vzeroupper insertion to work around rdar://problem/35035096
58avx: CONFIG_FLAGS += -mllvm -x86-use-vzeroupper=0
5ba3f43e
A
59ifneq (osx,$(TARGET_NAME))
60EXCLUDED_SOURCES += avx.c
61endif
62
f427ee49
A
63CUSTOM_TARGETS = sr_entitlement_helper
64
65sr_entitlement_helper: sr_entitlement_helper.c
66 mkdir -p $(SYMROOT)
67 $(CC) -I $(OBJROOT) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) sr_entitlement_helper.c -o $(SYMROOT)/$@
68 echo $(CODESIGN) --force --sign - --timestamp=none --entitlements sr_entitlement.entitlements $(SYMROOT)/$@; \
69 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements sr_entitlement.entitlements $(SYMROOT)/$@;
70
71install-sr_entitlement_helper: sr_entitlement_helper
72 mkdir -p $(INSTALLDIR)
73 cp $(SYMROOT)/sr_entitlement_helper $(INSTALLDIR)
74
75sr_entitlement: OTHER_LDFLAGS += -ldarwintest_utils
76
39037602 77backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
f427ee49 78backtracing: CODE_SIGN_ENTITLEMENTS = kernel_symbolication_entitlements.plist
39037602 79
a39ff7e2 80data_protection: OTHER_LDFLAGS += -ldarwintest_utils -framework IOKit
813fb2f6 81
cb323159
A
82immovable_send: excserver
83immovable_send: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT)
84immovable_send: OTHER_LDFLAGS += -ldarwintest_utils -lpthread -framework IOKit
85
f427ee49 86CUSTOM_TARGETS += immovable_send_client vm_spawn_tool inspect_port_nocodesign
cb323159
A
87immovable_send: immovable_send_client
88
f427ee49
A
89vm_spawn_tool: INVALID_ARCHS = i386
90vm_spawn_tool: vm_spawn_tool.c
91 $(CC) $(DT_CFLAGS) -I $(OBJROOT) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) vm_spawn_tool.c -o $(SYMROOT)/vm_spawn_tool
92
93install-vm_spawn_tool: vm_spawn_tool
94 mkdir -p $(INSTALLDIR)/tools
95 cp $(SYMROOT)/vm_spawn_tool $(INSTALLDIR)/tools/
96
cb323159
A
97immovable_send_client: immovable_send_client.c
98 $(CC) $(DT_CFLAGS) -I $(OBJROOT) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) immovable_send_client.c -o $(SYMROOT)/immovable_send_client
99
100install-immovable_send_client: immovable_send_client
101 mkdir -p $(INSTALLDIR)
102 cp $(SYMROOT)/immovable_send_client $(INSTALLDIR)/
103
f427ee49
A
104inspect_port_nocodesign: inspect_port.c
105 $(CC) $(DT_CFLAGS) -I $(OBJROOT) -DT_NOCODESIGN=1 $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/inspect_port_nocodesign
106
107install-inspect_port_nocodesign: inspect_port_nocodesign
108 mkdir -p $(INSTALLDIR)
109 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN_ALLOCATE) -r -i $(SYMROOT)/inspect_port_nocodesign -o $(SYMROOT)/inspect_port_nocodesign
110
111kas_info: OTHER_LDFLAGS += -framework CoreSymbolication
112kas_info: CODE_SIGN_ENTITLEMENTS = kernel_symbolication_entitlements.plist
113
39037602 114kdebug: INVALID_ARCHS = i386
d9a64523 115kdebug: OTHER_LDFLAGS = -framework ktrace -ldarwintest_utils -framework kperf
39037602 116
ea3f0419 117EXCLUDED_SOURCES += drop_priv.c kperf_helpers.c xnu_quick_test_helpers.c memorystatus_assertion_helpers.c bpflib.c in_cksum.c
39037602 118
0a7de745 119ifneq ($(PLATFORM),iPhoneOS)
f427ee49 120EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c perf_compressor.c memorystatus_freeze_test.c vm/entitlement_increased_memory_limit.c
813fb2f6
A
121endif
122
a39ff7e2 123perf_compressor: OTHER_LDFLAGS += -ldarwintest_utils
5ba3f43e
A
124perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
125
f427ee49 126
cb323159 127memorystatus_freeze_test: CODE_SIGN_ENTITLEMENTS=./task_for_pid_entitlement.plist
d9a64523 128memorystatus_freeze_test: OTHER_LDFLAGS += -ldarwintest_utils
cb323159 129memorystatus_freeze_test: OTHER_CFLAGS += -ldarwintest_utils memorystatus_assertion_helpers.c
d9a64523 130
cb323159
A
131memorystatus_is_assertion: OTHER_LDFLAGS += -ldarwintest_utils
132memorystatus_is_assertion: OTHER_CFLAGS += memorystatus_assertion_helpers.c
133
cb323159
A
134shared_cache_tests: OTHER_LDFLAGS += -ldarwintest_utils
135
136stackshot_tests: OTHER_CFLAGS += -Wno-objc-messaging-id
f427ee49 137stackshot_tests: OTHER_LDFLAGS += -lkdd -lz -ldarwintest_utils -framework Foundation
5ba3f43e 138
4ba76501
A
139stackshot_accuracy: OTHER_CFLAGS += -ldarwintest_utils -Wno-objc-messaging-id
140stackshot_accuracy: OTHER_LDFLAGS += -lkdd -ldarwintest_utils -framework Foundation
141stackshot_accuracy: INVALID_ARCHS = i386
142
f427ee49
A
143ifeq ($(PLATFORM),MacOSX)
144CUSTOM_TARGETS += stackshot_translated_child
145
146stackshot_translated_child: INVALID_ARCHS = arm64 arm64e
147stackshot_translated_child: stackshot_translated_child.c
148 $(CC) $(DT_CFLAGS) -I $(OBJROOT) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) stackshot_translated_child.c -o $(SYMROOT)/stackshot_translated_child
149
150install-stackshot_translated_child: stackshot_translated_child
151 mkdir -p $(INSTALLDIR)
152 cp $(SYMROOT)/stackshot_translated_child $(INSTALLDIR)/
153else
154EXCLUDED_SOURCES += stackshot_translated_child.c
155endif
156
157telemetry: OTHER_LDFLAGS = -framework ktrace -framework kperf -framework CoreFoundation
d9a64523 158
5ba3f43e
A
159memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
160memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
161memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
162
f427ee49
A
163ifeq ($(PLATFORM),BridgeOS)
164EXCLUDED_SOURCES += dirtiness_tracking.c
165endif
166
167dirtiness_tracking: OTHER_CFLAGS += -Wno-cast-align
168
ea3f0419
A
169kpc: OTHER_LDFLAGS += -framework kperf -framework ktrace
170kpc: INVALID_ARCHS = i386
813fb2f6 171
39037602 172kperf: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 173kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
39037602 174
f427ee49
A
175memcmp_zero: OTHER_CFLAGS += ../osfmk/arm64/memcmp_zero.s
176
39037602 177kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 178kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
39037602 179kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
f427ee49 180kperf_backtracing: CODE_SIGN_ENTITLEMENTS = kernel_symbolication_entitlements.plist
39037602 181
5ba3f43e
A
182kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
183kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
184
39037602
A
185mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
186
5ba3f43e 187monotonic_core: OTHER_LDFLAGS += -framework ktrace
5ba3f43e 188
d9a64523 189perf_exit: perf_exit_proc
0a7de745 190perf_exit: OTHER_LDFLAGS = -framework ktrace -ldarwintest_utils
5ba3f43e
A
191perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
192
cb323159
A
193CUSTOM_TARGETS += prioritize_process_launch_helper
194prioritize_process_launch: prioritize_process_launch_helper
195
196prioritize_process_launch_helper: prioritize_process_launch_helper.c
197 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) prioritize_process_launch_helper.c -o $(SYMROOT)/prioritize_process_launch_helper
198 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
199 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
200
201install-prioritize_process_launch_helper: prioritize_process_launch_helper
202 mkdir -p $(INSTALLDIR)
203 cp $(SYMROOT)/prioritize_process_launch_helper $(INSTALLDIR)/
204
205
5ba3f43e
A
206perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
207
cb323159
A
208mach_exception_reply: OTHER_CFLAGS += -Wno-cast-align
209
5ba3f43e
A
210os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
211os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
39037602 212
f427ee49
A
213subsystem_root_path: subsystem_root_path.c subsystem_root_path-entitlements.plist
214subsystem_root_path: CODE_SIGN_ENTITLEMENTS=subsystem_root_path-entitlements.plist
cb323159 215
f427ee49
A
216EXCLUDED_SOURCES += $(wildcard bounded_ptr_src/*.cpp)
217bounded_ptr: OTHER_CXXFLAGS += -Werror=implicit-int-conversion -Werror=shorten-64-to-32 -I$(SRCROOT)/../libkern -std=c++17
218bounded_ptr: $(wildcard bounded_ptr_src/*.cpp) bounded_ptr.cpp
cb323159 219
f427ee49
A
220EXCLUDED_SOURCES += bounded_ptr_03.cpp
221bounded_ptr_03: OTHER_CXXFLAGS += -Werror=implicit-int-conversion -Werror=shorten-64-to-32 -I$(SRCROOT)/../libkern -std=c++03
222bounded_ptr_03: bounded_ptr_03.cpp
223
224EXCLUDED_SOURCES += $(wildcard bounded_array_src/*.cpp)
225bounded_array: OTHER_CXXFLAGS += -Werror=implicit-int-conversion -Werror=shorten-64-to-32 -I$(SRCROOT)/../libkern -std=c++17
226bounded_array: $(wildcard bounded_array_src/*.cpp) bounded_array.cpp
cb323159 227
f427ee49
A
228EXCLUDED_SOURCES += $(wildcard bounded_array_ref_src/*.cpp)
229bounded_array_ref: OTHER_CXXFLAGS += -Werror=implicit-int-conversion -Werror=shorten-64-to-32 -I$(SRCROOT)/../libkern -std=c++17
230bounded_array_ref: $(wildcard bounded_array_ref_src/*.cpp) bounded_array_ref.cpp
231
232EXCLUDED_SOURCES += $(wildcard intrusive_shared_ptr_src/*.cpp)
233intrusive_shared_ptr: OTHER_CXXFLAGS += -Werror=implicit-int-conversion -Werror=shorten-64-to-32 -I$(SRCROOT)/../libkern -std=c++17
234intrusive_shared_ptr: $(wildcard intrusive_shared_ptr_src/*.cpp) intrusive_shared_ptr.cpp
235
236EXCLUDED_SOURCES += $(wildcard safe_allocation_src/*.cpp)
237safe_allocation: OTHER_CXXFLAGS += -Werror=implicit-int-conversion -Werror=shorten-64-to-32 -I$(SRCROOT)/../libkern -std=c++17
238safe_allocation: $(wildcard safe_allocation_src/*.cpp) safe_allocation.cpp
239
240EXCLUDED_SOURCES += osptr_compat.cpp
241osptr_98: OTHER_CXXFLAGS += -I$(SRCROOT)/../libkern -std=c++98 -DOSPTR_STD="98"
242osptr_98: osptr_compat.cpp
243 $(CXX) $(DT_CXXFLAGS) $(OTHER_CXXFLAGS) $(CXXFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
244osptr_11: OTHER_CXXFLAGS += -I$(SRCROOT)/../libkern -std=c++11 -DOSPTR_STD="11"
245osptr_11: osptr_compat.cpp
246 $(CXX) $(DT_CXXFLAGS) $(OTHER_CXXFLAGS) $(CXXFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
247osptr_14: OTHER_CXXFLAGS += -I$(SRCROOT)/../libkern -std=c++14 -DOSPTR_STD="14"
248osptr_14: osptr_compat.cpp
249 $(CXX) $(DT_CXXFLAGS) $(OTHER_CXXFLAGS) $(CXXFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
250osptr_17: OTHER_CXXFLAGS += -I$(SRCROOT)/../libkern -std=c++17 -DOSPTR_STD="17"
251osptr_17: osptr_compat.cpp
cb323159
A
252 $(CXX) $(DT_CXXFLAGS) $(OTHER_CXXFLAGS) $(CXXFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
253
f427ee49 254priority_queue: OTHER_CXXFLAGS += -std=c++17
cb323159
A
255
256os_refcnt: OTHER_CFLAGS += -I$(SRCROOT)/../libkern/ -Wno-gcc-compat -Wno-undef -O3 -flto
257
813fb2f6
A
258task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
259task_inspect: OTHER_CFLAGS += -DENTITLED=1
260
d9a64523
A
261turnstile_multihop: OTHER_CFLAGS += -Wno-unused-macros
262turnstile_multihop: OTHER_CFLAGS += -I $(OBJROOT)/
263
813fb2f6
A
264CUSTOM_TARGETS += perf_exit_proc
265
266perf_exit_proc:
267 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
268
269install-perf_exit_proc: perf_exit_proc
270 mkdir -p $(INSTALLDIR)
271 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
272
39037602
A
273stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
274
813fb2f6 275stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
a39ff7e2
A
276ifeq ($(PLATFORM),MacOSX)
277stackshot_block_owner_14362384: OTHER_LDFLAGS += -lpcre
278endif
279
280all: $(DSTROOT)/usr/local/bin/kcdata
281
d9a64523 282$(DSTROOT)/usr/local/bin/kcdata: $(SRCROOT)/../tools/lldbmacros/kcdata.py
a39ff7e2
A
283 mkdir -p $(dir $@)
284 cp $< $@
285 chmod a+x $@
813fb2f6 286
5ba3f43e 287xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
a39ff7e2 288
d9a64523
A
289xnu_quick_test_entitled: CODE_SIGN_ENTITLEMENTS = xnu_quick_test.entitlements
290
291CUSTOM_TARGETS += vm_set_max_addr_helper
292
293vm_set_max_addr_helper: vm_set_max_addr_helper.c
294 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) vm_set_max_addr_helper.c -o $(SYMROOT)/vm_set_max_addr_helper; \
295 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
296 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
297
298install-vm_set_max_addr_helper: vm_set_max_addr_helper
299 mkdir -p $(INSTALLDIR)
300 cp $(SYMROOT)/vm_set_max_addr_helper $(INSTALLDIR)/
301
f427ee49
A
302CUSTOM_TARGETS += subsystem_root_path_helper_entitled
303CUSTOM_TARGETS += subsystem_root_path_helper
304
305subsystem_root_path_helper_entitled: subsystem_root_path_helper.c subsystem_root_path-entitlements.plist
306 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) subsystem_root_path_helper.c -o $(SYMROOT)/subsystem_root_path_helper_entitled; \
307 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
308 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements subsystem_root_path-entitlements.plist $(SYMROOT)/$@;
309
310install-subsystem_root_path_helper_entitled: subsystem_root_path_helper_entitled
311 mkdir -p $(INSTALLDIR)
312 cp $(SYMROOT)/subsystem_root_path_helper_entitled $(INSTALLDIR)/
313
314subsystem_root_path_helper: subsystem_root_path_helper.c
315 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) subsystem_root_path_helper.c -o $(SYMROOT)/subsystem_root_path_helper; \
316 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
317 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
318
319install-subsystem_root_path_helper: subsystem_root_path_helper
320 mkdir -p $(INSTALLDIR)
321 cp $(SYMROOT)/subsystem_root_path_helper $(INSTALLDIR)/
322
323CUSTOM_TARGETS += vm_test_code_signing_helper
324
325vm_test_code_signing_helper: vm_test_code_signing_helper.c
326 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) vm_test_code_signing_helper.c -o $(SYMROOT)/vm_test_code_signing_helper; \
327 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
328 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
329
330install-vm_test_code_signing_helper: vm_test_code_signing_helper
331 mkdir -p $(INSTALLDIR)
332 cp $(SYMROOT)/vm_test_code_signing_helper $(INSTALLDIR)/
333
334vm_test_code_signing: OTHER_LDFLAGS += -ldarwintest_utils
335
336INCLUDED_TEST_SOURCE_DIRS += vm
337
338# Revert to legacy vm_test suite until <rdar://problem/56675212> gets solved
339EXCLUDED_SOURCES += vm/vm_allocation.c
340
813fb2f6 341ifeq ($(PLATFORM),iPhoneOS)
f427ee49 342OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled jumbo_va_spaces_52551256 vm_phys_footprint_legacy vm/entitlement_increased_memory_limit vm/entitlement_increased_memory_limit_unentitled
813fb2f6 343jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
f427ee49 344jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1 -DTESTNAME=jumbo_va_spaces_28530648
813fb2f6
A
345jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
346
f427ee49
A
347jumbo_va_spaces_52551256: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_52551256.entitlements
348jumbo_va_spaces_52551256: OTHER_CFLAGS += -DENTITLED=1 -DTESTNAME=jumbo_va_spaces_52551256
349jumbo_va_spaces_52551256: OTHER_LDFLAGS += -ldarwintest_utils
350jumbo_va_spaces_52551256: jumbo_va_spaces_28530648.c
351 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
352 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements $(CODE_SIGN_ENTITLEMENTS) $(SYMROOT)/$@;
353
813fb2f6 354jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
f427ee49 355jumbo_va_spaces_28530648_unentitled: OTHER_CFLAGS += -DTESTNAME=jumbo_va_spaces_28530648_unentitled
813fb2f6
A
356jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
357 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
cb323159 358
f427ee49
A
359vm/entitlement_increased_memory_limit: CODE_SIGN_ENTITLEMENTS = vm/entitlement_increased_memory_limit.entitlements
360vm/entitlement_increased_memory_limit: OTHER_CFLAGS += -DENTITLED=1
361vm/entitlement_increased_memory_limit: OTHER_LDFLAGS += -ldarwintest_utils memorystatus_assertion_helpers.c
362vm/entitlement_increased_memory_limit: vm/entitlement_increased_memory_limit.c
363 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
364 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements $(CODE_SIGN_ENTITLEMENTS) $(SYMROOT)/$@;
365
366vm/entitlement_increased_memory_limit_unentitled: OTHER_LDFLAGS += -ldarwintest_utils memorystatus_assertion_helpers.c
367vm/entitlement_increased_memory_limit_unentitled: vm/entitlement_increased_memory_limit.c
368 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
369
cb323159
A
370vm_phys_footprint_legacy: OTHER_LDFLAGS += -framework CoreFoundation -framework IOSurface
371vm_phys_footprint_legacy: OTHER_CFLAGS += -DLEGACY_FOOTPRINT_ENTITLED=1
372vm_phys_footprint_legacy: CODE_SIGN_ENTITLEMENTS=./legacy_footprint.entitlement
373vm_phys_footprint_legacy: vm_phys_footprint.c
374 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
375
813fb2f6
A
376endif
377
5ba3f43e
A
378task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
379
f427ee49
A
380inspect_port: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
381
a39ff7e2
A
382proc_info: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
383proc_info: OTHER_LDFLAGS += -ldarwintest_utils
384
d9a64523
A
385proc_info_list_kthreads: CODE_SIGN_ENTITLEMENTS = ./proc_info_list_kthreads.entitlements
386
cb323159
A
387proc_info_44873309: CODE_SIGN_ENTITLEMENTS = ./proc_info_44873309.entitlements
388
5ba3f43e
A
389disk_mount_conditioner: disk_mount_conditioner*
390disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
391disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
392
cb323159 393disk_mount_conditioner: OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
5ba3f43e
A
394disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
395disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
396disk_mount_conditioner_unentitled: disk_mount_conditioner.c
397 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
398
399work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
400work_interval_test: OTHER_CFLAGS += -DENTITLED=1
401
a39ff7e2
A
402settimeofday_29193041: OTHER_CFLAGS += drop_priv.c
403
5ba3f43e 404settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
a39ff7e2
A
405settimeofday_29193041_entitled: OTHER_CFLAGS += drop_priv.c
406
5ba3f43e 407thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
5ba3f43e
A
408
409task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
410
f427ee49
A
411ifneq ($(PLATFORM),iPhoneOS)
412 EXCLUDED_SOURCES += task_vm_info_decompressions.c
413endif
cb323159 414
a39ff7e2
A
415socket_bind_35243417: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
416socket_bind_35685803: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
417
d9a64523
A
418net_tuntests: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
419
ea3f0419
A
420net_bridge: OTHER_CFLAGS += bpflib.c in_cksum.c
421net_bridge: OTHER_LDFLAGS += -ldarwintest_utils
422
f427ee49 423CUSTOM_TARGETS += posix_spawn_archpref_helper
94ff46dc 424
f427ee49
A
425posix_spawn_archpref_helper:
426 $(CC) $(LDFLAGS) $(CFLAGS) posix_spawn_archpref_helper.c -o $(SYMROOT)/$@;
94ff46dc
A
427 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
428
f427ee49 429install-posix_spawn_archpref_helper:
94ff46dc 430 mkdir -p $(INSTALLDIR)
f427ee49 431 cp $(SYMROOT)/posix_spawn_archpref_helper $(INSTALLDIR)/
a39ff7e2 432
d9a64523
A
433MIG:=SDKROOT=$(SDKROOT) $(shell xcrun -sdk "$(TARGETSDK)" -find mig)
434
435CUSTOM_TARGETS += excserver
436
437excserver:
438 $(MIG) $(CFLAGS) \
439 -sheader $(OBJROOT)/excserver.h \
440 -server $(OBJROOT)/excserver.c \
441 -header /dev/null -user /dev/null \
442 excserver.defs
443install-excserver: ;
444
f427ee49
A
445EXCLUDED_SOURCES += exc_helpers.c
446
447
448x18: OTHER_CFLAGS += -Wno-language-extension-token
449
d9a64523
A
450exc_resource_threads: excserver
451exc_resource_threads: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT)
452
f427ee49 453fp_exception: excserver exc_helpers.c
cb323159
A
454fp_exception: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT)
455
f427ee49
A
456ptrauth_failure: excserver exc_helpers.c
457ptrauth_failure: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT) -Wno-language-extension-token
458ptrauth_failure: CODESIGN = $(CODESIGN_HARDENED_RUNTIME)
459
460# This test currently relies on pid_hibernate(), which is only available on embedded platforms.
461ifeq ($(PLATFORM),MacOSX)
462EXCLUDED_SOURCES += decompression_failure.c
0a7de745 463else
f427ee49
A
464decompression_failure: excserver exc_helpers.c
465decompression_failure: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT)
466endif
467
468ifeq ($(findstring x86_64,$(ARCH_CONFIGS)),)
469EXCLUDED_SOURCES += ldt_code32.s ldt.c
470else # target = osx
0a7de745
A
471$(OBJROOT)/ldt_mach_exc_server.c:
472 $(MIG) $(CFLAGS) \
473 -user /dev/null \
474 -server $(OBJROOT)/ldt_mach_exc_server.c \
475 -header $(OBJROOT)/ldt_mach_exc.h \
476 mach_exc.defs
477
f427ee49 478ldt: INVALID_ARCHS = $(ARCH_CONFIGS)
0a7de745 479ldt: $(OBJROOT)/ldt_mach_exc_server.c
f427ee49 480ldt: OTHER_CFLAGS += -arch x86_64 -I $(OBJROOT) $(SRCROOT)/ldt_code32.s -Wl,-pagezero_size,0x1000 -Wno-missing-variable-declarations
cb323159 481ldt: CODE_SIGN_ENTITLEMENTS=ldt_entitlement.plist
0a7de745
A
482endif
483
d26ffc64
A
484ifneq ($(PLATFORM),BridgeOS)
485EXCLUDED_SOURCES += remote_time.c
486else
487remote_time: INVALID_ARCHS = armv7 armv7s arm64_32
488endif
489
0a7de745 490vm_phys_footprint: OTHER_LDFLAGS += -framework CoreFoundation -framework IOSurface
cb323159 491
f427ee49
A
492vm_kern_count_wired_kernelcache: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders/mach
493
cb323159
A
494debug_control_port_for_pid: CODE_SIGN_ENTITLEMENTS = ./debug_control_port_for_pid_entitlement.plist
495
496prng: OTHER_LDFLAGS += -ldarwintest_utils
0a7de745 497
f427ee49
A
498preoslog: OTHER_LDFLAGS += -ldarwintest_utils
499
500task_policy: CODE_SIGN_ENTITLEMENTS = ./task_policy_entitlement.plist
501
502OTHER_TEST_TARGETS += task_policy_unentitled
503task_policy_unentitled: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
504task_policy_unentitled: OTHER_CFLAGS += -DUNENTITLED
505task_policy_unentitled: task_policy.c
506 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
507 $(CODESIGN) --force --sign - --timestamp=none --entitlements $(CODE_SIGN_ENTITLEMENTS) $(SYMROOT)/$@
508
509
510EXCLUDED_SOURCES += get_shared_cache_address.c
511ifeq ($(PLATFORM),iPhoneOS)
512CUSTOM_TARGETS += get_shared_cache_address
513get_shared_cache_address: INVALID_ARCHS = arm64
514get_shared_cache_address: get_shared_cache_address.c
515 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/get_shared_cache_address
516
517install-get_shared_cache_address: get_shared_cache_address
518 $(CODESIGN) --force --sign - --timestamp=none --identifier=com.apple.get_shared_cache_address $(SYMROOT)/get_shared_cache_address
519 mkdir -p $(INSTALLDIR)
520 cp $(SYMROOT)/get_shared_cache_address $(INSTALLDIR)/
521endif
522
523ifneq ($(PLATFORM),MacOSX)
524EXCLUDED_SOURCES += hvtest_x86.m hvtest_x86_guest.c hvtest_x86_asm.s
525else
526EXCLUDED_SOURCES += hvtest_x86_guest.c hvtest_x86_asm.s
527hvtest_x86: CODE_SIGN_ENTITLEMENTS = hv_public.entitlements
528hvtest_x86: INVALID_ARCHS += arm64e arm64 i386
529hvtest_x86: OTHER_CFLAGS += hvtest_x86_guest.c hvtest_x86_asm.s -framework Hypervisor -framework Foundation
530endif
531
532OTHER_TEST_TARGETS += io_catalog_send_data vm_memory_share_tests
533
534vm_memory_share_tests: INVALID_ARCHS = i386
535vm_memory_share_tests: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
536vm_memory_share_tests: vm_memory_tests_src/main.c vm_memory_tests_src/common.c vm_memory_tests_src/vm_tests.c
537 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/$@
538 echo $(CODESIGN) --force --sign - --timestamp=none --entitlements $(SRCROOT)/$(CODE_SIGN_ENTITLEMENTS) $(SYMROOT)/$@;
539 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements "$(SRCROOT)/$(CODE_SIGN_ENTITLEMENTS)" $(SYMROOT)/$@;
540
541# build the mach server as individual helper which does not use libdarwintest
542CUSTOM_TARGETS += vm_memory_share_tests_server
543vm_memory_share_tests_server: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
544vm_memory_share_tests_server: vm_memory_tests_src/server.c vm_memory_tests_src/common.c vm_memory_tests_src/vm_tests.c
545 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $^ -o $(SYMROOT)/vm_memory_share_tests_server
546 echo $(CODESIGN) --force --sign - --timestamp=none --entitlements $(SRCROOT)/$(CODE_SIGN_ENTITLEMENTS) $(SYMROOT)/$@;
547 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none --entitlements "$(SRCROOT)/$(CODE_SIGN_ENTITLEMENTS)" $(SYMROOT)/$@;
548
549install-vm_memory_share_tests_server: vm_memory_share_tests_server
550 mkdir -p $(INSTALLDIR)
551 cp $(SYMROOT)/vm_memory_share_tests_server $(INSTALLDIR)/
ea3f0419
A
552
553io_catalog_send_data: INVALID_ARCHS = i386
554io_catalog_send_data: OTHER_CFLAGS += -DTEST_UNENTITLED -framework IOKit -framework CoreFoundation -framework Foundation
f427ee49 555
ea3f0419
A
556io_catalog_send_data: iokit/io_catalog_send_data.m
557 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
558
f427ee49
A
559ifeq ($(PLATFORM),MacOSX)
560EXCLUDED_SOURCES += vm/kern_max_task_pmem.c
561endif
562
563EXCLUDED_SOURCES += vm/perf_helpers.c
564
565fault_throughput: vm/fault_throughput.c
566 mkdir -p $(SYMROOT)/vm
567 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/vm/$@
568fault_throughput: OTHER_CFLAGS += vm/perf_helpers.c
569
570install-fault_throughput: fault_throughput
571 mkdir -p $(INSTALLDIR)/vm
572 cp $(SYMROOT)/vm/fault_throughput $(INSTALLDIR)/vm/
573
574BATS_PLISTS += $(SRCROOT)/vm/fault_throughput.plist
575
576fault_throughput_benchrun:
577 mkdir -p $(SYMROOT)/vm
578 cp $(SRCROOT)/vm/fault_throughput.lua $(SYMROOT)/vm/fault_throughput.lua
579 chmod +x $(SYMROOT)/vm/fault_throughput.lua
580
581install-fault_throughput_benchrun: fault_throughput_benchrun
582 mkdir -p $(INSTALLDIR)/vm
583 cp $(SYMROOT)/vm/fault_throughput.lua $(INSTALLDIR)/vm
584 chmod +x $(INSTALLDIR)/vm/fault_throughput.lua
585
586CUSTOM_TARGETS += fault_throughput fault_throughput_benchrun
587EXCLUDED_SOURCES += vm/fault_throughput.plist vm/fault_throughput.c
588
589perf_madvise: vm/perf_madvise.c
590 mkdir -p $(SYMROOT)/vm
591 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/vm/$@
592perf_madvise: OTHER_CFLAGS += vm/perf_helpers.c
593install-perf_madvise: perf_madvise
594 mkdir -p $(INSTALLDIR)/vm
595 cp $(SYMROOT)/vm/perf_madvise $(INSTALLDIR)/vm/
596perf_madvise_benchrun:
597 mkdir -p $(SYMROOT)/vm
598 cp $(SRCROOT)/vm/perf_madvise.lua $(SYMROOT)/vm/perf_madvise.lua
599 chmod +x $(SYMROOT)/vm/perf_madvise.lua
600install-perf_madvise_benchrun: perf_madvise_benchrun
601 mkdir -p $(INSTALLDIR)/vm
602 cp $(SYMROOT)/vm/perf_madvise.lua $(INSTALLDIR)/vm
603 chmod +x $(INSTALLDIR)/vm/perf_madvise.lua
604
605CUSTOM_TARGETS += perf_madvise perf_madvise_benchrun
606EXCLUDED_SOURCES += vm/perf_madvise.c
607
ea3f0419
A
608task_create_suid_cred: CODE_SIGN_ENTITLEMENTS = ./task_create_suid_cred_entitlement.plist
609
610OTHER_TEST_TARGETS += task_create_suid_cred_unentitled
611task_create_suid_cred_unentitled: OTHER_CFLAGS += -DUNENTITLED
612task_create_suid_cred_unentitled: task_create_suid_cred.c
613 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
614
f427ee49
A
615ifeq ($(PLATFORM),MacOSX)
616test_dext_launch_56101852: OTHER_LDFLAGS += -framework CoreFoundation -framework IOKit
617test_dext_launch_56101852: CODE_SIGN_ENTITLEMENTS += test_dext_launch_56101852.entitlements
618else
619EXCLUDED_SOURCES += test_dext_launch_56101852.c
620endif
621
622ioconnectasyncmethod_57641955: OTHER_LDFLAGS += -framework IOKit
623
624ifeq ($(PLATFORM),BridgeOS)
625EXCLUDED_SOURCES += ipsec.m
626else
627ipsec: OTHER_LDFLAGS += -framework Foundation -framework CoreFoundation -framework NetworkExtension
628ipsec: CODE_SIGN_ENTITLEMENTS = ipsec.entitlements
629endif
630
631test_sysctl_kern_procargs_25397314: OTHER_LDFLAGS += -framework Foundation -ldarwintest_utils
632
39037602 633include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets