VirtualBox

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

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

Forgot one template. moved the LIBS.l4 prop into VBOXR3AUTOTST.

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