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