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 innotek GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
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/runtime.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 |
|
---|
42 | VMMR3DECL(int) VMMDoHwAccmTest(PVM pVM);
|
---|
43 |
|
---|
44 |
|
---|
45 | DECLCALLBACK(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 |
|
---|
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 | RTR3Init();
|
---|
68 |
|
---|
69 | /*
|
---|
70 | * Create empty VM.
|
---|
71 | */
|
---|
72 | RTPrintf(TESTCASE ": Initializing...\n");
|
---|
73 | PVM pVM;
|
---|
74 | int rc = VMR3Create(NULL, NULL, CFGMConstructor, NULL, &pVM);
|
---|
75 | if (VBOX_SUCCESS(rc))
|
---|
76 | {
|
---|
77 | /*
|
---|
78 | * Do testing.
|
---|
79 | */
|
---|
80 | RTPrintf(TESTCASE ": Testing...\n");
|
---|
81 | PVMREQ pReq1 = NULL;
|
---|
82 | rc = VMR3ReqCall(pVM, &pReq1, RT_INDEFINITE_WAIT, (PFNRT)VMMDoHwAccmTest, 1, pVM);
|
---|
83 | AssertRC(rc);
|
---|
84 | VMR3ReqFree(pReq1);
|
---|
85 |
|
---|
86 | STAMR3Dump(pVM, "*");
|
---|
87 |
|
---|
88 | /*
|
---|
89 | * Cleanup.
|
---|
90 | */
|
---|
91 | rc = VMR3Destroy(pVM);
|
---|
92 | if (!VBOX_SUCCESS(rc))
|
---|
93 | {
|
---|
94 | RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
|
---|
95 | rcRet++;
|
---|
96 | }
|
---|
97 | }
|
---|
98 | else
|
---|
99 | {
|
---|
100 | RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
|
---|
101 | rcRet++;
|
---|
102 | }
|
---|
103 |
|
---|
104 | return rcRet;
|
---|
105 | }
|
---|