diff --git a/test/tap/tests/kill_connection3-t.cpp b/test/tap/tests/kill_connection3-t.cpp index ef28ac6cb6..1c023ffb5a 100644 --- a/test/tap/tests/kill_connection3-t.cpp +++ b/test/tap/tests/kill_connection3-t.cpp @@ -191,7 +191,7 @@ int main(int argc, char** argv) { rc = run_q(proxysql_admin, s.c_str()); ok(rc == 0 , "%s" , s.c_str()); } - sleep(1); + sleep(3); for (int i = 0; i < NUM_CONNS ; i++) { MYSQL * mysql = conns[i]; int rc = run_q(mysql, "DO 1"); diff --git a/test/tap/tests/multiple_prepared_statements-t.cpp b/test/tap/tests/multiple_prepared_statements-t.cpp index ea3bed6035..d88fad720b 100644 --- a/test/tap/tests/multiple_prepared_statements-t.cpp +++ b/test/tap/tests/multiple_prepared_statements-t.cpp @@ -42,9 +42,12 @@ inline unsigned long long monotonic_time() { return (((unsigned long long) ts.tv_sec) * 1000000) + (ts.tv_nsec / 1000); } +#define NTHREADS 5 #define NCONNS 6 #define NPREP 15000 #define PROGRESS 2000 + +pthread_mutex_t mtx[NCONNS]; MYSQL* conns[NCONNS]; int ids[NCONNS*NPREP]; MYSQL_STMT * stmts[NCONNS*NPREP]; @@ -125,6 +128,163 @@ int execute_stmt(int idx) { return 0; } +void * prepare_thread(void *arg) { + int thread_id = *(int *)arg; + for (int i=0; i vars_counters; */ void * my_conn_thread(void *arg) { - g_seed = time(NULL) ^ getpid() ^ pthread_self(); + g_seed = monotonic_time() * pthread_self() + monotonic_time(); + srand(g_seed); unsigned int select_OK=0; unsigned int select_ERR=0; int i, j; @@ -168,7 +169,7 @@ void * my_conn_thread(void *arg) { int fr = rand(); int r1=fr%count; //int r2=fastrand()%testCases.size(); - int r2=rand()%testCases.size(); + int r2=(fastrand() + (RAND_MAX * fastrand())) %testCases.size(); if (j%queries_per_connections==0) { mysql_idx=r1; diff --git a/test/tap/tests/set_testing-240.h b/test/tap/tests/set_testing-240.h index 60254da37e..68b42f0016 100644 --- a/test/tap/tests/set_testing-240.h +++ b/test/tap/tests/set_testing-240.h @@ -146,7 +146,7 @@ struct cpu_timer inline int fastrand() { - g_seed = (214014*g_seed+2531011); + g_seed = (214013*g_seed+2531011); return (g_seed>>16)&0x7FFF; }