]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/darwintests/Makefile
xnu-4570.61.1.tar.gz
[apple/xnu.git] / tools / tests / darwintests / Makefile
1 PROJECT := 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.
5 ifdef BASEDSTROOT
6 override DSTROOT = $(BASEDSTROOT)
7 endif
8
9 ENABLE_LTE_TESTS=YES
10
11 OTHER_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
17 DEVELOPER_DIR ?= /Applications/Xcode.app/Contents/Developer/
18
19 # the xnu build system will only ever call us with the default target
20 .DEFAULT_GOAL := install
21
22 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
23
24 OTHER_CFLAGS = -Weverything -Wno-gnu-union-cast -Wno-missing-field-initializers -Wno-partial-availability
25 OTHER_CFLAGS += -Wno-missing-noreturn -Wno-vla -Wno-reserved-id-macro -Wno-documentation-unknown-command
26 OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused -Wno-covered-switch-default -Wno-nullability-extension
27 OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
28 OTHER_CFLAGS += -DT_NAMESPACE_PREFIX=xnu
29 OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
30
31 CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
32 CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
33
34 # to have custom compiler flags to
35 # target: OTHER_CFLAGS += <my flags>
36
37 atm_diagnostic_flag: OTHER_CFLAGS += drop_priv.c
38
39 avx: INVALID_ARCHS = i386
40 avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
41 avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
42 avx: CONFIG_FLAGS := $(filter-out -O%,$(CONFIG_FLAGS))
43 # Level 2 optimization must be used to prevent compiler from generating
44 # invalid instructions when compiling with AVX-512 flags.
45 avx: CONFIG_FLAGS += -O2
46 # Disable vzeroupper insertion to work around rdar://problem/35035096
47 avx: CONFIG_FLAGS += -mllvm -x86-use-vzeroupper=0
48 ifneq (osx,$(TARGET_NAME))
49 EXCLUDED_SOURCES += avx.c
50 endif
51
52 backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
53
54 data_protection: OTHER_LDFLAGS += -ldarwintest_utils -framework IOKit
55
56 kdebug: INVALID_ARCHS = i386
57 kdebug: OTHER_LDFLAGS = -framework ktrace
58
59 EXCLUDED_SOURCES += drop_priv.c kperf_helpers.c xnu_quick_test_helpers.c
60
61 ifeq ($(PLATFORM),iPhoneOS)
62 CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
63 else
64 CONFIG_FREEZE_DEFINE:=
65 EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
66 endif
67
68 perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
69 perf_compressor: OTHER_LDFLAGS += -ldarwintest_utils
70 perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
71
72 stackshot: OTHER_LDFLAGS += -lkdd -framework Foundation
73 stackshot: INVALID_ARCHS = i386
74
75 memorystatus_zone_test: INVALID_ARCHS = i386
76 memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
77 memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
78 memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
79
80 kpc: OTHER_LDFLAGS += -framework kperf
81
82 kperf: INVALID_ARCHS = i386
83 kperf: OTHER_CFLAGS += kperf_helpers.c
84 kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
85
86 kperf_backtracing: INVALID_ARCHS = i386
87 kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
88 kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
89 kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
90
91 kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
92 kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
93
94 mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
95
96 monotonic_core: OTHER_LDFLAGS += -framework ktrace
97 monotonic_core: INVALID_ARCHS = i386
98
99 perf_exit: OTHER_LDFLAGS = -framework ktrace
100 perf_exit: INVALID_ARCHS = i386
101 perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
102
103 perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
104
105 os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
106 os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
107
108 task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
109 task_inspect: OTHER_CFLAGS += -DENTITLED=1
110
111 CUSTOM_TARGETS += perf_exit_proc
112
113 perf_exit_proc:
114 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
115
116 install-perf_exit_proc: perf_exit_proc
117 mkdir -p $(INSTALLDIR)
118 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
119
120 perf_kdebug: INVALID_ARCHS = i386
121
122 stackshot_idle_25570396: INVALID_ARCHS = i386
123 stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
124
125 stackshot_block_owner_14362384: INVALID_ARCHS = i386
126 stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
127 ifeq ($(PLATFORM),MacOSX)
128 stackshot_block_owner_14362384: OTHER_LDFLAGS += -lpcre
129 endif
130
131 all: $(DSTROOT)/usr/local/bin/kcdata
132
133 $(DSTROOT)/usr/local/bin/kcdata: $(SRCROOT)/../../lldbmacros/kcdata.py
134 mkdir -p $(dir $@)
135 cp $< $@
136 chmod a+x $@
137
138 xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
139
140 ifeq ($(PLATFORM),iPhoneOS)
141 OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
142 jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
143 jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
144 jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
145
146 jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
147 jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
148 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
149 endif
150
151 task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
152
153 proc_info: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
154 proc_info: OTHER_LDFLAGS += -ldarwintest_utils
155
156 disk_mount_conditioner: disk_mount_conditioner*
157 disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
158 disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
159
160 OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
161 disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
162 disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
163 disk_mount_conditioner_unentitled: disk_mount_conditioner.c
164 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
165
166 work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
167 work_interval_test: OTHER_CFLAGS += -DENTITLED=1
168
169 settimeofday_29193041: OTHER_CFLAGS += drop_priv.c
170
171 settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
172 settimeofday_29193041_entitled: OTHER_CFLAGS += drop_priv.c
173
174 thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
175 thread_group_set_32261625: INVALID_ARCHS = i386
176
177 task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
178
179 socket_bind_35243417: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
180 socket_bind_35685803: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
181
182 ifneq (osx,$(TARGET_NAME))
183 EXCLUDED_SOURCES += no32exec_35914211.c no32exec_35914211_helper.c
184 endif
185
186 no32exec_35914211_helper: INVALID_ARCHS = x86_64
187 no32exec_35914211: INVALID_ARCHS = i386
188
189 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets