VirtualBox

source: vbox/trunk/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp@ 95259

Last change on this file since 95259 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1/* $Id: tstRTR0TimerDriver.cpp 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * IPRT R0 Testcase - Timers, driver program.
4 */
5
6/*
7 * Copyright (C) 2009-2022 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/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#include <iprt/initterm.h>
32
33#include <iprt/errcore.h>
34#include <iprt/path.h>
35#include <iprt/param.h>
36#include <iprt/stream.h>
37#include <iprt/string.h>
38#include <iprt/test.h>
39#include <iprt/thread.h>
40#ifdef VBOX
41# include <VBox/sup.h>
42# include "tstRTR0Timer.h"
43#endif
44#include "tstRTR0CommonDriver.h"
45
46
47/**
48 * Entry point.
49 */
50extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
51{
52#ifndef VBOX
53 RT_NOREF3(argc, argv, envp);
54 RTPrintf("tstRTR0Timer: SKIPPED\n");
55 return RTEXITCODE_SKIPPED;
56
57#else
58 RT_NOREF1(envp);
59
60 /*
61 * Init.
62 */
63 RTEXITCODE rcExit = RTR3TestR0CommonDriverInit("tstRTR0Timer");
64 if (rcExit != RTEXITCODE_SUCCESS)
65 return rcExit;
66
67 if (argc == 2 && !strcmp(argv[1], "latency"))
68 {
69 RTR3TestR0SimpleTest(TSTRTR0TIMER_LATENCY_OMNI, "Latency omni timer");
70 RTR3TestR0SimpleTest(TSTRTR0TIMER_LATENCY_OMNI_HIRES, "Latency omni hires timer");
71 }
72 else
73 {
74# if 1
75 /*
76 * Standard timers.
77 */
78 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_BASIC, "Basic one shot");
79 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_BASIC, "Basic periodic");
80 if (RTTestErrorCount(g_hTest) == 0)
81 {
82 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_RESOLUTION, "One shot resolution");
83# if 1
84 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_RESTART, "Restart one shot from callback");
85 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_DESTROY, "Destroy one shot from callback");
86 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_CSSD_LOOPS, "Create-start-stop-destroy loops");
87 for (uint32_t i = 0; i <= 7; i++)
88 RTR3TestR0SimpleTestWithArg(TSTRTR0TIMER_PERIODIC_CHANGE_INTERVAL, i, "Change interval from callback, variation %u", i);
89# endif
90 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_SPECIFIC, "One shot cpu specific");
91 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_SPECIFIC, "Periodic cpu specific");
92 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_OMNI, "Periodic omni timer");
93 }
94# endif
95
96# if 1
97 /*
98 * High resolution timers.
99 */
100 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_BASIC_HIRES, "Basic hires one shot");
101 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_BASIC_HIRES, "Basic hires periodic");
102 if (RTTestErrorCount(g_hTest) == 0)
103 {
104 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_RESOLUTION_HIRES, "One shot hires resolution");
105# if 1
106 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_RESTART_HIRES, "Restart hires one shot from callback");
107 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_DESTROY_HIRES, "Destroy hires one shot from callback");
108 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_CSSD_LOOPS_HIRES, "Create-start-stop-destroy loops, hires");
109 for (uint32_t i = 0; i <= 7; i++)
110 RTR3TestR0SimpleTestWithArg(TSTRTR0TIMER_PERIODIC_CHANGE_INTERVAL, i, "Change interval from callback, hires, variation %u", i);
111# endif
112 RTR3TestR0SimpleTest(TSTRTR0TIMER_ONE_SHOT_SPECIFIC_HIRES, "One shot hires cpu specific");
113 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_SPECIFIC_HIRES, "Periodic hires cpu specific");
114 RTR3TestR0SimpleTest(TSTRTR0TIMER_PERIODIC_OMNI_HIRES, "Periodic omni hires timer");
115 }
116# endif
117 }
118
119 /*
120 * Done.
121 */
122 return RTTestSummaryAndDestroy(g_hTest);
123#endif
124}
125
126
127#if !defined(VBOX_WITH_HARDENING) || !defined(RT_OS_WINDOWS)
128/**
129 * Main entry point.
130 */
131int main(int argc, char **argv, char **envp)
132{
133 return TrustedMain(argc, argv, envp);
134}
135#endif
136
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