1 | /* $Id: tstRTR0TimerDriver.cpp 32753 2010-09-24 09:57:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT R0 Testcase - Timers, driver program.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2010 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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | /*******************************************************************************
|
---|
28 | * Header Files *
|
---|
29 | *******************************************************************************/
|
---|
30 | #include <iprt/initterm.h>
|
---|
31 |
|
---|
32 | #include <iprt/err.h>
|
---|
33 | #include <iprt/path.h>
|
---|
34 | #include <iprt/param.h>
|
---|
35 | #include <iprt/stream.h>
|
---|
36 | #include <iprt/string.h>
|
---|
37 | #include <iprt/test.h>
|
---|
38 | #include <iprt/thread.h>
|
---|
39 | #ifdef VBOX
|
---|
40 | # include <VBox/sup.h>
|
---|
41 | # include "tstRTR0Timer.h"
|
---|
42 | #endif
|
---|
43 | #include "tstRTR0CommonDriver.h"
|
---|
44 |
|
---|
45 |
|
---|
46 | int main(int argc, char **argv)
|
---|
47 | {
|
---|
48 | #ifndef VBOX
|
---|
49 | RTPrintf("tstRTR0Timer: SKIPPED\n");
|
---|
50 | return RTEXITCODE_SKIPPED;
|
---|
51 | #else
|
---|
52 | /*
|
---|
53 | * Init.
|
---|
54 | */
|
---|
55 | RTEXITCODE rcExit = RTR3TestR0CommonDriverInit("tstRTR0Timer");
|
---|
56 | if (rcExit != RTEXITCODE_SUCCESS)
|
---|
57 | return rcExit;
|
---|
58 |
|
---|
59 | # if 1
|
---|
60 | /*
|
---|
61 | * Standard timers.
|
---|
62 | */
|
---|
63 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_BASIC, "Basic one shot");
|
---|
64 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_BASIC, "Basic periodic");
|
---|
65 | if (RTTestErrorCount(g_hTest) == 0)
|
---|
66 | {
|
---|
67 | # if 1
|
---|
68 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_RESTART, "Restart one shot from callback");
|
---|
69 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_DESTROY, "Destroy one shot from callback");
|
---|
70 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_CSSD_LOOPS, "Create-start-stop-destroy loops");
|
---|
71 | for (uint32_t i = 0; i <= 7; i++)
|
---|
72 | RTR3TestR0SimpleTestWithArg(TSTRTR0TIMER_PERIODIC_CHANGE_INTERVAL, i, "Change interval from callback, variation %u", i);
|
---|
73 | # endif
|
---|
74 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_SPECIFIC, "One shot cpu specific");
|
---|
75 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_SPECIFIC, "Periodic cpu specific");
|
---|
76 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_OMNI, "Periodic omni timer");
|
---|
77 | }
|
---|
78 | # endif
|
---|
79 |
|
---|
80 | # if 1
|
---|
81 | /*
|
---|
82 | * High resolution timers.
|
---|
83 | */
|
---|
84 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_BASIC_HIRES, "Basic hires one shot");
|
---|
85 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_BASIC_HIRES, "Basic hires periodic");
|
---|
86 | if (RTTestErrorCount(g_hTest) == 0)
|
---|
87 | {
|
---|
88 | # if 1
|
---|
89 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_RESTART_HIRES, "Restart hires one shot from callback");
|
---|
90 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_DESTROY_HIRES, "Destroy hires one shot from callback");
|
---|
91 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_CSSD_LOOPS_HIRES, "Create-start-stop-destroy loops, hires");
|
---|
92 | for (uint32_t i = 0; i <= 7; i++)
|
---|
93 | RTR3TestR0SimpleTestWithArg(TSTRTR0TIMER_PERIODIC_CHANGE_INTERVAL, i, "Change interval from callback, hires, variation %u", i);
|
---|
94 | # endif
|
---|
95 | RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_SPECIFIC_HIRES, "One shot hires cpu specific");
|
---|
96 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_SPECIFIC_HIRES, "Periodic hires cpu specific");
|
---|
97 | RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_OMNI, "Periodic omni hires timer");
|
---|
98 | }
|
---|
99 | # endif
|
---|
100 |
|
---|
101 | /*
|
---|
102 | * Done.
|
---|
103 | */
|
---|
104 | return RTTestSummaryAndDestroy(g_hTest);
|
---|
105 | #endif
|
---|
106 | }
|
---|
107 |
|
---|