1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
3 Copyright (c) 2014-2015 Datalight, Inc.
4 All Rights Reserved Worldwide.
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.
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.
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.
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
26 @brief Prototypes for Reliance Edge test entry points.
32 #include "redtestutils.h"
35 /* This macro is only defined by the error injection project.
37 #ifdef REDCONF_ERROR_INJECTION
38 #include <rederrinject.h>
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))
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))
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))
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))
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_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))
71 #define FSIOTEST_SUPPORTED \
72 ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
73 && (REDCONF_OUTPUT == 1) && (REDCONF_API_POSIX == 1))
75 #define BDEVTEST_SUPPORTED \
76 ( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
77 && (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0))
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))
87 PARAMSTATUS_OK, /* Parameters were good; continue. */
88 PARAMSTATUS_BAD, /* Parameters were bad; stop. */
89 PARAMSTATUS_HELP /* Help request; not an error, but stop. */
93 #if FSSTRESS_SUPPORTED
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 */
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);
109 #if STOCH_POSIX_TEST_SUPPORTED
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 */
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);
126 #if FSE_STRESS_TEST_SUPPORTED
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 */
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);
144 #if POSIX_API_TEST_SUPPORTED
147 const char *pszVolume; /**< Volume path prefix. */
148 bool fQuick; /**< --quick */
149 bool fQuitOnFailure; /**< --quit-on-failure */
150 bool fDebugErrors; /**< --debug */
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);
159 #if POSIX_API_TEST_SUPPORTED
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 */
169 PARAMSTATUS RedOsApiTestParseParams(int argc, char *argv[], OSAPITESTPARAM *pParam, const char **ppszDevice);
170 void RedOsApiTestDefaultParams(OSAPITESTPARAM *pParam);
171 int RedOsApiTestStart(const OSAPITESTPARAM *pParam);
175 #if FSE_API_TEST_SUPPORTED
178 uint8_t bVolNum; /**< Volume number. */
179 bool fQuitOnFailure; /**< --quit-on-failure */
180 bool fDebugErrors; /**< --debug */
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);
188 #if FSIOTEST_SUPPORTED
191 TESTFS_RELEDGE, /* Datalight Reliance Edge */
192 TESTFS_FATFS, /* ChaN's FatFs */
193 TESTFS_FATSL /* FreeRTOS+FAT SL */
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 */
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);
226 #if BDEVTEST_SUPPORTED
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 */
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);
250 #if DISKFULL_TEST_SUPPORTED
253 const char *pszVolume; /**< Volume path prefix. */
254 bool fQuitOnFailure; /**< --quit-on-failure */
255 bool fDebugErrors; /**< --debug */
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);