]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | #!/usr/bin/make |
2 | # This file lists all individual tests added over time to test various functionality. | |
3 | # The Raft TestBot framework runs the tests based on the targets listed in this file. | |
4 | # Please review the following guidelines to ensure successful execution of your test case | |
5 | # | |
6 | # == Steps followed by Raft testbot == | |
7 | # * find target name from this Makefile. A target is identified by the string <targetname>: related files | |
8 | # * build the target with the command "make <targetname>". The current dir is same as of this Makefile | |
9 | # * The test is executed with following commands "cd BUILD/dst/; ./<targetname> " | |
10 | # * The exit value of <targetname> is logged. (0 = PASS and <any integer> = FAIL) | |
11 | # * remove the BUILD directory | |
12 | # | |
13 | # == Note about SDKROOT == | |
14 | # The environment variable SDKROOT must be passed to select the appropriate SDK. | |
15 | # x86/OSX is the default, so to build for iphone, you must: | |
16 | # | |
17 | # 64-bit: $make SDKROOT=iphoneos.internal <targetname> | |
18 | # 32-bit: $make SDKROOT=iphoneos.internal ARCH_CONFIGS="armv7" <targetname> | |
19 | # | |
20 | # == How to add a new test == | |
21 | # * Create a test directory based on radar #. (for example test_<number>) | |
22 | # * Put test specific files in the directory. | |
23 | # * Add an entry in this Makefile (reserved targetnames are {run_tests.sh, xnu_target_executables.list, build_*.log}) | |
24 | # targetname: testdir/programname.c | |
25 | # <provide your compile command with output in $(BUILDDIR)> | |
26 | # | |
27 | # * Check if your target name is listed in the right configurations. | |
28 | # $make list_targets | |
29 | # optionally you can pass SDKROOT=iphoneos|iphoneos.internal|macosx|macosx.internal and verify | |
30 | # the built binary is of right arch and config. | |
31 | # | |
32 | # * verify that your test setup works by running the following commands | |
33 | # $make <targetname> | |
34 | # $cd BUILD/dst/ | |
35 | # $./targetname | |
36 | # | |
37 | # == Easy Option == | |
38 | # look at some example targets in this file and replicate that :) | |
39 | # | |
40 | ||
41 | ifneq ($(SRCROOT),) | |
42 | SRCDIR=$(SRCROOT) | |
43 | else | |
44 | SRCDIR?=$(shell /bin/pwd) | |
45 | endif | |
46 | ||
47 | ifneq ($(DSTROOT),) | |
48 | BUILDDIR?=$(DSTROOT) | |
49 | else | |
50 | BUILDDIR?=$(SRCDIR)/BUILD/dst | |
51 | endif | |
52 | ||
53 | # make sure we have a build directory | |
54 | $(shell [ -d "$(BUILDDIR)" ] || mkdir -p $(BUILDDIR)) | |
55 | ||
56 | SDKROOT ?= / | |
57 | TARGETSDK:=$(SDKROOT) | |
58 | ||
59 | ||
60 | # setup the TARGETSDK and SDKROOT variables | |
61 | ifeq (/,$(SDKROOT)) | |
62 | SDKROOTPATH=/ | |
63 | else | |
64 | SDKROOTPATH:=$(shell /usr/bin/xcodebuild -sdk $(TARGETSDK) -version Path) | |
65 | endif | |
66 | ||
67 | ifeq ($(SDKROOTPATH),) | |
68 | $(error "Unable to find any SDKROOT on host. Exiting") | |
69 | endif | |
70 | ||
71 | PRIVATE_INCLUDES = $(SDKROOTPATH)/System/Library/Frameworks/System.framework/PrivateHeaders | |
72 | ||
73 | #arch configs if not provided | |
74 | ifdef RC_ARCHS | |
75 | ARCH_CONFIGS:=$(RC_ARCHS) | |
76 | endif | |
77 | ifeq ($(ARCH_CONFIGS),) | |
78 | ARCH_CONFIGS:= | |
79 | ifeq (iPhone,$(findstring iPhone,$(SDKROOTPATH))) | |
80 | ARCH_CONFIGS:=-arch armv7 | |
81 | endif | |
82 | ||
83 | else | |
84 | TMP_ARCHCONF:=$(foreach argarch,$(ARCH_CONFIGS),-arch $(argarch) ) | |
85 | override ARCH_CONFIGS:=$(TMP_ARCHCONF) | |
86 | endif | |
87 | ||
88 | ||
89 | #setup the compiler flags. | |
90 | ifeq (iPhone,$(findstring iPhone,$(SDKROOTPATH))) | |
91 | CFLAGS=-I$(BUILDDIR) -I. -isysroot $(SDKROOTPATH) $(ARCH_CONFIGS) | |
92 | CC=xcrun -sdk $(TARGETSDK) clang | |
93 | MIG=xcrun -sdk $(TARGETSDK) mig | |
94 | XCODEBUILD=xcodebuild -sdk iphoneos.internal $(ARCH_CONFIGS) | |
95 | CODESIGN=$(shell xcrun -sdk $(TARGETSDK) -find codesign) | |
96 | CODESIGN_ALLOCATE=$(shell xcrun -sdk $(TARGETSDK) -find codesign_allocate) | |
97 | TARGET_NAME=ios | |
98 | else | |
99 | #Compiler flags for macosx | |
100 | CFLAGS=-I$(BUILDDIR) -I. $(ARCH_CONFIGS) | |
101 | CC=clang | |
102 | MIG=xcrun mig | |
103 | XCODEBUILD=xcodebuild | |
104 | CODESIGN=codesign | |
105 | CODESIGN_ALLOCATE=$(shell xcrun -find codesign_allocate) | |
106 | TARGET_NAME=osx | |
107 | endif | |
108 | ||
109 | #Flags that define the environment | |
110 | TARGETOSVERS:=$(shell /usr/bin/xcodebuild -sdk $(TARGETSDK) -version ProductVersion) | |
111 | TARGETOSBUILDVERS:=$(shell /usr/bin/xcodebuild -sdk $(TARGETSDK) -version ProductBuildVersion) | |
112 | SDKTARGET_STR:=$(subst .,_,$(TARGETSDK)) | |
113 | MORECFLAGS=-D TARGET_SDK_$(SDKTARGET_STR)=1 -D TARGET_OS_VERS=\"$(TARGETOSVERS)\" -D TARGET_OS_BUILD_VERS=\"$(TARGETOSBUILDVERS)\" | |
114 | ||
115 | #special recipe for special targets: list_targets and clean | |
116 | define _sed_target_extract_script | |
117 | /^$$/ { n | |
118 | /^[^ ]*:/p | |
119 | } | |
120 | endef | |
121 | export sed_target_extract_script=$(_sed_target_extract_script) | |
122 | all: | |
123 | @ for TARGET in `make list_targets`; do \ | |
124 | if [ $$TARGET != all ]; then \ | |
125 | make $$TARGET DSTROOT="$(BUILDDIR)/$$TARGET"; \ | |
126 | fi \ | |
127 | done | |
128 | list_targets: | |
129 | @ make -rpn | sed -n -e "$$sed_target_extract_script" | cut -d':' -f1 | grep -v '^clean' | grep -v '^list_targets' | |
130 | ||
131 | clean: | |
132 | rm -fr ./BUILD/ | |
133 | # == List of targets for test cases == | |
134 | #Note: target name should be same as the executable in $(BUILDDIR) | |
135 | #And: target name has to be seperate from source directory name. Using "_src" suffix is a good idea. | |
136 | sampletest: sampletest.c | |
137 | $(CC) -o $(BUILDDIR)/$@ $^ $(CFLAGS) $(MORECFLAGS) | |
138 | ||
139 | pipe_test_10807398: pipe_test_10807398_src/parent.c pipe_test_10807398_src/child.c | |
140 | $(CC) -o $(BUILDDIR)/$@ pipe_test_10807398_src/parent.c $(CFLAGS) | |
141 | $(CC) -o $(BUILDDIR)/child pipe_test_10807398_src/child.c $(CFLAGS) | |
142 | ||
143 | pipes_fill_procinfo_11179336: pipes_fill_procinfo_11179336.c | |
144 | $(CC) -o $(BUILDDIR)/$@ pipes_fill_procinfo_11179336.c $(CFLAGS) | |
145 | ||
146 | test_wq_exit_race_panic_10970548: test_wq_exit_race_panic_10970548.c | |
147 | $(CC) -o $(BUILDDIR)/$@ test_wq_exit_race_panic_10970548.c $(CFLAGS) | |
148 | ||
149 | ptrace_tests_10767133: ptrace_tests_10767133_src/ptrace_tests_10767133.c | |
150 | $(CC) -O0 -o $(BUILDDIR)/ptrace_tests_10767133 ptrace_tests_10767133_src/ptrace_tests_10767133.c $(CFLAGS) -Wall | |
151 | ||
152 | ptrace_test_12507045: ptrace_test_12507045_src/ptrace_test.c | |
153 | $(CC) -O0 -o $(BUILDDIR)/ptrace_test_12507045 $< $(CFLAGS) | |
154 | ||
155 | clock_types_6368156: clock_types_6368156.c | |
156 | $(CC) -o $(BUILDDIR)/$@ $^ $(CFLAGS) | |
157 | ||
158 | semctl_test_8534495: semctl_test_8534495_src/semctl_test_8534495.c | |
159 | $(CC) -o $(BUILDDIR)/semctl_test_8534495 semctl_test_8534495_src/semctl_test_8534495.c $(CFLAGS) | |
160 | ||
161 | ptcwd_test_11269991: ptcwd_test_11269991_src/ptcwd_test_11269991.c | |
162 | $(CC) -o $(BUILDDIR)/ptcwd_test_11269991 ptcwd_test_11269991_src/ptcwd_test_11269991.c $(CFLAGS) | |
163 | ||
164 | sprace_test_11891562: sprace_test_11891562_src/sprace_test_11891562.c | |
165 | $(CC) -o $(BUILDDIR)/sprace_test_11891562 sprace_test_11891562_src/sprace_test_11891562.c $(CFLAGS) | |
166 | ||
167 | guarded_fd_tests_11746236: guarded_fd_tests_11746236_src/mach_exc.defs guarded_fd_tests_11746236_src/guarded_test_framework.c guarded_fd_tests_11746236_src/guarded_test.c | |
168 | $(MIG) $(CFLAGS) \ | |
169 | -user $(BUILDDIR)/mach_excUser.c \ | |
170 | -server $(BUILDDIR)/mach_excServer.c \ | |
171 | -header $(BUILDDIR)/mach_exc.h \ | |
172 | guarded_fd_tests_11746236_src/mach_exc.defs | |
173 | $(CC) -o $(BUILDDIR)/guarded_fd_tests_11746236 \ | |
174 | guarded_fd_tests_11746236_src/guarded_test_framework.c \ | |
175 | $(BUILDDIR)/mach_excServer.c $(CFLAGS) -I$(PRIVATE_INCLUDES) -I$(BUILDDIR) | |
176 | $(CC) -o $(BUILDDIR)/guarded_test \ | |
177 | guarded_fd_tests_11746236_src/guarded_test.c \ | |
178 | -I$(PRIVATE_INCLUDES) $(CFLAGS) | |
179 | ||
180 | thread_get_state_11918811: thread_get_state_11918811_src/thread_get_state.c | |
181 | $(MIG) $(CFLAGS) \ | |
182 | -sheader $(BUILDDIR)/excserver.h \ | |
183 | -server $(BUILDDIR)/excserver.c \ | |
184 | -header /dev/null -user /dev/null \ | |
185 | thread_get_state_11918811_src/excserver.defs | |
186 | $(CC) -o $(BUILDDIR)/thread_get_state_11918811 \ | |
187 | thread_get_state_11918811_src/thread_get_state.c \ | |
188 | $(BUILDDIR)/excserver.c \ | |
189 | $(CFLAGS) | |
190 | ||
191 | fcntlrangecheck_tests_11202484: fcntlrangecheck_tests_11202484_src/fcntlrangecheck_tests_11202484.c | |
192 | $(CC) -o $(BUILDDIR)/fcntlrangecheck_tests_11202484 fcntlrangecheck_tests_11202484_src/fcntlrangecheck_tests_11202484.c $(CFLAGS) | |
193 | ||
194 | test_waitqlocktry_12053360: test_waitqlocktry_12053360.c | |
195 | $(CC) -o $(BUILDDIR)/test_waitqlocktry_12053360 test_waitqlocktry_12053360.c $(CFLAGS) | |
196 | ||
197 | guarded_mach_port_tests_11178535: guarded_mach_port_tests_11178535_src/mach_exc.defs guarded_mach_port_tests_11178535_src/guarded_test_framework.c guarded_mach_port_tests_11178535_src/guarded_test.c | |
198 | $(MIG) $(CFLAGS) \ | |
199 | -user $(BUILDDIR)/mach_excUser.c \ | |
200 | -server $(BUILDDIR)/mach_excServer.c \ | |
201 | -header $(BUILDDIR)/mach_exc.h \ | |
202 | guarded_mach_port_tests_11178535_src/mach_exc.defs | |
203 | $(CC) -o $(BUILDDIR)/guarded_mach_port_tests_11178535 \ | |
204 | guarded_mach_port_tests_11178535_src/guarded_test_framework.c \ | |
205 | $(BUILDDIR)/mach_excServer.c $(CFLAGS) -I$(PRIVATE_INCLUDES) -I$(BUILDDIR) | |
206 | $(CC) -o $(BUILDDIR)/guarded_mp_test \ | |
207 | guarded_mach_port_tests_11178535_src/guarded_test.c \ | |
208 | -I$(PRIVATE_INCLUDES) $(CFLAGS) | |
209 | ||
210 | cpu_monitor_tests_11646922: cpu_monitor_tests_11646922_src/cpumon_test_framework.c | |
211 | $(MIG) $(CFLAGS) \ | |
212 | -sheader $(BUILDDIR)/excserver.h \ | |
213 | -server $(BUILDDIR)/excserver.c \ | |
214 | -header /dev/null -user /dev/null \ | |
215 | cpu_monitor_tests_11646922_src/mach_exc.defs | |
216 | $(CC) -o $(BUILDDIR)/cpu_monitor_tests_11646922 \ | |
217 | cpu_monitor_tests_11646922_src/cpumon_test_framework.c \ | |
218 | $(BUILDDIR)/excserver.c \ | |
219 | $(CFLAGS) $(MORECFLAGS) -I$(PRIVATE_INCLUDES) | |
220 | $(XCODEBUILD) -project cpu_monitor_tests_11646922_src/cpu_hog/cpu_hog.xcodeproj TARGET_BUILD_DIR=$(BUILDDIR) | |
221 | $(CC) -o $(BUILDDIR)/mem_hog \ | |
222 | cpu_monitor_tests_11646922_src/mem_hog/mem_hog.c \ | |
223 | $(CFLAGS) $(MORECFLAGS) -I$(PRIVATE_INCLUDES) | |
224 | ||
225 | monitor_stress_12901965: monitor_stress_12901965_src/monitor_stress/monitor_stress.m | |
226 | echo '#!/bin/sh\n./monitor_stress -e 20\n./monitor_stress -w 3 -e 20' > $(BUILDDIR)/monitor_stress_12901965 | |
227 | chmod +x $(BUILDDIR)/monitor_stress_12901965 | |
228 | $(XCODEBUILD) -target $(TARGET_NAME) -project monitor_stress_12901965_src/monitor_stress.xcodeproj TARGET_BUILD_DIR=$(BUILDDIR) | |
229 | ||
230 | codesigntests: codesigntests.c codesigntests-entitlements.plist | |
231 | $(CC) -o $(BUILDDIR)/codesigntests codesigntests.c $(CFLAGS) | |
232 | env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) \ | |
233 | $(CODESIGN) -s - --entitlements codesigntests-entitlements.plist $(BUILDDIR)/codesigntests | |
234 | ||
235 | libproc_privilege_test_13203438: libproc_privilege_test_13203438_src/libproc_privilege_test_13203438.c | |
236 | $(CC) -o $(BUILDDIR)/libproc_privilege_test_13203438 libproc_privilege_test_13203438_src/libproc_privilege_test_13203438.c $(CFLAGS) | |
237 |