VirtualBox

source: vbox/trunk/src/VBox/Devices/testcase/tstDevicePlugin.h@ 69162

Last change on this file since 69162 was 69162, checked in by vboxsync, 7 years ago

Devices/testcase: Skeleton for PDM device unit test framework, disabled by default (for backup purposes and to move more easily between hosts)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/** @file
2 * tstDevice: Plugin API.
3 */
4
5/*
6 * Copyright (C) 2017 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___tstDevicePlugin_h
27#define ___tstDevicePlugin_h
28
29#include <VBox/types.h>
30
31/**
32 * Config item type.
33 */
34typedef enum TSTDEVCFGITEMTYPE
35{
36 /** Invalid type. */
37 TSTDEVCFGITEMTYPE_INVALID = 0,
38 /** String type. */
39 TSTDEVCFGITEMTYPE_STRING,
40 /** Integer value encoded in the string. */
41 TSTDEVCFGITEMTYPE_INTEGER,
42 /** Raw bytes. */
43 TSTDEVCFGITEMTYPE_BYTES,
44 /** 32bit hack. */
45 TSTDEVCFGITEMTYPE_32BIT_HACK = 0x7fffffff
46} TSTDEVCFGITEMTYPE;
47/** Pointer to a config item type. */
48typedef TSTDEVCFGITEMTYPE *PTSTDEVCFGITEMTYPE;
49
50
51/**
52 * Testcase config item.
53 */
54typedef struct TSTDEVCFGITEM
55{
56 /** The key of the item. */
57 const char *pszKey;
58 /** Type of the config item. */
59 TSTDEVCFGITEMTYPE enmType;
60 /** The value of the item (as a string/number of bytes to make static
61 * instantiation easier). */
62 const char *pszVal;
63} TSTDEVCFGITEM;
64/** Pointer to a testcase config item. */
65typedef TSTDEVCFGITEM *PTSTDEVCFGITEM;
66/** Pointer to a constant testcase config item. */
67typedef const TSTDEVCFGITEM *PCTSTDEVCFGITEM;
68
69
70/** Device under test handle. */
71typedef struct TSTDEVDUTINT *TSTDEVDUT;
72
73/**
74 * Testcase registration structure.
75 */
76typedef struct TSTDEVTESTCASEREG
77{
78 /** Testcase name. */
79 char szName[16];
80 /** Testcase description. */
81 const char *pszDesc;
82 /** The device name the testcase handles. */
83 char szDevName[16];
84 /** Flags for this testcase. */
85 uint32_t fFlags;
86 /** CFGM configuration for the device to be instantiated. */
87 PCTSTDEVCFGITEM paDevCfg;
88
89 /**
90 * Testcase entry point.
91 *
92 * @returns VBox status code.
93 * @param hDut Handle of the device under test.
94 */
95 DECLR3CALLBACKMEMBER(int, pfnTestEntry, (TSTDEVDUT hDut));
96} TSTDEVTESTCASEREG;
97/** Pointer to a testcase registration structure. */
98typedef TSTDEVTESTCASEREG *PTSTDEVTESTCASEREG;
99/** Pointer to a constant testcase registration structure. */
100typedef const TSTDEVTESTCASEREG *PCTSTDEVTESTCASEREG;
101
102
103/**
104 * Testcase register callbacks structure.
105 */
106typedef struct TSTDEVPLUGINREGISTER
107{
108 /**
109 * Registers a new testcase.
110 *
111 * @returns VBox status code.
112 * @param pvUser Opaque user data given in the plugin load callback.
113 * @param pTestcaseReg The testcase descriptor to register.
114 */
115 DECLR3CALLBACKMEMBER(int, pfnRegisterTestcase, (void *pvUser, PCTSTDEVTESTCASEREG pTestcaseReg));
116
117} TSTDEVPLUGINREGISTER;
118/** Pointer to a backend register callbacks structure. */
119typedef TSTDEVPLUGINREGISTER *PTSTDEVPLUGINREGISTER;
120
121
122/**
123 * Initialization entry point called by the device test framework when
124 * a plugin is loaded.
125 *
126 * @returns VBox status code.
127 * @param pvUser Opaque user data passed in the register callbacks.
128 * @param pRegisterCallbacks Pointer to the register callbacks structure.
129 */
130typedef DECLCALLBACK(int) FNTSTDEVPLUGINLOAD(void *pvUser, PTSTDEVPLUGINREGISTER pRegisterCallbacks);
131typedef FNTSTDEVPLUGINLOAD *PFNTSTDEVPLUGINLOAD;
132#define TSTDEV_PLUGIN_LOAD_NAME "TSTDevPluginLoad"
133
134#endif
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