]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/darwintests/Makefile
a6f4012ab5b5aa36f3bb99a1470b2f9ca13d451c
[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 avx: INVALID_ARCHS = i386
38 avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
39 avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
40 avx: CONFIG_FLAGS := $(filter-out -O%,$(CONFIG_FLAGS))
41 # Level 2 optimization must be used to prevent compiler from generating
42 # invalid instructions when compiling with AVX-512 flags.
43 avx: CONFIG_FLAGS += -O2
44 ifneq (osx,$(TARGET_NAME))
45 EXCLUDED_SOURCES += avx.c
46 endif
47
48 backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
49
50 data_protection: OTHER_LDFLAGS += -framework IOKit
51
52 kdebug: INVALID_ARCHS = i386
53 kdebug: OTHER_LDFLAGS = -framework ktrace
54
55 EXCLUDED_SOURCES += kperf_helpers.c xnu_quick_test_helpers.c
56
57 ifeq ($(PLATFORM),iPhoneOS)
58 CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
59 else
60 CONFIG_FREEZE_DEFINE:=
61 EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
62 endif
63
64 perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
65 perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
66
67 stackshot: OTHER_LDFLAGS += -lkdd -framework Foundation
68 stackshot: INVALID_ARCHS = i386
69
70 memorystatus_zone_test: INVALID_ARCHS = i386
71 memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
72 memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
73 memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
74
75 kpc: OTHER_LDFLAGS += -framework kperf
76
77 kperf: INVALID_ARCHS = i386
78 kperf: OTHER_CFLAGS += kperf_helpers.c
79 kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
80
81 kperf_backtracing: INVALID_ARCHS = i386
82 kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
83 kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
84 kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
85
86 kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
87 kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
88
89 mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
90
91 monotonic_core: OTHER_LDFLAGS += -framework ktrace
92 monotonic_core: INVALID_ARCHS = i386
93
94 perf_exit: OTHER_LDFLAGS = -framework ktrace
95 perf_exit: INVALID_ARCHS = i386
96 perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
97
98 perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
99
100 os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
101 os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
102
103 task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
104 task_inspect: OTHER_CFLAGS += -DENTITLED=1
105
106 CUSTOM_TARGETS += perf_exit_proc
107
108 perf_exit_proc:
109 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
110
111 install-perf_exit_proc: perf_exit_proc
112 mkdir -p $(INSTALLDIR)
113 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
114
115 perf_kdebug: INVALID_ARCHS = i386
116
117 stackshot_idle_25570396: INVALID_ARCHS = i386
118 stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
119
120 stackshot_block_owner_14362384: INVALID_ARCHS = i386
121 stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
122
123 xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
124
125 ifeq ($(PLATFORM),iPhoneOS)
126 OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
127 jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
128 jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
129 jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
130
131 jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
132 jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
133 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
134 endif
135
136 task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
137
138 disk_mount_conditioner: disk_mount_conditioner*
139 disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
140 disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
141
142 OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
143 disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
144 disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
145 disk_mount_conditioner_unentitled: disk_mount_conditioner.c
146 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
147
148 work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
149 work_interval_test: OTHER_CFLAGS += -DENTITLED=1
150
151 settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
152 thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
153 thread_group_set_32261625: INVALID_ARCHS = i386
154
155 task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
156
157 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets