VirtualBox

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

Last change on this file since 29561 was 29329, checked in by vboxsync, 15 years ago

removed VBOX_WITH_VMI

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