VirtualBox

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

Last change on this file since 22137 was 21802, checked in by vboxsync, 15 years ago

tstCompressionBenchmark: code in progress.

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