]> git.saurik.com Git - apple/xnu.git/blame - tests/Makefile
xnu-4903.241.1.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
5ba3f43e
A
9ENABLE_LTE_TESTS=YES
10
11OTHER_LTE_INCLUDE_FILES += \
12 /System/Library/PrivateFrameworks/LoggingSupport.framework, \
13 /System/Library/PrivateFrameworks/MobileKeyBag.framework, \
14 /usr/local/lib/libdarwintest_utils.dylib, \
15 /usr/lib/libapple_crypto.dylib,
16
d9a64523 17DEVELOPER_DIR ?= $(shell xcode-select -p)
39037602
A
18
19# the xnu build system will only ever call us with the default target
20.DEFAULT_GOAL := install
21
22include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
23
24OTHER_CFLAGS = -Weverything -Wno-gnu-union-cast -Wno-missing-field-initializers -Wno-partial-availability
25OTHER_CFLAGS += -Wno-missing-noreturn -Wno-vla -Wno-reserved-id-macro -Wno-documentation-unknown-command
5ba3f43e 26OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused -Wno-covered-switch-default -Wno-nullability-extension
d9a64523 27OTHER_CFLAGS += -Wno-gnu-empty-initializer -Wno-unused-macros
39037602 28OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
d9a64523 29OTHER_CFLAGS += -UT_NAMESPACE_PREFIX -DT_NAMESPACE_PREFIX=xnu
5ba3f43e 30OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
813fb2f6
A
31
32CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
33CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
39037602
A
34
35# to have custom compiler flags to
36# target: OTHER_CFLAGS += <my flags>
37
a39ff7e2
A
38atm_diagnostic_flag: OTHER_CFLAGS += drop_priv.c
39
5ba3f43e
A
40avx: INVALID_ARCHS = i386
41avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
42avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
43avx: CONFIG_FLAGS := $(filter-out -O%,$(CONFIG_FLAGS))
44# Level 2 optimization must be used to prevent compiler from generating
45# invalid instructions when compiling with AVX-512 flags.
46avx: CONFIG_FLAGS += -O2
a39ff7e2
A
47# Disable vzeroupper insertion to work around rdar://problem/35035096
48avx: CONFIG_FLAGS += -mllvm -x86-use-vzeroupper=0
5ba3f43e
A
49ifneq (osx,$(TARGET_NAME))
50EXCLUDED_SOURCES += avx.c
51endif
52
39037602
A
53backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
54
a39ff7e2 55data_protection: OTHER_LDFLAGS += -ldarwintest_utils -framework IOKit
813fb2f6 56
39037602 57kdebug: INVALID_ARCHS = i386
d9a64523 58kdebug: OTHER_LDFLAGS = -framework ktrace -ldarwintest_utils -framework kperf
39037602 59
a39ff7e2 60EXCLUDED_SOURCES += drop_priv.c kperf_helpers.c xnu_quick_test_helpers.c
39037602 61
813fb2f6
A
62ifeq ($(PLATFORM),iPhoneOS)
63CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
64else
65CONFIG_FREEZE_DEFINE:=
66EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
67endif
68
69perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
a39ff7e2 70perf_compressor: OTHER_LDFLAGS += -ldarwintest_utils
5ba3f43e
A
71perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
72
d9a64523
A
73memorystatus_freeze_test: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
74memorystatus_freeze_test: OTHER_LDFLAGS += -ldarwintest_utils
75
76stackshot: OTHER_CFLAGS += -Wno-objc-messaging-id
5ba3f43e
A
77stackshot: OTHER_LDFLAGS += -lkdd -framework Foundation
78stackshot: INVALID_ARCHS = i386
79
d9a64523
A
80telemetry: OTHER_LDFLAGS = -framework ktrace
81telemetry: INVALID_ARCHS = i386
82
5ba3f43e
A
83memorystatus_zone_test: INVALID_ARCHS = i386
84memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
85memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
86memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
87
88kpc: OTHER_LDFLAGS += -framework kperf
813fb2f6 89
39037602
A
90kperf: INVALID_ARCHS = i386
91kperf: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 92kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
39037602
A
93
94kperf_backtracing: INVALID_ARCHS = i386
95kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 96kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
39037602
A
97kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
98
5ba3f43e
A
99kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
100kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
101
39037602
A
102mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
103
5ba3f43e
A
104monotonic_core: OTHER_LDFLAGS += -framework ktrace
105monotonic_core: INVALID_ARCHS = i386
106
d9a64523 107perf_exit: perf_exit_proc
5ba3f43e 108perf_exit: OTHER_LDFLAGS = -framework ktrace
39037602 109perf_exit: INVALID_ARCHS = i386
5ba3f43e
A
110perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
111
112perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
113
114os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
115os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
39037602 116
813fb2f6
A
117task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
118task_inspect: OTHER_CFLAGS += -DENTITLED=1
119
d9a64523
A
120turnstile_multihop: OTHER_CFLAGS += -Wno-unused-macros
121turnstile_multihop: OTHER_CFLAGS += -I $(OBJROOT)/
122
813fb2f6
A
123CUSTOM_TARGETS += perf_exit_proc
124
125perf_exit_proc:
126 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
127
128install-perf_exit_proc: perf_exit_proc
129 mkdir -p $(INSTALLDIR)
130 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
131
132perf_kdebug: INVALID_ARCHS = i386
133
39037602
A
134stackshot_idle_25570396: INVALID_ARCHS = i386
135stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
136
813fb2f6
A
137stackshot_block_owner_14362384: INVALID_ARCHS = i386
138stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
a39ff7e2
A
139ifeq ($(PLATFORM),MacOSX)
140stackshot_block_owner_14362384: OTHER_LDFLAGS += -lpcre
141endif
142
143all: $(DSTROOT)/usr/local/bin/kcdata
144
d9a64523 145$(DSTROOT)/usr/local/bin/kcdata: $(SRCROOT)/../tools/lldbmacros/kcdata.py
a39ff7e2
A
146 mkdir -p $(dir $@)
147 cp $< $@
148 chmod a+x $@
813fb2f6 149
5ba3f43e 150xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
a39ff7e2 151
d9a64523
A
152xnu_quick_test_entitled: CODE_SIGN_ENTITLEMENTS = xnu_quick_test.entitlements
153
154CUSTOM_TARGETS += vm_set_max_addr_helper
155
156vm_set_max_addr_helper: vm_set_max_addr_helper.c
157 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) vm_set_max_addr_helper.c -o $(SYMROOT)/vm_set_max_addr_helper; \
158 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
159 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
160
161install-vm_set_max_addr_helper: vm_set_max_addr_helper
162 mkdir -p $(INSTALLDIR)
163 cp $(SYMROOT)/vm_set_max_addr_helper $(INSTALLDIR)/
164
813fb2f6
A
165ifeq ($(PLATFORM),iPhoneOS)
166OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
167jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
168jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
169jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
170
171jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
172jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
173 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
174endif
175
5ba3f43e
A
176task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
177
a39ff7e2
A
178proc_info: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
179proc_info: OTHER_LDFLAGS += -ldarwintest_utils
180
d9a64523
A
181proc_info_list_kthreads: CODE_SIGN_ENTITLEMENTS = ./proc_info_list_kthreads.entitlements
182
5ba3f43e
A
183disk_mount_conditioner: disk_mount_conditioner*
184disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
185disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
186
187OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
188disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
189disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
190disk_mount_conditioner_unentitled: disk_mount_conditioner.c
191 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
192
193work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
194work_interval_test: OTHER_CFLAGS += -DENTITLED=1
195
a39ff7e2
A
196settimeofday_29193041: OTHER_CFLAGS += drop_priv.c
197
5ba3f43e 198settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
a39ff7e2
A
199settimeofday_29193041_entitled: OTHER_CFLAGS += drop_priv.c
200
5ba3f43e
A
201thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
202thread_group_set_32261625: INVALID_ARCHS = i386
203
204task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
205
a39ff7e2
A
206socket_bind_35243417: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
207socket_bind_35685803: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
208
d9a64523
A
209net_tuntests: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
210
a39ff7e2
A
211ifneq (osx,$(TARGET_NAME))
212EXCLUDED_SOURCES += no32exec_35914211.c no32exec_35914211_helper.c
213endif
214
215no32exec_35914211_helper: INVALID_ARCHS = x86_64
216no32exec_35914211: INVALID_ARCHS = i386
217
d9a64523
A
218MIG:=SDKROOT=$(SDKROOT) $(shell xcrun -sdk "$(TARGETSDK)" -find mig)
219
220CUSTOM_TARGETS += excserver
221
222excserver:
223 $(MIG) $(CFLAGS) \
224 -sheader $(OBJROOT)/excserver.h \
225 -server $(OBJROOT)/excserver.c \
226 -header /dev/null -user /dev/null \
227 excserver.defs
228install-excserver: ;
229
230exc_resource_threads: excserver
231exc_resource_threads: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT)
232
d26ffc64
A
233ifneq ($(PLATFORM),BridgeOS)
234EXCLUDED_SOURCES += remote_time.c
235else
236remote_time: INVALID_ARCHS = armv7 armv7s arm64_32
237endif
238
39037602 239include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets