VirtualBox

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

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

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.8 KB
Line 
1# $Id: Makefile.kmk 28800 2010-04-27 08:22:32Z 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
131ifdef VBOX_WITH_VMI
132 tstVMStructSize_DEFS += VBOX_WITH_VMI
133 tstVMStructSize_INCS += $(VBOX_PATH_VMM_SRC)/PARAV
134endif
135
136tstAsmStructs_TEMPLATE = VBOXR3AUTOTST
137tstAsmStructs_DEFS = IN_VMM_R3 IN_DIS
138ifdef VBOX_WITH_RAW_MODE
139 tstAsmStructs_DEFS += VBOX_WITH_RAW_MODE
140endif
141ifdef VBOX_WITH_R0_LOGGING
142 tstAsmStructs_DEFS += VBOX_WITH_R0_LOGGING
143endif
144tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
145tstAsmStructs_SOURCES = tstAsmStructs.cpp
146tstAsmStructs.cpp_DEPS = $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
147
148ifdef VBOX_WITH_RAW_MODE
149 tstAsmStructsRC_TEMPLATE= VBoxRcExe
150 tstAsmStructsRC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE
151 ifdef VBOX_WITH_R0_LOGGING
152 tstAsmStructsRC_DEFS += VBOX_WITH_R0_LOGGING
153 endif
154 tstAsmStructsRC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_VMM_TESTCASE_OUT_DIR)
155 tstAsmStructsRC_SOURCES = tstAsmStructs.cpp
156 tstAsmStructs.cpp_DEPS += $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h
157endif # VBOX_WITH_RAW_MODE
158
159
160tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
161tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
162tstGlobalConfig_LIBS = $(LIB_RUNTIME)
163
164tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
165tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
166tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
167
168tstSSM_TEMPLATE = VBOXR3TSTEXE
169tstSSM_SOURCES = tstSSM.cpp
170tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
171
172tstInstrEmul_TEMPLATE = VBOXR3EXE
173tstInstrEmul_SOURCES = tstInstrEmul.cpp ../VMMAll/EMAllA.asm
174tstInstrEmul_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
175
176tstCFGM_TEMPLATE = VBOXR3TSTEXE
177tstCFGM_SOURCES = tstCFGM.cpp
178tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
179
180tstCompressionBenchmark_TEMPLATE = VBOXR3TSTEXE
181tstCompressionBenchmark_SOURCES = tstCompressionBenchmark.cpp
182
183tstVMMR0CallHost-1_TEMPLATE = VBOXR3TSTEXE
184tstVMMR0CallHost-1_DEFS = VMM_R0_NO_SWITCH_STACK
185tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
186tstVMMR0CallHost-1_SOURCES = \
187 tstVMMR0CallHost-1.cpp
188tstVMMR0CallHost-1_SOURCES.amd64 = \
189 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0JmpA-amd64.asm
190tstVMMR0CallHost-1_SOURCES.x86 = \
191 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0JmpA-x86.asm
192
193tstVMMR0CallHost-2_EXTENDS = tstVMMR0CallHost-1
194tstVMMR0CallHost-2_DEFS = VMM_R0_SWITCH_STACK
195
196tstVMREQ_TEMPLATE = VBOXR3EXE
197tstVMREQ_SOURCES = tstVMREQ.cpp
198tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
199
200tstAnimate_TEMPLATE = VBOXR3EXE
201tstAnimate_SOURCES = tstAnimate.cpp
202tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
203
204tstCompiler_TEMPLATE = VBOXR3TSTEXE
205tstCompiler_SOURCES = tstCompiler.cpp
206tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
207
208ifdef VBOX_WITH_RAW_MODE
209
210 tstVMM_TEMPLATE = VBOXR3EXE
211 tstVMM_SOURCES = tstVMM.cpp
212 tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
213
214 tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
215 tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
216 tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
217
218 tstVMMFork_TEMPLATE = VBOXR3EXE
219 tstVMMFork_SOURCES = tstVMMFork.cpp
220 tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
221
222 tstMicro_TEMPLATE = VBOXR3EXE
223 tstMicro_SOURCES = tstMicro.cpp
224 tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
225
226 tstMicroRC_TEMPLATE = VBoxRc
227 tstMicroRC_SOURCES = tstMicroRC.cpp tstMicroRCA.asm
228 tstMicroRC_DEFS =
229 tstMicroRC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
230 ifeq ($(VBOX_LDR_FMT32),pe)
231 tstMicroRC_LDFLAGS = -Entry:tstMicroRC
232 endif
233 tstMicroRC_SYSSUFF = .gc
234 tstMicroRC_LIBS = \
235 $(PATH_LIB)/DisasmRC$(VBOX_SUFF_LIB) \
236 $(PATH_LIB)/RuntimeRC$(VBOX_SUFF_LIB)
237 ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
238 tstMicroRC_LIBS += \
239 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
240 $(LIB_VMMGC)
241 endif
242 tstMicroRC_SOURCES.win = tstMicroRC.def
243
244endif # VBOX_WITH_RAW_MODE
245
246ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
247 tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
248 tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
249 tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
250
251 tstPDMAsyncCompletionStress_TEMPLATE = VBOXR3EXE
252 tstPDMAsyncCompletionStress_SOURCES = tstPDMAsyncCompletionStress.cpp
253 tstPDMAsyncCompletionStress_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
254endif
255
256include $(KBUILD_PATH)/subfooter.kmk
257
258
259#
260# Run rule for tstInstrEmul.
261#
262$(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run: $$(INSTARGET_tstInstrEmul) | $$(dir $$@)
263 $(QUIET)$(RM) -f $@
264 $(QUIET)$(REDIRECT) -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
265 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
266 -- \
267 $(INSTARGET_tstInstrEmul)
268 $(QUIET)$(APPEND) "$@" "done"
269
270
271#
272# Some handcrafted support targets for tstAsmStructs.
273#
274
275ifeq ($(KBUILD_HOST),win)
276 ifndef TOOL_MINGW32
277 include $(KBUILD_PATH)/tools/MINGW32.kmk
278 endif
279 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
280else
281 VBOX_NM ?= nm -p
282endif
283
284MY_ASA_ASM_STUFF = \
285 $(addprefix -D, \
286 $(DEFS) \
287 $(DEFS.$(KBUILD_TYPE)) \
288 $(DEFS.$(KBUILD_TARGET)) \
289 IN_RING3 $(ARCH_BITS_DEFS) \
290 $(DEFS.$(KBUILD_TARGET_ARCH)) \
291 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
292 ) \
293 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
294 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(VBOX_VMM_TESTCASE_OUT_DIR),-I$(inc)/)
295
296# 1a. make a header file which makes all the structures+members globals.
297$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac: \
298 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
299 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
300 $(DEPTH)/include/iprt/asmdefs.mac \
301 $(DEPTH)/include/VBox/cpum.mac \
302 $(DEPTH)/include/VBox/sup.mac \
303 $(DEPTH)/include/VBox/vm.mac \
304 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
305 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
306 $(VBOX_PATH_VMM_SRC)/HWACCMInternal.mac \
307 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
308 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
309 $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG) \
310 | $$(dir $$@)
311 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
312ifndef DONT_USE_YASM
313 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
314 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ $@.lst
315else
316 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
317 $(VBOX_NM) $@.o | $(SED) \
318 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
319 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
320 > $@
321endif
322
323# 1b. make an elf/macho object containing the offsets.
324$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o: \
325 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
326 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
327 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
328 | $$(dir $$@)
329 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
330ifndef DONT_USE_YASM
331 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
332else
333 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
334endif
335
336# 2. use nm and sed to transform this into the header we want.
337$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o
338 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
339 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
340 $(QUIET)$(REDIRECT) -wo $@.dump -- $(VBOX_NM) $<
341 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
342 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
343 --output $@.tmp $@.dump
344 $(QUIET)$(SED) -e '/VM_size$$/d' -e '/VMCPU_size$$/d' \
345 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
346 --append $@.tmp $@.dump
347 $(QUIET)$(MV) -f $@.tmp $@
348 $(QUIET)$(RM) -f $@.dump
349
350ifdef VBOX_WITH_RAW_MODE
351# 3. transform the HC header into a RC one by omitting some HC only structures.
352$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
353 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
354 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
355endif
356
357# 4. run it.
358$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run: \
359 $$(INSTARGET_tstAsmStructs) \
360 $(if-expr defined(VBOX_WITH_RAW_MODE),$$(INSTARGET_tstAsmStructsRC),)
361 $(QUIET)$(RM) -f $@
362 $(INSTARGET_tstAsmStructs)
363ifdef VBOX_WITH_RAW_MODE
364 $(INSTARGET_tstAsmStructsRC)
365endif
366 $(QUIET)$(APPEND) "$@" "done"
367
368
369
370#
371# Run rule for tstVMStructSize.
372#
373
374ifdef VBOX_WITH_RAW_MODE
375# 1. Manually dump selected structures and members.
376$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h: $$(INSTARGET_tstVMStructRC) | $$(dir $$@)
377 $(call MSG_GENERATE,tstVMStructSize,$@)
378 $(QUIET)$(REDIRECT) -wo $@ -- $<
379endif # VBOX_WITH_RAW_MODE
380
381# 2. run it.
382$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize) | $$(dir $$@)
383 $(QUIET)$(RM) -f $@
384 $<
385 $(QUIET)$(APPEND) "$@" "done"
386
387# alias for the two struct tests.
388run-struct-tests: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
389
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