]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/Reliance-Edge/include/redtests.h
Update version of Reliance Edge.
[freertos] / FreeRTOS-Plus / Source / Reliance-Edge / include / redtests.h
1 /*             ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
2
3                    Copyright (c) 2014-2015 Datalight, Inc.
4                        All Rights Reserved Worldwide.
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; use version 2 of the License.
9
10     This program is distributed in the hope that it will be useful,
11     but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
12     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License along
16     with this program; if not, write to the Free Software Foundation, Inc.,
17     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 /*  Businesses and individuals that for commercial or other reasons cannot
20     comply with the terms of the GPLv2 license may obtain a commercial license
21     before incorporating Reliance Edge into proprietary software for
22     distribution in any form.  Visit http://www.datalight.com/reliance-edge for
23     more information.
24 */
25 /** @file
26     @brief Prototypes for Reliance Edge test entry points.
27 */
28 #ifndef REDTESTS_H
29 #define REDTESTS_H
30
31 #include <redtypes.h>
32 #include "redtestutils.h"
33 #include "redver.h"
34
35 /*  This macro is only defined by the error injection project.
36 */
37 #ifdef REDCONF_ERROR_INJECTION
38 #include <rederrinject.h>
39 #endif
40
41 #define FSSTRESS_SUPPORTED  \
42     (    ((RED_KIT == RED_KIT_GPL) || (RED_KIT == RED_KIT_SANDBOX)) \
43       && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_PATH_SEPARATOR == '/') \
44       && (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_UNLINK == 1) && (REDCONF_API_POSIX_MKDIR == 1) \
45       && (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_RENAME == 1) && (REDCONF_API_POSIX_LINK == 1) \
46       && (REDCONF_API_POSIX_FTRUNCATE == 1) && (REDCONF_API_POSIX_READDIR == 1))
47
48 #define FSE_STRESS_TEST_SUPPORTED \
49     (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
50       && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \
51       && (REDCONF_API_FSE_FORMAT == 1) && (REDCONF_API_FSE_TRANSMASKSET == 1) && (REDCONF_API_FSE_TRANSMASKGET == 1) \
52       && (REDCONF_API_FSE_TRUNCATE == 1))
53
54 #define POSIX_API_TEST_SUPPORTED \
55     (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
56       && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
57       && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_UNLINK == 1))
58
59 #define FSE_API_TEST_SUPPORTED \
60    (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
61       && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \
62       && (REDCONF_API_FSE_FORMAT == 1))
63
64 #define STOCH_POSIX_TEST_SUPPORTED \
65     (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
66       && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
67       && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_READDIR == 1) \
68       && (REDCONF_API_POSIX_MKDIR == 1) && (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_UNLINK == 1) \
69       && (REDCONF_API_POSIX_RENAME == 1))
70
71 #define FSIOTEST_SUPPORTED \
72     (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
73       && (REDCONF_OUTPUT == 1) && (REDCONF_API_POSIX == 1))
74
75 #define BDEVTEST_SUPPORTED \
76     (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
77       && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0))
78
79 #define DISKFULL_TEST_SUPPORTED \
80    (    ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
81      && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
82      && (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_FTRUNCATE == 1))
83
84
85 typedef enum
86 {
87     PARAMSTATUS_OK,     /* Parameters were good; continue. */
88     PARAMSTATUS_BAD,    /* Parameters were bad; stop. */
89     PARAMSTATUS_HELP    /* Help request; not an error, but stop. */
90 } PARAMSTATUS;
91
92
93 #if FSSTRESS_SUPPORTED
94 typedef struct
95 {
96     bool        fNoCleanup; /**< --no-cleanup */
97     uint32_t    ulLoops;    /**< --loops */
98     uint32_t    ulNops;     /**< --nops */
99     bool        fNamePad;   /**< --namepad */
100     uint32_t    ulSeed;     /**< --seed */
101     bool        fVerbose;   /**< --verbose */
102 } FSSTRESSPARAM;
103
104 PARAMSTATUS FsstressParseParams(int argc, char *argv[], FSSTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
105 void FsstressDefaultParams(FSSTRESSPARAM *pParam);
106 int FsstressStart(const FSSTRESSPARAM *pParam);
107 #endif
108
109 #if STOCH_POSIX_TEST_SUPPORTED
110 typedef struct
111 {
112     const char *pszVolume;          /**< Volume path prefix. */
113     uint32_t    ulIterations;       /**< --iterations */
114     uint32_t    ulFileListMax;      /**< --files */
115     uint32_t    ulDirListMax;       /**< --dirs */
116     uint32_t    ulOpenFileListMax;  /**< --open-files */
117     uint32_t    ulOpenDirListMax;   /**< --open-dirs */
118     uint32_t    ulRandomSeed;       /**< --seed */
119 } STOCHPOSIXPARAM;
120
121 PARAMSTATUS RedStochPosixParseParams(int argc, char *argv[], STOCHPOSIXPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
122 void RedStochPosixDefaultParams(STOCHPOSIXPARAM *pParam);
123 int RedStochPosixStart(const STOCHPOSIXPARAM *pParam);
124 #endif
125
126 #if FSE_STRESS_TEST_SUPPORTED
127 typedef struct
128 {
129     uint8_t     bVolNum;        /**< Volume number. */
130     uint32_t    ulFileCount;    /**< --files */
131     uint32_t    ulMaxFileSize;  /**< --max */
132     uint32_t    ulMaxOpSize;    /**< --buffer-size */
133     uint32_t    ulNops;         /**< --nops */
134     uint32_t    ulLoops;        /**< --loops */
135     uint32_t    ulSampleRate;   /**< --sample-rate */
136     uint64_t    ullSeed;        /**< --seed */
137 } FSESTRESSPARAM;
138
139 PARAMSTATUS FseStressParseParams(int argc, char *argv[], FSESTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
140 void FseStressDefaultParams(FSESTRESSPARAM *pParam);
141 int FseStressStart(const FSESTRESSPARAM *pParam);
142 #endif
143
144 #if POSIX_API_TEST_SUPPORTED
145 typedef struct
146 {
147     const char *pszVolume;      /**< Volume path prefix. */
148     bool        fQuick;         /**< --quick */
149     bool        fQuitOnFailure; /**< --quit-on-failure */
150     bool        fDebugErrors;   /**< --debug */
151 } POSIXTESTPARAM;
152
153 PARAMSTATUS RedPosixTestParseParams(int argc, char *argv[], POSIXTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
154 void RedPosixTestDefaultParams(POSIXTESTPARAM *pParam);
155 int RedPosixTestStart(const POSIXTESTPARAM *pParam);
156 #endif
157
158
159 #if POSIX_API_TEST_SUPPORTED
160 typedef struct
161 {
162     const char *pszVolume;      /**< Volume path prefix. */
163     bool        fQuick;         /**< --quick */
164     bool        fVerbose;       /**< --verbose */
165     bool        fQuitOnFailure; /**< --quit-on-failure */
166     bool        fDebugErrors;   /**< --debug */
167 } OSAPITESTPARAM;
168
169 PARAMSTATUS RedOsApiTestParseParams(int argc, char *argv[], OSAPITESTPARAM *pParam, const char **ppszDevice);
170 void RedOsApiTestDefaultParams(OSAPITESTPARAM *pParam);
171 int RedOsApiTestStart(const OSAPITESTPARAM *pParam);
172 #endif
173
174
175 #if FSE_API_TEST_SUPPORTED
176 typedef struct
177 {
178     uint8_t bVolNum;        /**< Volume number. */
179     bool    fQuitOnFailure; /**< --quit-on-failure */
180     bool    fDebugErrors;   /**< --debug */
181 } FSETESTPARAM;
182
183 PARAMSTATUS RedFseTestParseParams(int argc, char *argv[], FSETESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
184 void RedFseTestDefaultParams(FSETESTPARAM *pParam);
185 int RedFseTestStart(const FSETESTPARAM *pParam);
186 #endif
187
188 #if FSIOTEST_SUPPORTED
189 typedef enum
190 {
191     TESTFS_RELEDGE, /* Datalight Reliance Edge */
192     TESTFS_FATFS,   /* ChaN's FatFs */
193     TESTFS_FATSL    /* FreeRTOS+FAT SL */
194 } TESTFS;
195
196 typedef struct
197 {
198     TESTFS      testfs;                 /**< --fs */
199     const char *pszVolume;              /**< Volume path prefix. */
200     bool        fSeqRead;               /**< --seq=r */
201     bool        fSeqWrite;              /**< --seq=w */
202     bool        fSeqRewrite;            /**< --seq=e */
203     bool        fRandomRead;            /**< --rand=r */
204     bool        fRandomWrite;           /**< --rand=w */
205     bool        fMixedWrite;            /**< --mixed */
206     bool        fScanTest;              /**< --scan */
207     uint32_t    ulFSBlockSize;          /**< --block-size */
208     uint32_t    ulMaxFileSize;          /**< --max */
209     uint32_t    ulRandomReadPasses;     /**< --rand-pass=r:w (r part) */
210     uint32_t    ulRandomWritePasses;    /**< --rand-pass=r:w (w part) */
211     uint32_t    ulMixedWritePasses;     /**< --mixed-pass */
212     int32_t     iFlushOnWriteRatio;     /**< --rand-fow */
213     uint32_t    ulBufferMin;            /**< --start */
214     uint32_t    ulBufferSize;           /**< --buffer-size */
215     bool        fWriteVerify;           /**< --verify */
216     uint32_t    ulSampleRate;           /**< --sample-rate */
217     uint32_t    ulScanCount;            /**< --scan-files */
218     uint64_t    ullSeed;                /**< --seed */
219 } FSIOTESTPARAM;
220
221 PARAMSTATUS FSIOTestParseParams(int argc, char *argv[], FSIOTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
222 void FSIOTestDefaultParams(FSIOTESTPARAM *pParam);
223 int FSIOTestStart(const FSIOTESTPARAM *pParam);
224 #endif
225
226 #if BDEVTEST_SUPPORTED
227 typedef struct
228 {
229     uint8_t     bDrvNum;        /**< Volume number (for sector size/count). */
230     bool        fSeqWrite;      /**< --seq:w */
231     bool        fSeqRead;       /**< --seq:r */
232     bool        fRandWrite;     /**< --rand:w */
233     bool        fRandRead;      /**< --rand:r */
234     uint32_t    ulSampleSecs;   /**< --sample-rate */
235     uint32_t    ulPasses;       /**< --passes */
236     uint32_t    ulMinIOSectors; /**< --count=min[:max] (min part) */
237     uint32_t    ulMaxIOSectors; /**< --count=min[:max] (max part) */
238     uint32_t    ulMaxSizeKB;    /**< --max */
239     uint32_t    ulTestSeconds;  /**< --time */
240     bool        fVerify;        /**< --verify */
241     bool        fAsyncWrites;   /**< --async */
242     uint64_t    ullSeed;        /**< --seed */
243 } BDEVTESTPARAM;
244
245 PARAMSTATUS BDevTestParseParams(int argc, char *argv[], BDEVTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
246 void BDevTestDefaultParams(BDEVTESTPARAM *pParam);
247 int BDevTestStart(const BDEVTESTPARAM *pParam);
248 #endif
249
250 #if DISKFULL_TEST_SUPPORTED
251 typedef struct
252 {
253     const char *pszVolume;      /**< Volume path prefix. */
254     bool        fQuitOnFailure; /**< --quit-on-failure */
255     bool        fDebugErrors;   /**< --debug */
256 } DISKFULLTESTPARAM;
257
258 PARAMSTATUS DiskFullTestParseParams(int argc, char *argv[], DISKFULLTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
259 void DiskFullTestDefaultParams(DISKFULLTESTPARAM *pParam);
260 int DiskFullTestStart(const DISKFULLTESTPARAM *pParam);
261 #endif
262
263
264 #endif
265