VirtualBox

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

Last change on this file since 96749 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.0 KB
Line 
1/* $Id: tstVMM-HM.cpp 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * VMM Testcase.
4 */
5
6/*
7 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#include <VBox/vmm/vm.h>
33#include <VBox/vmm/vmm.h>
34#include <VBox/vmm/cpum.h>
35#include <iprt/errcore.h>
36#include <VBox/log.h>
37#include <iprt/assert.h>
38#include <iprt/initterm.h>
39#include <iprt/semaphore.h>
40#include <iprt/stream.h>
41
42
43/*********************************************************************************************************************************
44* Defined Constants And Macros *
45*********************************************************************************************************************************/
46#define TESTCASE "tstVMM-Hm"
47
48VMMR3DECL(int) VMMDoHmTest(PVM pVM);
49
50
51#if 0
52static DECLCALLBACK(int) tstVmmHmConfigConstructor(PUVM pUVM, PVM pVM, void *pvUser)
53{
54 RT_NOREF2(pUVM, pvUser);
55
56 /*
57 * Get root node first.
58 * This is the only node in the tree.
59 */
60 PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
61 int rc = CFGMR3InsertInteger(pRoot, "RamSize", 32*1024*1024);
62 AssertRC(rc);
63
64 /* rc = CFGMR3InsertInteger(pRoot, "EnableNestedPaging", false);
65 AssertRC(rc); */
66
67 PCFGMNODE pHWVirtExt;
68 rc = CFGMR3InsertNode(pRoot, "HWVirtExt", &pHWVirtExt);
69 AssertRC(rc);
70 rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled", 1);
71 AssertRC(rc);
72
73 return VINF_SUCCESS;
74}
75#endif
76
77int main(int argc, char **argv)
78{
79 RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_TRY_SUPLIB);
80
81 /*
82 * Doesn't work and I'm sick of rebooting the machine to try figure out
83 * what the heck is going wrong. (Linux sucks at this)
84 */
85 RTPrintf(TESTCASE ": This testcase hits a bunch of breakpoint assertions which\n"
86 TESTCASE ": causes kernel panics on linux regardless of what\n"
87 TESTCASE ": RTAssertDoBreakpoint returns. Only checked AMD-V on linux.\n");
88#if 1
89 /** @todo Make tstVMM-Hm to cause kernel panics. */
90 return 1;
91#else
92 int rcRet = 0; /* error count. */
93
94 /*
95 * Create empty VM.
96 */
97 RTPrintf(TESTCASE ": Initializing...\n");
98 PVM pVM;
99 PUVM pUVM;
100 int rc = VMR3Create(1, NULL, NULL, NULL, tstVmmHmConfigConstructor, NULL, &pVM, &pUVM);
101 if (RT_SUCCESS(rc))
102 {
103 /*
104 * Do testing.
105 */
106 RTPrintf(TESTCASE ": Testing...\n");
107 rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)VMMDoHmTest, 1, pVM);
108 AssertRC(rc);
109
110 STAMR3Dump(pUVM, "*");
111
112 /*
113 * Cleanup.
114 */
115 rc = VMR3Destroy(pUVM);
116 if (RT_FAILURE(rc))
117 {
118 RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
119 rcRet++;
120 }
121 VMR3ReleaseUVM(pUVM);
122 }
123 else
124 {
125 RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
126 rcRet++;
127 }
128
129 return rcRet;
130#endif
131}
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