tstVMM-HwAccm.cpp revision cfb87b49d2b36055eb5aea681936cdc130b54267
2N/A/* $Id$ */
2N/A/** @file
2N/A * VMM Testcase.
2N/A */
2N/A
2N/A/*
2N/A * Copyright (C) 2006-2007 Oracle Corporation
2N/A *
2N/A * This file is part of VirtualBox Open Source Edition (OSE), as
2N/A * available from http://www.virtualbox.org. This file is free software;
2N/A * you can redistribute it and/or modify it under the terms of the GNU
2N/A * General Public License (GPL) as published by the Free Software
2N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
2N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2N/A */
2N/A
2N/A
2N/A/*******************************************************************************
2N/A* Header Files *
2N/A*******************************************************************************/
2N/A#include <VBox/vm.h>
2N/A#include <VBox/vmm.h>
2N/A#include <VBox/cpum.h>
2N/A#include <VBox/err.h>
2N/A#include <VBox/log.h>
2N/A#include <iprt/assert.h>
2N/A#include <iprt/initterm.h>
2N/A#include <iprt/semaphore.h>
2N/A#include <iprt/stream.h>
2N/A
2N/A
2N/A/*******************************************************************************
2N/A* Defined Constants And Macros *
2N/A*******************************************************************************/
2N/A#define TESTCASE "tstVMM-HwAccm"
2N/A
2N/AVMMR3DECL(int) VMMDoHwAccmTest(PVM pVM);
2N/A
2N/A
2N/ADECLCALLBACK(int) CFGMConstructor(PVM pVM, void *pvUser)
2N/A{
2N/A /*
2N/A * Get root node first.
2N/A * This is the only node in the tree.
2N/A */
2N/A PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
2N/A int rc = CFGMR3InsertInteger(pRoot, "RamSize", 32*1024*1024);
2N/A AssertRC(rc);
2N/A
2N/A /* rc = CFGMR3InsertInteger(pRoot, "EnableNestedPaging", false);
2N/A AssertRC(rc); */
2N/A
2N/A PCFGMNODE pHWVirtExt;
2N/A rc = CFGMR3InsertNode(pRoot, "HWVirtExt", &pHWVirtExt);
2N/A AssertRC(rc);
2N/A rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled", 1);
2N/A AssertRC(rc);
2N/A
2N/A return VINF_SUCCESS;
2N/A}
2N/A
2N/Aint main(int argc, char **argv)
2N/A{
2N/A int rcRet = 0; /* error count. */
2N/A
2N/A RTR3InitAndSUPLib();
2N/A
2N/A /*
2N/A * Doesn't work and I'm sick of rebooting the machine to try figure out
2N/A * what the heck is going wrong. (Linux sucks at this)
2N/A */
2N/A RTPrintf(TESTCASE ": This testcase hits a bunch of breakpoint assertions which\n"
2N/A TESTCASE ": causes kernel panics on linux regardless of what\n"
2N/A TESTCASE ": RTAssertDoBreakpoint returns. Only checked AMD-V on linux.\n");
2N/A /** @todo Make tstVMM-HwAccm to cause kernel panics. */
2N/A return 1;
2N/A
2N/A /*
2N/A * Create empty VM.
2N/A */
2N/A RTPrintf(TESTCASE ": Initializing...\n");
2N/A PVM pVM;
2N/A int rc = VMR3Create(1, NULL, NULL, NULL, CFGMConstructor, NULL, &pVM);
2N/A if (RT_SUCCESS(rc))
2N/A {
2N/A /*
2N/A * Do testing.
2N/A */
2N/A RTPrintf(TESTCASE ": Testing...\n");
2N/A rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)VMMDoHwAccmTest, 1, pVM);
2N/A AssertRC(rc);
2N/A
2N/A STAMR3Dump(pVM, "*");
2N/A
2N/A /*
2N/A * Cleanup.
2N/A */
2N/A rc = VMR3Destroy(pVM);
2N/A if (RT_FAILURE(rc))
2N/A {
2N/A RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
2N/A rcRet++;
2N/A }
2N/A }
2N/A else
2N/A {
2N/A RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
2N/A rcRet++;
2N/A }
2N/A
2N/A return rcRet;
2N/A}
2N/A