VirtualBox

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

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

Renamed src/recompiler_new to src/recompiler.

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