VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Makefile.kmk@ 26234

Last change on this file since 26234 was 26224, checked in by vboxsync, 15 years ago

s/IN_RT_GC/IN_RT_RC/g

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.0 KB
Line 
1# $Id: Makefile.kmk 26224 2010-02-03 22:03:01Z vboxsync $
2## @file
3# Sub-Makefile for the VMM testcases.
4#
5
6#
7# Copyright (C) 2006-2007 Sun Microsystems, Inc.
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18# Clara, CA 95054 USA or visit http://www.sun.com if you need
19# additional information or have any questions.
20#
21
22SUB_DEPTH = ../../../..
23include $(KBUILD_PATH)/subheader.kmk
24
25#
26# Target lists.
27#
28PROGRAMS += tstVMStructSize tstAsmStructs tstGlobalConfig tstInstrEmul
29ifdef VBOX_WITH_RAW_MODE
30 PROGRAMS += tstVMStructRC tstAsmStructsRC tstVMM tstVMM-HwAccm
31 ifneq ($(KBUILD_TARGET),win)
32 PROGRAMS += tstVMMFork
33 endif
34endif
35ifdef VBOX_WITH_TESTCASES
36 PROGRAMS += \
37 tstCFGM \
38 tstCompressionBenchmark \
39 tstSSM \
40 tstMMHyperHeap \
41 tstVMREQ \
42 tstCompiler \
43 tstVMMR0CallHost-1 \
44 tstVMMR0CallHost-2
45 ifneq ($(KBUILD_TARGET),l4)
46 PROGRAMS += tstAnimate
47 endif
48 ifdef VBOX_WITH_RAW_MODE
49 PROGRAMS += tstMicro
50 SYSMODS += tstMicroRC
51 endif
52 ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
53 PROGRAMS += tstPDMAsyncCompletion
54 PROGRAMS += tstPDMAsyncCompletionStress
55 endif
56endif # VBOX_WITH_TESTCASES
57
58# Where we put our temporary files (just for simplicity)
59VBOX_VMM_TESTCASE_OUT_DIR := $(PATH_TARGET)/VMM
60BLDDIRS += $(VBOX_VMM_TESTCASE_OUT_DIR)
61
62#
63# We setup two 'other' targets for executing the two structure & alignment
64# validation testcases. Perhaps a bit hackish, but extremely useful.
65#
66ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
67 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),)
68 OTHERS += \
69 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
70 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
71 endif
72endif
73
74# The normal testing pass.
75TESTING += \
76 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
77 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
78 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run
79
80OTHER_CLEAN += \
81 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
82 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
83 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run \
84 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h \
85 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o \
86 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
87 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.o \
88 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.lst \
89 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h.dump \
90 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h \
91 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h \
92 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h
93
94#
95# Globals
96#
97VBOX_PATH_VMM_SRC = $(PATH_ROOT)/src/VBox/VMM
98
99#
100# Targets
101#
102ifdef VBOX_WITH_RAW_MODE
103 tstVMStructRC_TEMPLATE = VBoxRcExe
104 tstVMStructRC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE
105 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
106 tstVMStructRC_DEFS += \
107 VBOX_WITH_2X_4GB_ADDR_SPACE VBOX_WITH_2X_4GB_ADDR_SPACE_IN_RC \
108 VBOX_WITH_HYBRID_32BIT_KERNEL VBOX_WITH_HYBRID_32BIT_KERNEL_IN_RC
109 endif
110 ifdef VBOX_WITH_R0_LOGGING
111 tstVMStructRC_DEFS += VBOX_WITH_R0_LOGGING
112 endif
113 tstVMStructRC_SOURCES = tstVMStructRC.cpp
114 tstVMStructRC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
115endif
116
117tstVMStructSize_TEMPLATE= VBOXR3AUTOTST
118tstVMStructSize_DEFS = IN_VMM_R3 IN_DIS
119ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
120 tstVMStructSize_DEFS += \
121 VBOX_WITH_2X_4GB_ADDR_SPACE VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3 \
122 VBOX_WITH_HYBRID_32BIT_KERNEL VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R3
123endif
124ifdef VBOX_WITH_RAW_MODE
125 tstVMStructSize_DEFS += VBOX_WITH_RAW_MODE
126endif
127tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(VBOX_VMM_TESTCASE_OUT_DIR)
128tstVMStructSize_SOURCES = tstVMStructSize.cpp
129ifdef VBOX_WITH_RAW_MODE
130 tstVMStructSize.cpp_DEPS= $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h
131endif
132ifdef VBOX_WITH_R0_LOGGING
133 tstVMStructSize_DEFS += VBOX_WITH_R0_LOGGING
134endif
135ifdef VBOX_WITH_VMI
136 tstVMStructSize_DEFS += VBOX_WITH_VMI
137 tstVMStructSize_INCS += $(VBOX_PATH_VMM_SRC)/PARAV
138endif
139
140tstAsmStructs_TEMPLATE = VBOXR3AUTOTST
141tstAsmStructs_DEFS = IN_VMM_R3 IN_DIS
142ifdef VBOX_WITH_RAW_MODE
143 tstAsmStructs_DEFS += VBOX_WITH_RAW_MODE
144endif
145ifdef VBOX_WITH_R0_LOGGING
146 tstAsmStructs_DEFS += VBOX_WITH_R0_LOGGING
147endif
148tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
149tstAsmStructs_SOURCES = tstAsmStructs.cpp
150tstAsmStructs.cpp_DEPS = $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
151
152ifdef VBOX_WITH_RAW_MODE
153 tstAsmStructsRC_TEMPLATE= VBoxRcExe
154 tstAsmStructsRC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE
155 ifdef VBOX_WITH_R0_LOGGING
156 tstAsmStructsRC_DEFS += VBOX_WITH_R0_LOGGING
157 endif
158 tstAsmStructsRC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
159 tstAsmStructsRC_SOURCES = tstAsmStructs.cpp
160 tstAsmStructs.cpp_DEPS += $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h
161endif # VBOX_WITH_RAW_MODE
162
163
164tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
165tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
166tstGlobalConfig_LIBS = $(LIB_RUNTIME)
167
168tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
169tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
170tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
171
172tstSSM_TEMPLATE = VBOXR3TSTEXE
173tstSSM_SOURCES = tstSSM.cpp
174tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
175
176tstInstrEmul_TEMPLATE = VBOXR3EXE
177tstInstrEmul_SOURCES = tstInstrEmul.cpp ../VMMAll/EMAllA.asm
178tstInstrEmul_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
179
180tstCFGM_TEMPLATE = VBOXR3TSTEXE
181tstCFGM_SOURCES = tstCFGM.cpp
182tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
183
184tstCompressionBenchmark_TEMPLATE = VBOXR3TSTEXE
185tstCompressionBenchmark_SOURCES = tstCompressionBenchmark.cpp
186
187tstVMMR0CallHost-1_TEMPLATE = VBOXR3TSTEXE
188tstVMMR0CallHost-1_DEFS = VMM_R0_NO_SWITCH_STACK
189tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
190tstVMMR0CallHost-1_SOURCES = \
191 tstVMMR0CallHost-1.cpp
192tstVMMR0CallHost-1_SOURCES.amd64 = \
193 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0JmpA-amd64.asm
194tstVMMR0CallHost-1_SOURCES.x86 = \
195 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0JmpA-x86.asm
196
197tstVMMR0CallHost-2_EXTENDS = tstVMMR0CallHost-1
198tstVMMR0CallHost-2_DEFS = VMM_R0_SWITCH_STACK
199
200tstVMREQ_TEMPLATE = VBOXR3EXE
201tstVMREQ_SOURCES = tstVMREQ.cpp
202tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
203
204tstAnimate_TEMPLATE = VBOXR3EXE
205tstAnimate_SOURCES = tstAnimate.cpp
206tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
207
208tstCompiler_TEMPLATE = VBOXR3TSTEXE
209tstCompiler_SOURCES = tstCompiler.cpp
210tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
211
212ifdef VBOX_WITH_RAW_MODE
213
214 tstVMM_TEMPLATE = VBOXR3EXE
215 tstVMM_SOURCES = tstVMM.cpp
216 tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
217
218 tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
219 tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
220 tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
221
222 tstVMMFork_TEMPLATE = VBOXR3EXE
223 tstVMMFork_SOURCES = tstVMMFork.cpp
224 tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
225
226 tstMicro_TEMPLATE = VBOXR3EXE
227 tstMicro_SOURCES = tstMicro.cpp
228 tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
229
230 tstMicroRC_TEMPLATE = VBoxRc
231 tstMicroRC_SOURCES = tstMicroRC.cpp tstMicroRCA.asm
232 tstMicroRC_DEFS =
233 tstMicroRC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
234 ifeq ($(VBOX_LDR_FMT32),pe)
235 tstMicroRC_LDFLAGS = -Entry:tstMicroRC
236 endif
237 tstMicroRC_SYSSUFF = .gc
238 tstMicroRC_LIBS = \
239 $(PATH_LIB)/DisasmRC$(VBOX_SUFF_LIB) \
240 $(PATH_LIB)/RuntimeRC$(VBOX_SUFF_LIB)
241 ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
242 tstMicroRC_LIBS += \
243 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
244 $(LIB_VMMGC)
245 endif
246 tstMicroRC_SOURCES.win = tstMicroRC.def
247
248endif # VBOX_WITH_RAW_MODE
249
250ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
251 tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
252 tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
253 tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
254
255 tstPDMAsyncCompletionStress_TEMPLATE = VBOXR3EXE
256 tstPDMAsyncCompletionStress_SOURCES = tstPDMAsyncCompletionStress.cpp
257 tstPDMAsyncCompletionStress_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
258endif
259
260include $(KBUILD_PATH)/subfooter.kmk
261
262
263#
264# Run rule for tstInstrEmul.
265#
266$(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run: $$(INSTARGET_tstInstrEmul) | $$(dir $$@)
267 $(QUIET)$(RM) -f $@
268 $(QUIET)$(REDIRECT) -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
269 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
270 -- \
271 $(INSTARGET_tstInstrEmul)
272 $(QUIET)$(APPEND) "$@" "done"
273
274
275#
276# Some handcrafted support targets for tstAsmStructs.
277#
278
279ifeq ($(KBUILD_HOST),win)
280 ifndef TOOL_MINGW32
281 include $(KBUILD_PATH)/tools/MINGW32.kmk
282 endif
283 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
284else
285 VBOX_NM ?= nm -p
286endif
287
288MY_ASA_ASM_STUFF = \
289 $(addprefix -D, \
290 $(DEFS) \
291 $(DEFS.$(KBUILD_TYPE)) \
292 $(DEFS.$(KBUILD_TARGET)) \
293 IN_RING3 $(ARCH_BITS_DEFS) \
294 $(DEFS.$(KBUILD_TARGET_ARCH)) \
295 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
296 ) \
297 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
298 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(VBOX_VMM_TESTCASE_OUT_DIR),-I$(inc)/)
299
300# 1a. make a header file which makes all the structures+members globals.
301$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac: \
302 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
303 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
304 $(DEPTH)/include/iprt/asmdefs.mac \
305 $(DEPTH)/include/VBox/cpum.mac \
306 $(DEPTH)/include/VBox/sup.mac \
307 $(DEPTH)/include/VBox/vm.mac \
308 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
309 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
310 $(VBOX_PATH_VMM_SRC)/HWACCMInternal.mac \
311 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
312 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
313 $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG) \
314 | $$(dir $$@)
315 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
316ifndef DONT_USE_YASM
317 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
318 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ $@.lst
319else
320 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
321 $(VBOX_NM) $@.o | $(SED) \
322 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
323 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
324 > $@
325endif
326
327# 1b. make an elf/macho object containing the offsets.
328$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o: \
329 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
330 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
331 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
332 | $$(dir $$@)
333 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
334ifndef DONT_USE_YASM
335 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
336else
337 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
338endif
339
340# 2. use nm and sed to transform this into the header we want.
341$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o
342 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
343 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
344 $(QUIET)$(REDIRECT) -wo $@.dump -- $(VBOX_NM) $<
345 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
346 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
347 --output $@.tmp $@.dump
348 $(QUIET)$(SED) -e '/VM_size$$/d' -e '/VMCPU_size$$/d' \
349 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
350 --append $@.tmp $@.dump
351 $(QUIET)$(MV) -f $@.tmp $@
352 $(QUIET)$(RM) -f $@.dump
353
354ifdef VBOX_WITH_RAW_MODE
355# 3. transform the HC header into a RC one by omitting some HC only structures.
356$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
357 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
358 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
359endif
360
361# 4. run it.
362$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run: \
363 $$(INSTARGET_tstAsmStructs) \
364 $(if-expr defined(VBOX_WITH_RAW_MODE),$$(INSTARGET_tstAsmStructsRC),)
365 $(QUIET)$(RM) -f $@
366 $(INSTARGET_tstAsmStructs)
367ifdef VBOX_WITH_RAW_MODE
368 $(INSTARGET_tstAsmStructsRC)
369endif
370 $(QUIET)$(APPEND) "$@" "done"
371
372
373
374#
375# Run rule for tstVMStructSize.
376#
377
378ifdef VBOX_WITH_RAW_MODE
379# 1. Manually dump selected structures and members.
380$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h: $$(INSTARGET_tstVMStructRC) | $$(dir $$@)
381 $(call MSG_GENERATE,tstVMStructSize,$@)
382 $(QUIET)$(REDIRECT) -wo $@ -- $<
383endif # VBOX_WITH_RAW_MODE
384
385# 2. run it.
386$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize) | $$(dir $$@)
387 $(QUIET)$(RM) -f $@
388 $<
389 $(QUIET)$(APPEND) "$@" "done"
390
391# alias for the two struct tests.
392run-struct-tests: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
393
394
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette