Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers test_runners.h Source File

test_runners.h

00001 /*******************************************************************************
00002  * Copyright 2016-2018 ARM Ltd.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *******************************************************************************/
00016 #ifndef MBED_CLIENT_PAL_TEST_RUNNERS_H_
00017 #define MBED_CLIENT_PAL_TEST_RUNNERS_H_
00018 #include "pal.h"
00019 
00020 #ifndef PAL_TEST_RTOS
00021 #define PAL_TEST_RTOS 0
00022 #endif // PAL_TEST_RTOS
00023 
00024 #ifndef PAL_TEST_ROT
00025 #define PAL_TEST_ROT 0
00026 #endif // PAL_TEST_ROT
00027 
00028 #ifndef PAL_TEST_NETWORK
00029 #define PAL_TEST_NETWORK 0
00030 #endif // PAL_TEST_NETWORK
00031 
00032 #ifndef PAL_TEST_TIME
00033 #define PAL_TEST_TIME 0
00034 #endif // PAL_TEST_TIME
00035 
00036 #ifndef PAL_TEST_TLS
00037 #define PAL_TEST_TLS 0
00038 #endif // PAL_TEST_TLS
00039 
00040 #ifndef PAL_TEST_CRYPTO
00041 #define PAL_TEST_CRYPTO 0
00042 #endif // PAL_TEST_CRYPTO
00043 
00044 #ifndef PAL_TEST_DRBG
00045 #define PAL_TEST_DRBG 0
00046 #endif // PAL_TEST_DRBG
00047 
00048 #ifndef PAL_TEST_FS
00049 #define PAL_TEST_FS 0
00050 #endif // PAL_TEST_FS
00051 
00052 #ifndef PAL_TEST_UPDATE
00053 #define PAL_TEST_UPDATE 0
00054 #endif // PAL_TEST_UPDATE
00055 
00056 #ifndef PAL_TEST_FLASH
00057 #define PAL_TEST_FLASH 1
00058 #endif // PAL_TEST_FLASH
00059 
00060 #ifndef TEST_PRINTF
00061     #define TEST_PRINTF(ARGS...) PAL_PRINTF(ARGS)
00062 #endif //TEST_PRINTF
00063 
00064 #ifdef PAL_LINUX
00065 #define PAL_TEST_THREAD_STACK_SIZE 16*1024*sizeof(uint32_t)
00066 #else
00067 #define PAL_TEST_THREAD_STACK_SIZE 512*sizeof(uint32_t)
00068 #endif
00069 
00070 
00071 #ifdef __cplusplus
00072 extern "C" {
00073 #endif
00074 
00075 typedef struct {
00076     int argc;
00077     char **argv;
00078 } pal_args_t;
00079 
00080 
00081 typedef void (*testMain_t)(pal_args_t *);
00082 int test_main(int argc, char * argv[], testMain_t func);
00083 
00084 #ifdef PAL_MEMORY_STATISTICS
00085 void printMemoryStats(void);
00086 #define PRINT_MEMORY_STATS  printMemoryStats();
00087 #else //PAL_MEMORY_STATISTICS
00088 #define PRINT_MEMORY_STATS
00089 #endif
00090 
00091 
00092 void TEST_pal_rtos_GROUP_RUNNER(void);
00093 
00094 void TEST_pal_rot_GROUP_RUNNER(void);
00095 
00096 void TEST_pal_entropy_GROUP_RUNNER(void);
00097 
00098 void TEST_pal_socket_GROUP_RUNNER(void);
00099 
00100 void TEST_pal_time_GROUP_RUNNER(void);
00101 
00102 void TEST_pal_tls_GROUP_RUNNER(void);
00103 
00104 void TEST_pal_crypto_GROUP_RUNNER(void);
00105 
00106 void TEST_pal_drbg_GROUP_RUNNER(void);
00107 
00108 void TEST_pal_fileSystem_GROUP_RUNNER(void);
00109 
00110 void TEST_pal_update_GROUP_RUNNER(void);
00111 
00112 void TEST_pal_internalFlash_GROUP_RUNNER(void);
00113 
00114 void TEST_pal_sst_GROUP_RUNNER(void);
00115 
00116 void TEST_pal_SOTP_GROUP_RUNNER(void);
00117 
00118 void TEST_pal_sanity_GROUP_RUNNER(void);
00119 
00120 
00121 typedef struct _palTestsStatusData_t
00122 {
00123     int module;
00124     int test;
00125     int inner;
00126     unsigned long long  numberOfTests;
00127     unsigned long long  numOfTestsFailures;
00128     unsigned long long  numberOfIgnoredTests;
00129 }palTestsStatusData_t;
00130 
00131 
00132 typedef enum _palTestModules_t
00133 {
00134     PAL_TEST_MODULE_START,
00135     PAL_TEST_MODULE_RTOS = PAL_TEST_MODULE_START,
00136     PAL_TEST_MODULE_ROT,
00137     PAL_TEST_MODULE_ENTROPY,
00138     PAL_TEST_MODULE_SOCKET,
00139     PAL_TEST_MODULE_TIME,
00140     PAL_TEST_MODULE_TLS,
00141     PAL_TEST_MODULE_CRYPTO,
00142     PAL_TEST_MODULE_DRBG,
00143     PAL_TEST_MODULE_FILESYSTEM,
00144     PAL_TEST_MODULE_UPDATE,
00145     PAL_TEST_MODULE_INTERNALFLASH,
00146     PAL_TEST_MODULE_SST,
00147     PAL_TEST_MODULE_SOTP,
00148     PAL_TEST_MODULE_SANITY,
00149     PAL_TEST_MODULE_ALL,
00150     PAL_TEST_MODULE_END
00151 }palTestModules_t;
00152 
00153 // bitmask of prequisite platform component initializations needed for test.
00154 typedef enum _palTestPlatformInit_t
00155 {
00156     // mcc_platform_init
00157     PAL_TEST_PLATFORM_INIT_BASE = 1,
00158 
00159     // mcc_platform_init_connection
00160     PAL_TEST_PLATFORM_INIT_CONNECTION = (1<<1),
00161 
00162     // mcc_platform_storage_init
00163     PAL_TEST_PLATFORM_INIT_STORAGE = (1<<2),
00164 
00165     // mcc_platform_reformat_storage
00166     PAL_TEST_PLATFORM_INIT_REFORMAT_STORAGE =  (1<<3)
00167 } palTestPlatformInit_t;
00168 
00169 
00170 // Entry points for the module specific test suites. This code is executed either from
00171 // module-specific runner executables (eg. Test/TESTS/Unitest/RTOS/pal_rtos_test_main.c), which
00172 // contain the main() function or directly from some other executable.
00173 // Not all OS's even support main(), or it may already be in use by OS itself,
00174 // so a platform specific runner may be needed for each test.
00175 // Especially during the porting phase, it may be also convenient to call these from
00176 // the test application itself so only the currently ported component is tested.
00177 int palAllTestMain(void); // this will execute tests for all the other modules below
00178 int palFileSystemTestMain(void);
00179 int palNetworkTestMain(void);
00180 int palCryptoTestMain(void);
00181 int palDRBGTestMain(void);
00182 int palROTTestMain(void);
00183 int palEntropyTestMain(void);
00184 int palRTOSTestMain(void);
00185 int palStorageTestMain(void);
00186 int palTimeTestMain(void);
00187 int palSSTTestMain(void);
00188 int palTLSTestMain(void);
00189 int palUpdateTestMain(void);
00190 int palSOTPTestMain(void);
00191 int palSanityTestMain(void);
00192 int palReformatTestMain(void);
00193 
00194 typedef enum _palTestSOTPTests_t
00195 {
00196     PAL_TEST_SOTP_TEST_START,
00197     PAL_TEST_SOTP_TEST_SW_HW_ROT = PAL_TEST_SOTP_TEST_START,
00198     PAL_TEST_SOTP_TEST_TIME_INIT,
00199     PAL_TEST_SOTP_TEST_RANDOM,
00200     PAL_TEST_SOTP_TEST_END
00201 }palTestSOTPTests_t;
00202 
00203 palStatus_t setPalTestStatus(palTestsStatusData_t palRebootTestStatus);
00204 
00205 palStatus_t getPalTestStatus(void);
00206 
00207 palStatus_t palTestReboot(palTestModules_t module ,palTestSOTPTests_t test );
00208 
00209 void updatePalTestStatusAfterReboot(void);
00210 
00211 #ifdef __cplusplus
00212 }
00213 #endif
00214 
00215 #endif /* MBED_CLIENT_PAL_TEST_RUNNERS_H_ */