]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/darwintests/Makefile
xnu-4570.61.1.tar.gz
[apple/xnu.git] / tools / tests / darwintests / 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
39037602
A
17DEVELOPER_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
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
39037602 27OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
5ba3f43e
A
28OTHER_CFLAGS += -DT_NAMESPACE_PREFIX=xnu
29OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
813fb2f6
A
30
31CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
32CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
39037602
A
33
34# to have custom compiler flags to
35# target: OTHER_CFLAGS += <my flags>
36
a39ff7e2
A
37atm_diagnostic_flag: OTHER_CFLAGS += drop_priv.c
38
5ba3f43e
A
39avx: INVALID_ARCHS = i386
40avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
41avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
42avx: 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.
45avx: CONFIG_FLAGS += -O2
a39ff7e2
A
46# Disable vzeroupper insertion to work around rdar://problem/35035096
47avx: CONFIG_FLAGS += -mllvm -x86-use-vzeroupper=0
5ba3f43e
A
48ifneq (osx,$(TARGET_NAME))
49EXCLUDED_SOURCES += avx.c
50endif
51
39037602
A
52backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
53
a39ff7e2 54data_protection: OTHER_LDFLAGS += -ldarwintest_utils -framework IOKit
813fb2f6 55
39037602 56kdebug: INVALID_ARCHS = i386
5ba3f43e 57kdebug: OTHER_LDFLAGS = -framework ktrace
39037602 58
a39ff7e2 59EXCLUDED_SOURCES += drop_priv.c kperf_helpers.c xnu_quick_test_helpers.c
39037602 60
813fb2f6
A
61ifeq ($(PLATFORM),iPhoneOS)
62CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
63else
64CONFIG_FREEZE_DEFINE:=
65EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
66endif
67
68perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
a39ff7e2 69perf_compressor: OTHER_LDFLAGS += -ldarwintest_utils
5ba3f43e
A
70perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
71
72stackshot: OTHER_LDFLAGS += -lkdd -framework Foundation
73stackshot: INVALID_ARCHS = i386
74
75memorystatus_zone_test: INVALID_ARCHS = i386
76memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
77memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
78memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
79
80kpc: OTHER_LDFLAGS += -framework kperf
813fb2f6 81
39037602
A
82kperf: INVALID_ARCHS = i386
83kperf: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 84kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
39037602
A
85
86kperf_backtracing: INVALID_ARCHS = i386
87kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
5ba3f43e 88kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
39037602
A
89kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
90
5ba3f43e
A
91kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
92kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
93
39037602
A
94mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
95
5ba3f43e
A
96monotonic_core: OTHER_LDFLAGS += -framework ktrace
97monotonic_core: INVALID_ARCHS = i386
98
99perf_exit: OTHER_LDFLAGS = -framework ktrace
39037602 100perf_exit: INVALID_ARCHS = i386
5ba3f43e
A
101perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
102
103perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
104
105os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
106os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
39037602 107
813fb2f6
A
108task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
109task_inspect: OTHER_CFLAGS += -DENTITLED=1
110
111CUSTOM_TARGETS += perf_exit_proc
112
113perf_exit_proc:
114 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
115
116install-perf_exit_proc: perf_exit_proc
117 mkdir -p $(INSTALLDIR)
118 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
119
120perf_kdebug: INVALID_ARCHS = i386
121
39037602
A
122stackshot_idle_25570396: INVALID_ARCHS = i386
123stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
124
813fb2f6
A
125stackshot_block_owner_14362384: INVALID_ARCHS = i386
126stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
a39ff7e2
A
127ifeq ($(PLATFORM),MacOSX)
128stackshot_block_owner_14362384: OTHER_LDFLAGS += -lpcre
129endif
130
131all: $(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 $@
813fb2f6 137
5ba3f43e 138xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
a39ff7e2 139
813fb2f6
A
140ifeq ($(PLATFORM),iPhoneOS)
141OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
142jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
143jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
144jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
145
146jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
147jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
148 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
149endif
150
5ba3f43e
A
151task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
152
a39ff7e2
A
153proc_info: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
154proc_info: OTHER_LDFLAGS += -ldarwintest_utils
155
5ba3f43e
A
156disk_mount_conditioner: disk_mount_conditioner*
157disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
158disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
159
160OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
161disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
162disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
163disk_mount_conditioner_unentitled: disk_mount_conditioner.c
164 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
165
166work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
167work_interval_test: OTHER_CFLAGS += -DENTITLED=1
168
a39ff7e2
A
169settimeofday_29193041: OTHER_CFLAGS += drop_priv.c
170
5ba3f43e 171settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
a39ff7e2
A
172settimeofday_29193041_entitled: OTHER_CFLAGS += drop_priv.c
173
5ba3f43e
A
174thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
175thread_group_set_32261625: INVALID_ARCHS = i386
176
177task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
178
a39ff7e2
A
179socket_bind_35243417: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
180socket_bind_35685803: CODE_SIGN_ENTITLEMENTS = network_entitlements.plist
181
182ifneq (osx,$(TARGET_NAME))
183EXCLUDED_SOURCES += no32exec_35914211.c no32exec_35914211_helper.c
184endif
185
186no32exec_35914211_helper: INVALID_ARCHS = x86_64
187no32exec_35914211: INVALID_ARCHS = i386
188
39037602 189include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets