1 | /** @file
|
---|
2 | *
|
---|
3 | * VMM Testcase.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung 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 | #include <stdio.h>
|
---|
38 |
|
---|
39 |
|
---|
40 | /*******************************************************************************
|
---|
41 | * Defined Constants And Macros *
|
---|
42 | *******************************************************************************/
|
---|
43 | #define TESTCASE "tstVMM"
|
---|
44 |
|
---|
45 | VMMR3DECL(int) VMMDoTest(PVM pVM);
|
---|
46 |
|
---|
47 | int main(int argc, char **argv)
|
---|
48 | {
|
---|
49 | int rcRet = 0; /* error count. */
|
---|
50 |
|
---|
51 | RTR3Init();
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * Create empty VM.
|
---|
55 | */
|
---|
56 | RTPrintf(TESTCASE ": Initializing...\n");
|
---|
57 | PVM pVM;
|
---|
58 | int rc = VMR3Create(NULL, NULL, NULL, NULL, &pVM);
|
---|
59 | if (VBOX_SUCCESS(rc))
|
---|
60 | {
|
---|
61 | /*
|
---|
62 | * Do testing.
|
---|
63 | */
|
---|
64 | RTPrintf(TESTCASE ": Testing...\n");
|
---|
65 | PVMREQ pReq1 = NULL;
|
---|
66 | rc = VMR3ReqCall(pVM, &pReq1, RT_INDEFINITE_WAIT, (PFNRT)VMMDoTest, 1, pVM);
|
---|
67 | AssertRC(rc);
|
---|
68 | VMR3ReqFree(pReq1);
|
---|
69 |
|
---|
70 | STAMR3Dump(pVM, "*");
|
---|
71 |
|
---|
72 | /*
|
---|
73 | * Cleanup.
|
---|
74 | */
|
---|
75 | rc = VMR3Destroy(pVM);
|
---|
76 | if (!VBOX_SUCCESS(rc))
|
---|
77 | {
|
---|
78 | printf(TESTCASE ": error: failed to destroy vm! rc=%d\n", rc);
|
---|
79 | rcRet++;
|
---|
80 | }
|
---|
81 | }
|
---|
82 | else
|
---|
83 | {
|
---|
84 | printf(TESTCASE ": fatal error: failed to create vm! rc=%d\n", rc);
|
---|
85 | rcRet++;
|
---|
86 | }
|
---|
87 |
|
---|
88 | return rcRet;
|
---|
89 | }
|
---|