VirtualBox

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

Last change on this file since 11938 was 11805, checked in by vboxsync, 16 years ago
  • rearranged SDK-only stuff in makefiles per Knut advise
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.8 KB
Line 
1# $Id: Makefile.kmk 11805 2008-08-29 10:17:27Z 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
22ifdef VBOX_KBUILD_HACKING
23SUB_DEPTH = ../../../..
24else
25SUB_DEPTH = ..
26DEPTH ?= ../../../..
27endif
28include $(KBUILD_PATH)/subheader.kmk
29
30#
31# Target lists.
32#
33PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm tstGlobalConfig
34ifneq ($(KBUILD_TARGET),win)
35PROGRAMS += tstVMMFork
36endif
37ifdef VBOX_WITH_TESTCASES
38 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
39 ifneq ($(KBUILD_TARGET),l4)
40 PROGRAMS += tstAnimate
41 endif
42 SYSMODS += tstMicroGC
43endif # VBOX_WITH_TESTCASES
44
45ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
46 PROGRAMS += tstPDMAsyncCompletion
47endif
48
49
50#
51# We setup two 'other' targets for executing the two structure & alignment
52# validation testcases. Perhaps a bit hackish, but extremely useful.
53#
54ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
55 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),)
56 OTHERS += \
57 $(PATH_TARGET)/tstAsmStructs.run \
58 $(PATH_TARGET)/tstVMStructSize.run
59 endif
60endif
61
62# The normal testing pass.
63TESTING += \
64 $(PATH_TARGET)/tstAsmStructs.run \
65 $(PATH_TARGET)/tstVMStructSize.run
66
67OTHER_CLEAN += \
68 $(PATH_TARGET)/tstAsmStructs.run \
69 $(PATH_TARGET)/tstVMStructSize.run \
70 $(PATH_TARGET)/tstAsmStructs.h \
71 $(PATH_TARGET)/tstAsmStructsAsm.o \
72 $(PATH_TARGET)/tstAsmStructsAsm.mac \
73 $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
74 $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
75 $(PATH_TARGET)/tstAsmStructs.h.dump \
76 $(PATH_TARGET)/tstAsmStructsGC.h \
77 $(PATH_TARGET)/tstAsmStructsHC.h \
78 $(PATH_TARGET)/tstVMStructGC.h
79
80#
81# Globals
82#
83VBOX_PATH_VMM_SRC = $(PATH_ROOT)/src/VBox/VMM
84
85#
86# Targets
87#
88tstVMStructGC_TEMPLATE = VBOXGCEXE
89tstVMStructGC_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
90ifdef VBOX_WITH_IDT_PATCHING
91tstVMStructGC_DEFS += VBOX_WITH_IDT_PATCHING
92endif
93tstVMStructGC_SOURCES = tstVMStructGC.cpp
94tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
95
96tstVMStructSize_TEMPLATE= VBOXR3AUTOTST
97tstVMStructSize_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
98ifdef VBOX_WITH_IDT_PATCHING
99tstVMStructSize_DEFS += VBOX_WITH_IDT_PATCHING
100endif
101tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
102tstVMStructSize_SOURCES = tstVMStructSize.cpp
103tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
104
105tstAsmStructs_TEMPLATE = VBOXR3AUTOTST
106tstAsmStructs_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
107ifdef VBOX_WITH_IDT_PATCHING
108tstAsmStructs_DEFS += VBOX_WITH_IDT_PATCHING
109endif
110tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
111tstAsmStructs_SOURCES = tstAsmStructs.cpp
112
113tstAsmStructsGC_TEMPLATE= VBOXGCEXE
114tstAsmStructsGC_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
115ifdef VBOX_WITH_IDT_PATCHING
116tstAsmStructsGC_DEFS += VBOX_WITH_IDT_PATCHING
117endif
118tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
119tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
120
121tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
122
123
124tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
125tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
126tstGlobalConfig_LIBS = $(LIB_RUNTIME)
127
128tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
129tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
130tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
131
132tstSSM_TEMPLATE = VBOXR3TSTEXE
133tstSSM_SOURCES = tstSSM.cpp
134tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
135
136tstCFGM_TEMPLATE = VBOXR3TSTEXE
137tstCFGM_SOURCES = tstCFGM.cpp
138tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
139
140tstVMM_TEMPLATE = VBOXR3EXE
141tstVMM_SOURCES = tstVMM.cpp
142tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
143
144tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
145tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
146tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
147
148tstVMMFork_TEMPLATE = VBOXR3EXE
149tstVMMFork_SOURCES = tstVMMFork.cpp
150tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
151
152tstVMM-2_TEMPLATE = VBOXR3EXE
153tstVMM-2_SOURCES = tstVMM-2.cpp
154tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
155
156tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
157tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
158tstVMMR0CallHost-1_SOURCES = \
159 tstVMMR0CallHost-1.cpp \
160 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
161tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
162
163tstVMREQ_TEMPLATE = VBOXR3EXE
164tstVMREQ_SOURCES = tstVMREQ.cpp
165tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
166
167tstAnimate_TEMPLATE = VBOXR3EXE
168tstAnimate_SOURCES = tstAnimate.cpp
169tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
170
171tstCompiler_TEMPLATE = VBOXR3TSTEXE
172tstCompiler_SOURCES = tstCompiler.cpp
173tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
174
175tstMicro_TEMPLATE = VBOXR3EXE
176tstMicro_SOURCES = tstMicro.cpp
177tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
178
179# tstMicroGC.gc
180tstMicroGC_TEMPLATE = VBOXGC
181tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
182tstMicroGC_DEFS =
183tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
184ifeq ($(VBOX_LDR_FMT32),pe)
185tstMicroGC_LDFLAGS = -Entry:tstMicroGC
186endif
187tstMicroGC_SYSSUFF = .gc
188tstMicroGC_LIBS = \
189 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
190 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
191ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
192tstMicroGC_LIBS += \
193 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
194 $(LIB_VMMGC)
195endif
196tstMicroGC_SOURCES.win = tstMicroGC.def
197
198ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
199tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
200tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
201tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
202endif
203
204include $(KBUILD_PATH)/subfooter.kmk
205
206
207
208#
209# Some handcrafted support targets for tstAsmStructs.
210#
211
212ifeq ($(KBUILD_HOST),win)
213 include $(KBUILD_PATH)/tools/MINGW32.kmk
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 $(PATH_TARGET),-I$(inc)/)
230
231# 1a. make a header file which makes all the structures+members globals.
232$(PATH_TARGET)/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 | $(call DIRDEP,$(PATH_TARGET))
245 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
246ifndef DONT_USE_YASM
247 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
248 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ [email protected]
249else
250 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
251 $(VBOX_NM) [email protected] | $(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$(PATH_TARGET)/tstAsmStructsAsm.o: \
259 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
260 $(PATH_TARGET)/tstAsmStructsAsm.mac \
261 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
262 | $(call DIRDEP,$(PATH_TARGET))
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$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
272 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
273 $(QUIET)$(RM) -f $@ [email protected] [email protected]
274 $(QUIET)$(REDIRECT) -wo [email protected] -- $(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 [email protected] [email protected]
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 [email protected] [email protected]
281 $(QUIET)$(MV) -f [email protected] $@
282 $(QUIET)$(RM) -f [email protected]
283
284# 3. transform the HC header into a GC one by omitting some HC only structures.
285$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/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$(PATH_TARGET)/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$(PATH_TARGET)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC)
307 $(call MSG_GENERATE,tstVMStructSize,$@)
308 $(QUIET)$(REDIRECT) -wo $@ -- $^
309
310# 2. run it.
311$(PATH_TARGET)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize)
312 $(QUIET)$(RM) -f $@
313 $^
314 $(QUIET)$(APPEND) "$@" "done"
315
316# alias for the two struct tests.
317run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/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