@@ -3081,15 +3081,14 @@ static void _cutest_setup_once(void)
3081
3081
{
3082
3082
token = 1 ;
3083
3083
_cutest_setup_type ();
3084
- _cutest_srand (1 );
3085
3084
}
3086
3085
}
3087
3086
3088
3087
static void _cutest_prepare (void )
3089
3088
{
3090
3089
cutest_porting_timespec_t seed ;
3091
3090
cutest_porting_clock_gettime (& seed );
3092
- cutest_porting_srand ((unsigned long )seed .tv_sec );
3091
+ _cutest_srand ((unsigned long )seed .tv_sec );
3093
3092
3094
3093
g_test_ctx .runtime .tid = cutest_porting_gettid ();
3095
3094
g_test_ctx .counter .repeat .repeat = 1 ;
@@ -3131,6 +3130,15 @@ static int _cutest_setup_arg_break_on_failure(void)
3131
3130
return 0 ;
3132
3131
}
3133
3132
3133
+ static void _cutest_cleanup (void )
3134
+ {
3135
+ cutest_map_t case_table = g_test_ctx .case_table ;
3136
+ cutest_map_t type_table = g_test_ctx .type_table ;
3137
+ cutest_porting_memset (& g_test_ctx , 0 , sizeof (g_test_ctx ));
3138
+ g_test_ctx .case_table = case_table ;
3139
+ g_test_ctx .type_table = type_table ;
3140
+ }
3141
+
3134
3142
/**
3135
3143
* @brief Setup test context
3136
3144
* @param[in] argc The number of command line argument.
@@ -3170,16 +3178,9 @@ static int _cutest_setup(int argc, char* argv[], FILE* out, const cutest_hook_t*
3170
3178
continue;\
3171
3179
} while (0)
3172
3180
3173
- /* Do soft clear. */
3174
- {
3175
- cutest_map_t case_table = g_test_ctx .case_table ;
3176
- cutest_map_t type_table = g_test_ctx .type_table ;
3177
- cutest_porting_memset (& g_test_ctx , 0 , sizeof (g_test_ctx ));
3178
- g_test_ctx .case_table = case_table ;
3179
- g_test_ctx .type_table = type_table ;
3180
- }
3181
-
3182
3181
_cutest_setup_once ();
3182
+
3183
+ _cutest_cleanup ();
3183
3184
_cutest_prepare ();
3184
3185
3185
3186
g_test_ctx .out = out ;
@@ -3233,16 +3234,6 @@ static void _cutest_run_all_test_once(void)
3233
3234
_cutest_show_report (& tv_total_start , & tv_total_end );
3234
3235
}
3235
3236
3236
- static void _cutest_cleanup (void )
3237
- {
3238
- cutest_porting_memset (& g_test_ctx .runtime , 0 , sizeof (g_test_ctx .runtime ));
3239
- cutest_porting_memset (& g_test_ctx .counter , 0 , sizeof (g_test_ctx .counter ));
3240
- cutest_porting_memset (& g_test_ctx .mask , 0 , sizeof (g_test_ctx .mask ));
3241
- cutest_porting_memset (& g_test_ctx .filter , 0 , sizeof (g_test_ctx .filter ));
3242
-
3243
- g_test_ctx .hook = NULL ;
3244
- }
3245
-
3246
3237
static void _cutest_show_information (void )
3247
3238
{
3248
3239
#if CUTEST_VERSION_PREREL
0 commit comments