VirtualBox

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

Last change on this file since 12559 was 12444, checked in by vboxsync, 16 years ago

VMM/testcase/Makefile.kmk: Don't include MINGW32 if it has already been included. (triggers a bug).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1# $Id: Makefile.kmk 12444 2008-09-14 22:20:24Z 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
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 endif
58endif
59
60# The normal testing pass.
61TESTING += \
62 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
63 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
64
65OTHER_CLEAN += \
66 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
67 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
68 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h \
69 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o \
70 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
71 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.o \
72 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.lst \
73 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h.dump \
74 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsGC.h \
75 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h \
76 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h
77
78#
79# Globals
80#
81VBOX_PATH_VMM_SRC = $(PATH_ROOT)/src/VBox/VMM
82
83#
84# Targets
85#
86tstVMStructGC_TEMPLATE = VBOXGCEXE
87tstVMStructGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_REM_GC IN_RRM_GC
88ifdef VBOX_WITH_IDT_PATCHING
89tstVMStructGC_DEFS += VBOX_WITH_IDT_PATCHING
90endif
91tstVMStructGC_SOURCES = tstVMStructGC.cpp
92tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
93
94tstVMStructSize_TEMPLATE= VBOXR3AUTOTST
95tstVMStructSize_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3 IN_REM_R3
96ifdef VBOX_WITH_IDT_PATCHING
97tstVMStructSize_DEFS += VBOX_WITH_IDT_PATCHING
98endif
99tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(VBOX_VMM_TESTCASE_OUT_DIR)
100tstVMStructSize_SOURCES = tstVMStructSize.cpp
101tstVMStructSize.cpp_DEPS= $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h
102
103tstAsmStructs_TEMPLATE = VBOXR3AUTOTST
104tstAsmStructs_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3
105ifdef VBOX_WITH_IDT_PATCHING
106tstAsmStructs_DEFS += VBOX_WITH_IDT_PATCHING
107endif
108tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
109tstAsmStructs_SOURCES = tstAsmStructs.cpp
110
111tstAsmStructsGC_TEMPLATE= VBOXGCEXE
112tstAsmStructsGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_RRM_GC
113ifdef VBOX_WITH_IDT_PATCHING
114tstAsmStructsGC_DEFS += VBOX_WITH_IDT_PATCHING
115endif
116tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
117tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
118
119tstAsmStructs.cpp_DEPS = $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsGC.h
120
121
122tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
123tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
124tstGlobalConfig_LIBS = $(LIB_RUNTIME)
125
126tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
127tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
128tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
129
130tstSSM_TEMPLATE = VBOXR3TSTEXE
131tstSSM_SOURCES = tstSSM.cpp
132tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
133
134tstCFGM_TEMPLATE = VBOXR3TSTEXE
135tstCFGM_SOURCES = tstCFGM.cpp
136tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
137
138tstVMM_TEMPLATE = VBOXR3EXE
139tstVMM_SOURCES = tstVMM.cpp
140tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
141
142tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
143tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
144tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
145
146tstVMMFork_TEMPLATE = VBOXR3EXE
147tstVMMFork_SOURCES = tstVMMFork.cpp
148tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
149
150tstVMM-2_TEMPLATE = VBOXR3EXE
151tstVMM-2_SOURCES = tstVMM-2.cpp
152tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
153
154tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
155tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
156tstVMMR0CallHost-1_SOURCES = \
157 tstVMMR0CallHost-1.cpp \
158 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
159tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
160
161tstVMREQ_TEMPLATE = VBOXR3EXE
162tstVMREQ_SOURCES = tstVMREQ.cpp
163tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
164
165tstAnimate_TEMPLATE = VBOXR3EXE
166tstAnimate_SOURCES = tstAnimate.cpp
167tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
168
169tstCompiler_TEMPLATE = VBOXR3TSTEXE
170tstCompiler_SOURCES = tstCompiler.cpp
171tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
172
173tstMicro_TEMPLATE = VBOXR3EXE
174tstMicro_SOURCES = tstMicro.cpp
175tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
176
177# tstMicroGC.gc
178tstMicroGC_TEMPLATE = VBOXGC
179tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
180tstMicroGC_DEFS =
181tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
182ifeq ($(VBOX_LDR_FMT32),pe)
183tstMicroGC_LDFLAGS = -Entry:tstMicroGC
184endif
185tstMicroGC_SYSSUFF = .gc
186tstMicroGC_LIBS = \
187 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
188 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
189ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
190tstMicroGC_LIBS += \
191 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
192 $(LIB_VMMGC)
193endif
194tstMicroGC_SOURCES.win = tstMicroGC.def
195
196ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
197tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
198tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
199tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
200endif
201
202include $(KBUILD_PATH)/subfooter.kmk
203
204
205
206#
207# Some handcrafted support targets for tstAsmStructs.
208#
209
210ifeq ($(KBUILD_HOST),win)
211 ifndef TOOL_MINGW32
212 include $(KBUILD_PATH)/tools/MINGW32.kmk
213 endif
214 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
215else
216 VBOX_NM ?= nm -p
217endif
218
219MY_ASA_ASM_STUFF = \
220 $(addprefix -D, \
221 $(DEFS) \
222 $(DEFS.$(KBUILD_TYPE)) \
223 $(DEFS.$(KBUILD_TARGET)) \
224 IN_RING3 $(ARCH_BITS_DEFS) \
225 $(DEFS.$(KBUILD_TARGET_ARCH)) \
226 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
227 ) \
228 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
229 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(VBOX_VMM_TESTCASE_OUT_DIR),-I$(inc)/)
230
231# 1a. make a header file which makes all the structures+members globals.
232$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac: \
233 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
234 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
235 $(DEPTH)/include/iprt/asmdefs.mac \
236 $(DEPTH)/include/VBox/cpum.mac \
237 $(DEPTH)/include/VBox/sup.mac \
238 $(DEPTH)/include/VBox/vm.mac \
239 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
240 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
241 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
242 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
243 $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG) \
244 | $$(dir $$@)
245 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
246ifndef DONT_USE_YASM
247 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
248 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ $@.lst
249else
250 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
251 $(VBOX_NM) $@.o | $(SED) \
252 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
253 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
254 > $@
255endif
256
257# 1b. make an elf/macho object containing the offsets.
258$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o: \
259 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
260 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
261 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
262 | $$(dir $$@)
263 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
264ifndef DONT_USE_YASM
265 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
266else
267 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
268endif
269
270# 2. use nm and sed to transform this into the header we want.
271$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o
272 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
273 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
274 $(QUIET)$(REDIRECT) -wo $@.dump -- $(VBOX_NM) $<
275 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
276 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
277 --output $@.tmp $@.dump
278 $(QUIET)$(SED) -e '/VM_size$$/d' \
279 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
280 --append $@.tmp $@.dump
281 $(QUIET)$(MV) -f $@.tmp $@
282 $(QUIET)$(RM) -f $@.dump
283
284# 3. transform the HC header into a GC one by omitting some HC only structures.
285$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsGC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
286 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
287 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
288
289## @todo make this default kBuild behaviour.
290.SECONDEXPANSION:
291
292# 4. run it.
293$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run: $$(INSTARGET_tstAsmStructs) $$(INSTARGET_tstAsmStructsGC)
294 $(QUIET)$(RM) -f $@
295 $(INSTARGET_tstAsmStructs)
296 $(INSTARGET_tstAsmStructsGC)
297 $(QUIET)$(APPEND) "$@" "done"
298
299
300
301#
302# Run rule for tstVMStructSize.
303#
304
305# 1. Manually dump selected structures and members.
306$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC) | $$(dir $$@)
307 $(call MSG_GENERATE,tstVMStructSize,$@)
308 $(QUIET)$(REDIRECT) -wo $@ -- $<
309
310# 2. run it.
311$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize) | $$(dir $$@)
312 $(QUIET)$(RM) -f $@
313 $<
314 $(QUIET)$(APPEND) "$@" "done"
315
316# alias for the two struct tests.
317run-struct-tests: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
318
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