1 | /** @file
|
---|
2 | * tstDevice: Plugin API.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2017-2020 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 |
|
---|
17 | #ifndef VBOX_INCLUDED_SRC_testcase_tstDevicePlugin_h
|
---|
18 | #define VBOX_INCLUDED_SRC_testcase_tstDevicePlugin_h
|
---|
19 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
20 | # pragma once
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #include <VBox/types.h>
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Config item type.
|
---|
27 | */
|
---|
28 | typedef enum TSTDEVCFGITEMTYPE
|
---|
29 | {
|
---|
30 | /** Invalid type. */
|
---|
31 | TSTDEVCFGITEMTYPE_INVALID = 0,
|
---|
32 | /** String type. */
|
---|
33 | TSTDEVCFGITEMTYPE_STRING,
|
---|
34 | /** Integer value encoded in the string. */
|
---|
35 | TSTDEVCFGITEMTYPE_INTEGER,
|
---|
36 | /** Raw bytes. */
|
---|
37 | TSTDEVCFGITEMTYPE_BYTES,
|
---|
38 | /** 32bit hack. */
|
---|
39 | TSTDEVCFGITEMTYPE_32BIT_HACK = 0x7fffffff
|
---|
40 | } TSTDEVCFGITEMTYPE;
|
---|
41 | /** Pointer to a config item type. */
|
---|
42 | typedef TSTDEVCFGITEMTYPE *PTSTDEVCFGITEMTYPE;
|
---|
43 |
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Testcase config item.
|
---|
47 | */
|
---|
48 | typedef struct TSTDEVCFGITEM
|
---|
49 | {
|
---|
50 | /** The key of the item. */
|
---|
51 | const char *pszKey;
|
---|
52 | /** Type of the config item. */
|
---|
53 | TSTDEVCFGITEMTYPE enmType;
|
---|
54 | /** The value of the item (as a string/number of bytes to make static
|
---|
55 | * instantiation easier). */
|
---|
56 | const char *pszVal;
|
---|
57 | } TSTDEVCFGITEM;
|
---|
58 | /** Pointer to a testcase config item. */
|
---|
59 | typedef TSTDEVCFGITEM *PTSTDEVCFGITEM;
|
---|
60 | /** Pointer to a constant testcase config item. */
|
---|
61 | typedef const TSTDEVCFGITEM *PCTSTDEVCFGITEM;
|
---|
62 |
|
---|
63 |
|
---|
64 | /** Device under test handle. */
|
---|
65 | typedef struct TSTDEVDUTINT *TSTDEVDUT;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Testcase registration structure.
|
---|
69 | */
|
---|
70 | typedef struct TSTDEVTESTCASEREG
|
---|
71 | {
|
---|
72 | /** Testcase name. */
|
---|
73 | char szName[16];
|
---|
74 | /** Testcase description. */
|
---|
75 | const char *pszDesc;
|
---|
76 | /** The device name the testcase handles. */
|
---|
77 | char szDevName[16];
|
---|
78 | /** Flags for this testcase. */
|
---|
79 | uint32_t fFlags;
|
---|
80 | /** CFGM configuration for the device to be instantiated. */
|
---|
81 | PCTSTDEVCFGITEM paDevCfg;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Testcase entry point.
|
---|
85 | *
|
---|
86 | * @returns VBox status code.
|
---|
87 | * @param hDut Handle of the device under test.
|
---|
88 | */
|
---|
89 | DECLR3CALLBACKMEMBER(int, pfnTestEntry, (TSTDEVDUT hDut));
|
---|
90 | } TSTDEVTESTCASEREG;
|
---|
91 | /** Pointer to a testcase registration structure. */
|
---|
92 | typedef TSTDEVTESTCASEREG *PTSTDEVTESTCASEREG;
|
---|
93 | /** Pointer to a constant testcase registration structure. */
|
---|
94 | typedef const TSTDEVTESTCASEREG *PCTSTDEVTESTCASEREG;
|
---|
95 |
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Testcase register callbacks structure.
|
---|
99 | */
|
---|
100 | typedef struct TSTDEVPLUGINREGISTER
|
---|
101 | {
|
---|
102 | /**
|
---|
103 | * Registers a new testcase.
|
---|
104 | *
|
---|
105 | * @returns VBox status code.
|
---|
106 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
107 | * @param pTestcaseReg The testcase descriptor to register.
|
---|
108 | */
|
---|
109 | DECLR3CALLBACKMEMBER(int, pfnRegisterTestcase, (void *pvUser, PCTSTDEVTESTCASEREG pTestcaseReg));
|
---|
110 |
|
---|
111 | } TSTDEVPLUGINREGISTER;
|
---|
112 | /** Pointer to a backend register callbacks structure. */
|
---|
113 | typedef TSTDEVPLUGINREGISTER *PTSTDEVPLUGINREGISTER;
|
---|
114 |
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * Initialization entry point called by the device test framework when
|
---|
118 | * a plugin is loaded.
|
---|
119 | *
|
---|
120 | * @returns VBox status code.
|
---|
121 | * @param pvUser Opaque user data passed in the register callbacks.
|
---|
122 | * @param pRegisterCallbacks Pointer to the register callbacks structure.
|
---|
123 | */
|
---|
124 | typedef DECLCALLBACK(int) FNTSTDEVPLUGINLOAD(void *pvUser, PTSTDEVPLUGINREGISTER pRegisterCallbacks);
|
---|
125 | typedef FNTSTDEVPLUGINLOAD *PFNTSTDEVPLUGINLOAD;
|
---|
126 | #define TSTDEV_PLUGIN_LOAD_NAME "TSTDevPluginLoad"
|
---|
127 |
|
---|
128 | #endif /* !VBOX_INCLUDED_SRC_testcase_tstDevicePlugin_h */
|
---|