VirtualBox

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

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

Disabled automatic execution of tstInstrEmul as it caused unsolavble trouble on darwin (abs VBoxREM.dylib ref).

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