1 | /* $Id: tstVMM-HwAccm.cpp 39084 2011-10-22 00:37:15Z 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/vmm/vm.h>
|
---|
23 | #include <VBox/vmm/vmm.h>
|
---|
24 | #include <VBox/vmm/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 | static DECLCALLBACK(int) CFGMConstructor(PVM pVM, void *pvUser)
|
---|
42 | {
|
---|
43 | NOREF(pvUser);
|
---|
44 |
|
---|
45 | /*
|
---|
46 | * Get root node first.
|
---|
47 | * This is the only node in the tree.
|
---|
48 | */
|
---|
49 | PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
|
---|
50 | int rc = CFGMR3InsertInteger(pRoot, "RamSize", 32*1024*1024);
|
---|
51 | AssertRC(rc);
|
---|
52 |
|
---|
53 | /* rc = CFGMR3InsertInteger(pRoot, "EnableNestedPaging", false);
|
---|
54 | AssertRC(rc); */
|
---|
55 |
|
---|
56 | PCFGMNODE pHWVirtExt;
|
---|
57 | rc = CFGMR3InsertNode(pRoot, "HWVirtExt", &pHWVirtExt);
|
---|
58 | AssertRC(rc);
|
---|
59 | rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled", 1);
|
---|
60 | AssertRC(rc);
|
---|
61 |
|
---|
62 | return VINF_SUCCESS;
|
---|
63 | }
|
---|
64 |
|
---|
65 | int main(int argc, char **argv)
|
---|
66 | {
|
---|
67 | int rcRet = 0; /* error count. */
|
---|
68 |
|
---|
69 | RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
|
---|
70 |
|
---|
71 | /*
|
---|
72 | * Doesn't work and I'm sick of rebooting the machine to try figure out
|
---|
73 | * what the heck is going wrong. (Linux sucks at this)
|
---|
74 | */
|
---|
75 | RTPrintf(TESTCASE ": This testcase hits a bunch of breakpoint assertions which\n"
|
---|
76 | TESTCASE ": causes kernel panics on linux regardless of what\n"
|
---|
77 | TESTCASE ": RTAssertDoBreakpoint returns. Only checked AMD-V on linux.\n");
|
---|
78 | /** @todo Make tstVMM-HwAccm to cause kernel panics. */
|
---|
79 | return 1;
|
---|
80 |
|
---|
81 | /*
|
---|
82 | * Create empty VM.
|
---|
83 | */
|
---|
84 | RTPrintf(TESTCASE ": Initializing...\n");
|
---|
85 | PVM pVM;
|
---|
86 | int rc = VMR3Create(1, NULL, NULL, NULL, CFGMConstructor, NULL, &pVM);
|
---|
87 | if (RT_SUCCESS(rc))
|
---|
88 | {
|
---|
89 | /*
|
---|
90 | * Do testing.
|
---|
91 | */
|
---|
92 | RTPrintf(TESTCASE ": Testing...\n");
|
---|
93 | rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)VMMDoHwAccmTest, 1, pVM);
|
---|
94 | AssertRC(rc);
|
---|
95 |
|
---|
96 | STAMR3Dump(pVM, "*");
|
---|
97 |
|
---|
98 | /*
|
---|
99 | * Cleanup.
|
---|
100 | */
|
---|
101 | rc = VMR3Destroy(pVM);
|
---|
102 | if (RT_FAILURE(rc))
|
---|
103 | {
|
---|
104 | RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
|
---|
105 | rcRet++;
|
---|
106 | }
|
---|
107 | }
|
---|
108 | else
|
---|
109 | {
|
---|
110 | RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
|
---|
111 | rcRet++;
|
---|
112 | }
|
---|
113 |
|
---|
114 | return rcRet;
|
---|
115 | }
|
---|