@@ -52,6 +52,11 @@ static void cutest_porting_srand(unsigned long s)
52
52
s_test_rand_seed = s ;
53
53
}
54
54
55
+ static unsigned long cutest_porting_grand (void )
56
+ {
57
+ return s_test_rand_seed ;
58
+ }
59
+
55
60
static unsigned long cutest_porting_rand (void )
56
61
{
57
62
s_test_rand_seed = 1103515245UL * s_test_rand_seed + 12345 ;
@@ -1784,8 +1789,6 @@ typedef struct test_ctx
1784
1789
unsigned shuffle : 1 ; /**< Randomize running cases */
1785
1790
} mask ;
1786
1791
1787
- unsigned long shuffle_seed ;
1788
-
1789
1792
struct
1790
1793
{
1791
1794
cutest_porting_jmpbuf_t * addr ; /**< Jump address. */
@@ -1847,7 +1850,6 @@ static test_ctx_t g_test_ctx = {
1847
1850
{ { 0 , 0 , 0 , 0 , 0 }, { 0 , 0 } }, /* .counter */
1848
1851
{ { NULL , 0 } }, /* .filter */
1849
1852
{ 0 , 0 , 0 , 0 }, /* .mask */
1850
- 0 , /* .shuffle_seed */
1851
1853
{ NULL , NULL }, /* .jmp */
1852
1854
NULL , /* .out */
1853
1855
NULL , /* .hook */
@@ -2757,8 +2759,6 @@ static int _cutest_setup_arg_print_time(const char* str)
2757
2759
static void _cutest_srand (unsigned long s )
2758
2760
{
2759
2761
s = s % (MAX_RAND + 1 );
2760
-
2761
- g_test_ctx .shuffle_seed = s ;
2762
2762
cutest_porting_srand (s );
2763
2763
}
2764
2764
@@ -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
@@ -3255,7 +3246,7 @@ static void _cutest_show_information(void)
3255
3246
cutest_porting_fprintf (g_test_ctx .out ,
3256
3247
"[ $PARAME. ] --test_shuffle=%d\n" , (int )g_test_ctx .mask .shuffle );
3257
3248
cutest_porting_fprintf (g_test_ctx .out ,
3258
- "[ $PARAME. ] --test_random_seed=%lu\n" , g_test_ctx . shuffle_seed );
3249
+ "[ $PARAME. ] --test_random_seed=%lu\n" , cutest_porting_grand () );
3259
3250
cutest_porting_fprintf (g_test_ctx .out ,
3260
3251
"[ $PARAME. ] --test_also_run_disabled_tests=%d\n" , (int )g_test_ctx .mask .also_run_disabled_tests );
3261
3252
cutest_porting_fprintf (g_test_ctx .out ,
0 commit comments