]> git.saurik.com Git - apple/xnu.git/blame - tests/Makefile
xnu-4903.270.47.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
0a7de745 27OTHER_CFLAGS += -Wno-gnu-empty-initializer -Wno-unused-macros -Wno-undef
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
0a7de745
A
40testposixshm: INVALID_ARCHS = i386
41
5ba3f43e
A
42avx: INVALID_ARCHS = i386
43avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
44avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
45avx: CONFIG_FLAGS := $(filter-out -O%,$(CONFIG_FLAGS))
46# Level 2 optimization must be used to prevent compiler from generating
47# invalid instructions when compiling with AVX-512 flags.
48avx: CONFIG_FLAGS += -O2
a39ff7e2
A
49# Disable vzeroupper insertion to work around rdar://problem/35035096
50avx: CONFIG_FLAGS += -mllvm -x86-use-vzeroupper=0
5ba3f43e
A
51ifneq (osx,$(TARGET_NAME))
52EXCLUDED_SOURCES += avx.c
53endif
54
39037602
A
55backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
56
a39ff7e2 57data_protection: OTHER_LDFLAGS += -ldarwintest_utils -framework IOKit
813fb2f6 58
39037602 59kdebug: INVALID_ARCHS = i386
d9a64523 60kdebug: OTHER_LDFLAGS = -framework ktrace -ldarwintest_utils -framework kperf
39037602 61
a39ff7e2 62EXCLUDED_SOURCES += drop_priv.c kperf_helpers.c xnu_quick_test_helpers.c
39037602 63
0a7de745
A
64ifneq ($(PLATFORM),iPhoneOS)
65EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c perf_compressor.c memorystatus_freeze_test.c
813fb2f6
A
66endif
67
a39ff7e2 68perf_compressor: OTHER_LDFLAGS += -ldarwintest_utils
5ba3f43e
A
69perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
70
d9a64523
A
71memorystatus_freeze_test: OTHER_LDFLAGS += -ldarwintest_utils
72
73stackshot: OTHER_CFLAGS += -Wno-objc-messaging-id
5ba3f43e
A
74stackshot: OTHER_LDFLAGS += -lkdd -framework Foundation
75stackshot: INVALID_ARCHS = i386
76
0a7de745 77telemetry: OTHER_LDFLAGS = -framework ktrace -framework CoreFoundation
d9a64523
A
78telemetry: INVALID_ARCHS = i386
79
5ba3f43e
A
80memorystatus_zone_test: INVALID_ARCHS = i386
81memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
82memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
83memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
84
85kpc: OTHER_LDFLAGS += -framework kperf
813fb2f6 86
39037602
A
87kperf: INVALID_ARCHS = i386
88kperf: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 89kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
39037602
A
90
91kperf_backtracing: INVALID_ARCHS = i386
92kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 93kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
39037602
A
94kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
95
5ba3f43e
A
96kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
97kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
98
39037602
A
99mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
100
5ba3f43e
A
101monotonic_core: OTHER_LDFLAGS += -framework ktrace
102monotonic_core: INVALID_ARCHS = i386
103
d9a64523 104perf_exit: perf_exit_proc
0a7de745 105perf_exit: OTHER_LDFLAGS = -framework ktrace -ldarwintest_utils
39037602 106perf_exit: INVALID_ARCHS = i386
5ba3f43e
A
107perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
108
109perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
110
111os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
112os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
39037602 113
813fb2f6
A
114task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
115task_inspect: OTHER_CFLAGS += -DENTITLED=1
116
d9a64523
A
117turnstile_multihop: OTHER_CFLAGS += -Wno-unused-macros
118turnstile_multihop: OTHER_CFLAGS += -I $(OBJROOT)/
119
813fb2f6
A
120CUSTOM_TARGETS += perf_exit_proc
121
122perf_exit_proc:
123 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
124
125install-perf_exit_proc: perf_exit_proc
126 mkdir -p $(INSTALLDIR)
127 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
128
129perf_kdebug: INVALID_ARCHS = i386
130
39037602
A
131stackshot_idle_25570396: INVALID_ARCHS = i386
132stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
133
813fb2f6
A
134stackshot_block_owner_14362384: INVALID_ARCHS = i386
135stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
a39ff7e2
A
136ifeq ($(PLATFORM),MacOSX)
137stackshot_block_owner_14362384: OTHER_LDFLAGS += -lpcre
138endif
139
140all: $(DSTROOT)/usr/local/bin/kcdata
141
d9a64523 142$(DSTROOT)/usr/local/bin/kcdata: $(SRCROOT)/../tools/lldbmacros/kcdata.py
a39ff7e2
A
143 mkdir -p $(dir $@)
144 cp $< $@
145 chmod a+x $@
813fb2f6 146
5ba3f43e 147xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
a39ff7e2 148
d9a64523
A
149xnu_quick_test_entitled: CODE_SIGN_ENTITLEMENTS = xnu_quick_test.entitlements
150
151CUSTOM_TARGETS += vm_set_max_addr_helper
152
153vm_set_max_addr_helper: vm_set_max_addr_helper.c
154 $(CC) $(OTHER_CFLAGS) $(CFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) vm_set_max_addr_helper.c -o $(SYMROOT)/vm_set_max_addr_helper; \
155 echo $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@; \
156 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/$@;
157
158install-vm_set_max_addr_helper: vm_set_max_addr_helper
159 mkdir -p $(INSTALLDIR)
160 cp $(SYMROOT)/vm_set_max_addr_helper $(INSTALLDIR)/
161
813fb2f6
A
162ifeq ($(PLATFORM),iPhoneOS)
163OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
164jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
165jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
166jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
167
168jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
169jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
170 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
171endif
172
5ba3f43e
A
173task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
174
a39ff7e2
A
175proc_info: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
176proc_info: OTHER_LDFLAGS += -ldarwintest_utils
177
d9a64523
A
178proc_info_list_kthreads: CODE_SIGN_ENTITLEMENTS = ./proc_info_list_kthreads.entitlements
179
5ba3f43e
A
180disk_mount_conditioner: disk_mount_conditioner*
181disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
182disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
183
184OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
185disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
186disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
187disk_mount_conditioner_unentitled: disk_mount_conditioner.c
188 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
189
190work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
191work_interval_test: OTHER_CFLAGS += -DENTITLED=1
192
a39ff7e2
A
193settimeofday_29193041: OTHER_CFLAGS += drop_priv.c
194
5ba3f43e 195settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
a39ff7e2
A
196settimeofday_29193041_entitled: OTHER_CFLAGS += drop_priv.c
197
5ba3f43e
A
198thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
199thread_group_set_32261625: INVALID_ARCHS = i386
200
201task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
202
a39ff7e2
A
203socket_bind_35243417: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
204socket_bind_35685803: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
205
d9a64523
A
206net_tuntests: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
207
a39ff7e2
A
208ifneq (osx,$(TARGET_NAME))
209EXCLUDED_SOURCES += no32exec_35914211.c no32exec_35914211_helper.c
210endif
211
212no32exec_35914211_helper: INVALID_ARCHS = x86_64
213no32exec_35914211: INVALID_ARCHS = i386
214
d9a64523
A
215MIG:=SDKROOT=$(SDKROOT) $(shell xcrun -sdk "$(TARGETSDK)" -find mig)
216
217CUSTOM_TARGETS += excserver
218
219excserver:
220 $(MIG) $(CFLAGS) \
221 -sheader $(OBJROOT)/excserver.h \
222 -server $(OBJROOT)/excserver.c \
223 -header /dev/null -user /dev/null \
224 excserver.defs
225install-excserver: ;
226
227exc_resource_threads: excserver
228exc_resource_threads: OTHER_CFLAGS += $(OBJROOT)/excserver.c -I $(OBJROOT)
229
0a7de745
A
230ifneq (osx,$(TARGET_NAME))
231EXCLUDED_SOURCES += ldt_code32.s ldt.c
232else
233$(OBJROOT)/ldt_mach_exc_server.c:
234 $(MIG) $(CFLAGS) \
235 -user /dev/null \
236 -server $(OBJROOT)/ldt_mach_exc_server.c \
237 -header $(OBJROOT)/ldt_mach_exc.h \
238 mach_exc.defs
239
240ldt: INVALID_ARCHS = i386
241ldt: $(OBJROOT)/ldt_mach_exc_server.c
242ldt: OTHER_CFLAGS += -I $(OBJROOT) $(SRCROOT)/ldt_code32.s -Wl,-pagezero_size,0x1000
243endif
244
d26ffc64
A
245ifneq ($(PLATFORM),BridgeOS)
246EXCLUDED_SOURCES += remote_time.c
247else
248remote_time: INVALID_ARCHS = armv7 armv7s arm64_32
249endif
250
0a7de745
A
251vm_phys_footprint: OTHER_LDFLAGS += -framework CoreFoundation -framework IOSurface
252vm_phys_footprint_legacy: legacy_footprint.entitlement
253vm_phys_footprint_legacy: OTHER_LDFLAGS += -framework CoreFoundation -framework IOSurface
254vm_phys_footprint_legacy: CODE_SIGN_ENTITLEMENTS=./legacy_footprint.entitlement
255
39037602 256include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets