VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/tstVMM-HM.cpp@ 53183

Last change on this file since 53183 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.4 KB
Line 
1/* $Id: tstVMM-HM.cpp 44528 2013-02-04 14:27:54Z vboxsync $ */
2/** @file
3 * VMM Testcase.
4 */
5
6/*
7 * Copyright (C) 2006-2013 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-Hm"
37
38VMMR3DECL(int) VMMDoHmTest(PVM pVM);
39
40
41static DECLCALLBACK(int) tstVmmHmConfigConstructor(PUVM pUVM, 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
65int 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-Hm to cause kernel panics. */
79 return 1;
80
81 /*
82 * Create empty VM.
83 */
84 RTPrintf(TESTCASE ": Initializing...\n");
85 PVM pVM;
86 PUVM pUVM;
87 int rc = VMR3Create(1, NULL, NULL, NULL, tstVmmHmConfigConstructor, NULL, &pVM, &pUVM);
88 if (RT_SUCCESS(rc))
89 {
90 /*
91 * Do testing.
92 */
93 RTPrintf(TESTCASE ": Testing...\n");
94 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)VMMDoHmTest, 1, pVM);
95 AssertRC(rc);
96
97 STAMR3Dump(pUVM, "*");
98
99 /*
100 * Cleanup.
101 */
102 rc = VMR3Destroy(pUVM);
103 if (RT_FAILURE(rc))
104 {
105 RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
106 rcRet++;
107 }
108 VMR3ReleaseUVM(pUVM);
109 }
110 else
111 {
112 RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
113 rcRet++;
114 }
115
116 return rcRet;
117}
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