VirtualBox

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

Last change on this file since 16524 was 16350, checked in by vboxsync, 16 years ago

tstInstrEmul: Moved it up to the root dir, it's causing too much trouble trying to execute it from testcases.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.9 KB
Line 
1# $Id: Makefile.kmk 16350 2009-01-28 22:19:45Z 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 tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm tstGlobalConfig tstInstrEmul
29ifneq ($(KBUILD_TARGET),win)
30PROGRAMS += tstVMMFork
31endif
32ifdef VBOX_WITH_TESTCASES
33 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
34 ifneq ($(KBUILD_TARGET),l4)
35 PROGRAMS += tstAnimate
36 endif
37 SYSMODS += tstMicroGC
38endif # VBOX_WITH_TESTCASES
39
40ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
41 PROGRAMS += tstPDMAsyncCompletion
42endif
43
44# Where we put our temporary files (just for simplicity)
45VBOX_VMM_TESTCASE_OUT_DIR := $(PATH_TARGET)/VMM
46BLDDIRS += $(VBOX_VMM_TESTCASE_OUT_DIR)
47
48#
49# We setup two 'other' targets for executing the two structure & alignment
50# validation testcases. Perhaps a bit hackish, but extremely useful.
51#
52ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
53 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),)
54 OTHERS += \
55 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
56 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
57 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run
58 endif
59endif
60
61# The normal testing pass.
62TESTING += \
63 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
64 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
65 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run
66
67OTHER_CLEAN += \
68 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
69 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
70 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run \
71 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h \
72 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o \
73 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
74 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.o \
75 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.lst \
76 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h.dump \
77 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsGC.h \
78 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h \
79 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h
80
81#
82# Globals
83#
84VBOX_PATH_VMM_SRC = $(PATH_ROOT)/src/VBox/VMM
85
86#
87# Targets
88#
89tstVMStructGC_TEMPLATE = VBOXGCEXE
90tstVMStructGC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC IN_RT_GC
91ifdef VBOX_WITH_R0_LOGGING
92tstVMStructGC_DEFS += VBOX_WITH_R0_LOGGING
93endif
94ifdef VBOX_WITH_NEW_RECOMPILER
95tstVMStructGC_DEFS += VBOX_WITH_NEW_RECOMPILER
96endif
97tstVMStructGC_SOURCES = tstVMStructGC.cpp
98tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
99
100tstVMStructSize_TEMPLATE= VBOXR3AUTOTST
101tstVMStructSize_DEFS = IN_VMM_R3 IN_DIS
102tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(VBOX_VMM_TESTCASE_OUT_DIR)
103tstVMStructSize_SOURCES = tstVMStructSize.cpp
104tstVMStructSize.cpp_DEPS= $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h
105ifdef VBOX_WITH_R0_LOGGING
106tstVMStructSize_DEFS += VBOX_WITH_R0_LOGGING
107endif
108ifdef VBOX_WITH_NEW_RECOMPILER
109tstVMStructSize_DEFS += VBOX_WITH_NEW_RECOMPILER
110endif
111ifdef VBOX_WITH_VMI
112tstVMStructSize_DEFS += VBOX_WITH_VMI
113tstVMStructSize_INCS += $(VBOX_PATH_VMM_SRC)/PARAV
114endif
115
116tstAsmStructs_TEMPLATE = VBOXR3AUTOTST
117tstAsmStructs_DEFS = IN_VMM_R3 IN_DIS
118ifdef VBOX_WITH_R0_LOGGING
119tstAsmStructs_DEFS += VBOX_WITH_R0_LOGGING
120endif
121ifdef VBOX_WITH_NEW_RECOMPILER
122tstAsmStruct_DEFS += VBOX_WITH_NEW_RECOMPILER
123endif
124tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
125tstAsmStructs_SOURCES = tstAsmStructs.cpp
126
127tstAsmStructsGC_TEMPLATE= VBOXGCEXE
128tstAsmStructsGC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC IN_RT_GC
129ifdef VBOX_WITH_R0_LOGGING
130tstAsmStructsGC_DEFS += VBOX_WITH_R0_LOGGING
131endif
132ifdef VBOX_WITH_NEW_RECOMPILER
133tstAsmStructGC_DEFS += VBOX_WITH_NEW_RECOMPILER
134endif
135tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
136tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
137
138tstAsmStructs.cpp_DEPS = $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsGC.h
139
140
141tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
142tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
143tstGlobalConfig_LIBS = $(LIB_RUNTIME)
144
145tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
146tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
147tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
148
149tstSSM_TEMPLATE = VBOXR3TSTEXE
150tstSSM_SOURCES = tstSSM.cpp
151tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
152
153tstInstrEmul_TEMPLATE = VBOXR3EXE
154tstInstrEmul_SOURCES = tstInstrEmul.cpp ../VMMAll/EMAllA.asm
155tstInstrEmul_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
156
157tstCFGM_TEMPLATE = VBOXR3TSTEXE
158tstCFGM_SOURCES = tstCFGM.cpp
159tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
160
161tstVMM_TEMPLATE = VBOXR3EXE
162tstVMM_SOURCES = tstVMM.cpp
163tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
164
165tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
166tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
167tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
168
169tstVMMFork_TEMPLATE = VBOXR3EXE
170tstVMMFork_SOURCES = tstVMMFork.cpp
171tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
172
173tstVMM-2_TEMPLATE = VBOXR3EXE
174tstVMM-2_SOURCES = tstVMM-2.cpp
175tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
176
177tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
178tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
179tstVMMR0CallHost-1_SOURCES = \
180 tstVMMR0CallHost-1.cpp \
181 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
182tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
183
184tstVMREQ_TEMPLATE = VBOXR3EXE
185tstVMREQ_SOURCES = tstVMREQ.cpp
186tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
187
188tstAnimate_TEMPLATE = VBOXR3EXE
189tstAnimate_SOURCES = tstAnimate.cpp
190tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
191
192tstCompiler_TEMPLATE = VBOXR3TSTEXE
193tstCompiler_SOURCES = tstCompiler.cpp
194tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
195
196tstMicro_TEMPLATE = VBOXR3EXE
197tstMicro_SOURCES = tstMicro.cpp
198tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
199
200# tstMicroGC.gc
201tstMicroGC_TEMPLATE = VBOXGC
202tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
203tstMicroGC_DEFS =
204tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
205ifeq ($(VBOX_LDR_FMT32),pe)
206tstMicroGC_LDFLAGS = -Entry:tstMicroGC
207endif
208tstMicroGC_SYSSUFF = .gc
209tstMicroGC_LIBS = \
210 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
211 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
212ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
213tstMicroGC_LIBS += \
214 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
215 $(LIB_VMMGC)
216endif
217tstMicroGC_SOURCES.win = tstMicroGC.def
218
219ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
220tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
221tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
222tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
223endif
224
225include $(KBUILD_PATH)/subfooter.kmk
226
227
228
229#
230# Some handcrafted support targets for tstAsmStructs.
231#
232
233ifeq ($(KBUILD_HOST),win)
234 ifndef TOOL_MINGW32
235 include $(KBUILD_PATH)/tools/MINGW32.kmk
236 endif
237 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
238else
239 VBOX_NM ?= nm -p
240endif
241
242MY_ASA_ASM_STUFF = \
243 $(addprefix -D, \
244 $(DEFS) \
245 $(DEFS.$(KBUILD_TYPE)) \
246 $(DEFS.$(KBUILD_TARGET)) \
247 IN_RING3 $(ARCH_BITS_DEFS) \
248 $(DEFS.$(KBUILD_TARGET_ARCH)) \
249 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
250 ) \
251 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
252 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(VBOX_VMM_TESTCASE_OUT_DIR),-I$(inc)/)
253
254# 1a. make a header file which makes all the structures+members globals.
255$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac: \
256 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
257 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
258 $(DEPTH)/include/iprt/asmdefs.mac \
259 $(DEPTH)/include/VBox/cpum.mac \
260 $(DEPTH)/include/VBox/sup.mac \
261 $(DEPTH)/include/VBox/vm.mac \
262 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
263 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
264 $(VBOX_PATH_VMM_SRC)/HWACCMInternal.mac \
265 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
266 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
267 $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG) \
268 | $$(dir $$@)
269 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
270ifndef DONT_USE_YASM
271 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
272 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ [email protected]
273else
274 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
275 $(VBOX_NM) [email protected] | $(SED) \
276 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
277 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
278 > $@
279endif
280
281# 1b. make an elf/macho object containing the offsets.
282$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o: \
283 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
284 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
285 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
286 | $$(dir $$@)
287 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
288ifndef DONT_USE_YASM
289 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
290else
291 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
292endif
293
294# 2. use nm and sed to transform this into the header we want.
295$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o
296 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
297 $(QUIET)$(RM) -f $@ [email protected] [email protected]
298 $(QUIET)$(REDIRECT) -wo [email protected] -- $(VBOX_NM) $<
299 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
300 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
301 --output [email protected] [email protected]
302 $(QUIET)$(SED) -e '/VM_size$$/d' -e '/VMCPU_size$$/d' \
303 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
304 --append [email protected] [email protected]
305 $(QUIET)$(MV) -f [email protected] $@
306 $(QUIET)$(RM) -f [email protected]
307
308# 3. transform the HC header into a GC one by omitting some HC only structures.
309$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsGC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
310 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
311 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
312
313## @todo make this default kBuild behaviour.
314.SECONDEXPANSION:
315
316# 4. run it.
317$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run: $$(INSTARGET_tstAsmStructs) $$(INSTARGET_tstAsmStructsGC)
318 $(QUIET)$(RM) -f $@
319 $(INSTARGET_tstAsmStructs)
320 $(INSTARGET_tstAsmStructsGC)
321 $(QUIET)$(APPEND) "$@" "done"
322
323
324
325#
326# Run rule for tstVMStructSize.
327#
328
329# 1. Manually dump selected structures and members.
330$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC) | $$(dir $$@)
331 $(call MSG_GENERATE,tstVMStructSize,$@)
332 $(QUIET)$(REDIRECT) -wo $@ -- $<
333
334# 2. run it.
335$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize) | $$(dir $$@)
336 $(QUIET)$(RM) -f $@
337 $<
338 $(QUIET)$(APPEND) "$@" "done"
339
340# alias for the two struct tests.
341run-struct-tests: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
342
343
344#
345# Run rule for tstInstrEmul.
346#
347$(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run: $$(INSTARGET_tstInstrEmul) | $$(dir $$@)
348 $(QUIET)$(RM) -f $@
349 $(QUIET)$(REDIRECT) -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
350 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
351 -- \
352 $(INSTARGET_tstInstrEmul)
353 $(QUIET)$(APPEND) "$@" "done"
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