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