VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp@ 19420

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

VMReq,*: Replaced VMREQDEST with VMCPUID because it's a pain to have to cast CPU IDs all the time.

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1/* $Id: tstVMM.cpp 17451 2007-01-15 14:08:28Z bird $ */
2/** @file
3 * VMM Testcase.
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
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#include <VBox/vm.h>
27#include <VBox/vmm.h>
28#include <VBox/cpum.h>
29#include <VBox/err.h>
30#include <VBox/log.h>
31#include <iprt/assert.h>
32#include <iprt/initterm.h>
33#include <iprt/semaphore.h>
34#include <iprt/stream.h>
35
36
37/*******************************************************************************
38* Defined Constants And Macros *
39*******************************************************************************/
40#define TESTCASE "tstVMM-HwAccm"
41
42VMMR3DECL(int) VMMDoHwAccmTest(PVM pVM);
43
44
45DECLCALLBACK(int) CFGMConstructor(PVM pVM, void *pvUser)
46{
47 /*
48 * Get root node first.
49 * This is the only node in the tree.
50 */
51 PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
52 int rc = CFGMR3InsertInteger(pRoot, "RamSize", 32*1024*1024);
53 AssertRC(rc);
54
55 /* rc = CFGMR3InsertInteger(pRoot, "EnableNestedPaging", false);
56 AssertRC(rc); */
57
58 PCFGMNODE pHWVirtExt;
59 rc = CFGMR3InsertNode(pRoot, "HWVirtExt", &pHWVirtExt);
60 AssertRC(rc);
61 rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled", 1);
62 AssertRC(rc);
63
64 return VINF_SUCCESS;
65}
66
67int main(int argc, char **argv)
68{
69 int rcRet = 0; /* error count. */
70
71 RTR3InitAndSUPLib();
72
73 /*
74 * Doesn't work and I'm sick of rebooting the machine to try figure out
75 * what the heck is going wrong. (Linux sucks at this)
76 */
77 RTPrintf(TESTCASE ": This testcase hits a bunch of breakpoint assertions which\n"
78 TESTCASE ": causes kernel panics on linux regardless of what\n"
79 TESTCASE ": RTAssertDoBreakpoint returns. Only checked AMD-V on linux.\n");
80 /** @todo Make tstVMM-HwAccm to cause kernel panics. */
81 return 1;
82
83 /*
84 * Create empty VM.
85 */
86 RTPrintf(TESTCASE ": Initializing...\n");
87 PVM pVM;
88 int rc = VMR3Create(1, NULL, NULL, CFGMConstructor, NULL, &pVM);
89 if (RT_SUCCESS(rc))
90 {
91 /*
92 * Do testing.
93 */
94 RTPrintf(TESTCASE ": Testing...\n");
95 PVMREQ pReq1 = NULL;
96 rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq1, RT_INDEFINITE_WAIT, (PFNRT)VMMDoHwAccmTest, 1, pVM);
97 AssertRC(rc);
98 VMR3ReqFree(pReq1);
99
100 STAMR3Dump(pVM, "*");
101
102 /*
103 * Cleanup.
104 */
105 rc = VMR3Destroy(pVM);
106 if (!RT_SUCCESS(rc))
107 {
108 RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
109 rcRet++;
110 }
111 }
112 else
113 {
114 RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
115 rcRet++;
116 }
117
118 return rcRet;
119}
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