@@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2929
3030static int test_conc66 (MYSQL * my )
3131{
32- MYSQL * mysql = mysql_init ( NULL ) ;
32+ MYSQL * mysql ;
3333 int rc ;
3434 FILE * fp ;
3535 char query [1024 ];
@@ -54,31 +54,33 @@ static int test_conc66(MYSQL *my)
5454
5555 fclose (fp );
5656
57- rc = mysql_options (mysql , MYSQL_READ_DEFAULT_GROUP , "conc-66" );
58- check_mysql_rc (rc , mysql );
59- rc = mysql_options (mysql , MYSQL_READ_DEFAULT_FILE , "./my-conc66-test.cnf" );
60- check_mysql_rc (rc , mysql );
61-
6257 sprintf (query , "GRANT ALL ON %s.* TO 'conc66'@'%s' IDENTIFIED BY 'test@A1\";#test'" , schema , this_host ? this_host : "localhost" );
6358 rc = mysql_query (my , query );
6459 check_mysql_rc (rc , my );
6560 rc = mysql_query (my , "FLUSH PRIVILEGES" );
6661 check_mysql_rc (rc , my );
62+ mysql = mysql_init (NULL );
63+
64+ rc = mysql_options (mysql , MYSQL_READ_DEFAULT_GROUP , "conc-66" );
65+ check_mysql_rc (rc , mysql );
66+ rc = mysql_options (mysql , MYSQL_READ_DEFAULT_FILE , "./my-conc66-test.cnf" );
67+ check_mysql_rc (rc , mysql );
68+
6769 if (!my_test_connect (mysql , hostname , NULL ,
6870 NULL , schema , port , socketname , 0 ))
6971 {
7072 diag ("user: %s" , mysql -> options .user );
7173 diag ("Error: %s" , mysql_error (mysql ));
7274 return FAIL ;
7375 }
74- diag ("user: %s" , mysql -> options .user );
75-
76+ diag ("user: %s" , mysql -> options .user );
77+
7678 sprintf (query , "DROP user 'conc66'@'%s'" , this_host ? this_host : "localhost" );
7779 rc = mysql_query (my , query );
7880
7981 check_mysql_rc (rc , my );
8082 mysql_close (mysql );
81- return OK ;
83+ return OK ;
8284}
8385
8486static int test_bug20023 (MYSQL * mysql )
@@ -463,9 +465,9 @@ static int test_bug31669(MYSQL *mysql)
463465static int test_bug33831 (MYSQL * mysql )
464466{
465467 FAIL_IF (my_test_connect (mysql , hostname , username ,
466- password , schema , port , socketname , 0 ),
468+ password , schema , port , socketname , 0 ),
467469 "Error expected" );
468-
470+
469471 return OK ;
470472}
471473
@@ -477,8 +479,6 @@ static int test_opt_reconnect(MYSQL *mysql)
477479 int rc ;
478480 my_bool reconnect ;
479481
480- printf ("true: %d\n" , TRUE);
481-
482482 mysql = mysql_init (NULL );
483483 FAIL_IF (!mysql , "not enough memory" );
484484
@@ -632,7 +632,7 @@ int test_conc21(MYSQL *mysql)
632632 row = mysql_fetch_row (res );
633633 strcpy (tmp , row [0 ]);
634634 mysql_free_result (res );
635-
635+
636636 sscanf (tmp , "%d.%d.%d" , & major , & minor , & patch );
637637
638638 check_server_version = major * 10000 + minor * 100 + patch ;
@@ -658,7 +658,7 @@ int test_conc26(MYSQL *unused __attribute__((unused)))
658658 mysql_close (mysql );
659659
660660 mysql = mysql_init (NULL );
661- FAIL_IF (my_test_connect (mysql , hostname , "notexistinguser" , "password" , schema , port , socketname , 0 ),
661+ FAIL_IF (my_test_connect (mysql , hostname , "notexistinguser" , "password" , schema , port , socketname , 0 ),
662662 "Error expected" );
663663 FAIL_IF (mysql -> options .charset_name , "Error: options not freed" );
664664 mysql_close (mysql );
@@ -676,6 +676,7 @@ int test_connection_timeout(MYSQL *unused __attribute__((unused)))
676676 if (my_test_connect (mysql , "192.168.1.101" , "notexistinguser" , "password" , schema , port , socketname , CLIENT_REMEMBER_OPTIONS ))
677677 {
678678 diag ("Error expected - maybe you have to change hostname" );
679+ mysql_close (mysql );
679680 return FAIL ;
680681 }
681682 elapsed = time (NULL ) - start ;
@@ -704,6 +705,7 @@ int test_connection_timeout2(MYSQL *unused __attribute__((unused)))
704705 elapsed = time (NULL ) - start ;
705706 diag ("elapsed: %lu" , (unsigned long )elapsed );
706707 diag ("timeout error expected" );
708+ mysql_close (mysql );
707709 return FAIL ;
708710 }
709711 elapsed = time (NULL ) - start ;
@@ -730,6 +732,7 @@ int test_connection_timeout3(MYSQL *unused __attribute__((unused)))
730732 diag ("timeout error expected" );
731733 elapsed = time (NULL ) - start ;
732734 diag ("elapsed: %lu" , (unsigned long )elapsed );
735+ mysql_close (mysql );
733736 return FAIL ;
734737 }
735738 elapsed = time (NULL ) - start ;
@@ -745,6 +748,7 @@ int test_connection_timeout3(MYSQL *unused __attribute__((unused)))
745748 if (!my_test_connect (mysql , hostname , username , password , schema , port , socketname , CLIENT_REMEMBER_OPTIONS ))
746749 {
747750 diag ("Error: %s" , mysql_error (mysql ));
751+ mysql_close (mysql );
748752 return FAIL ;
749753 }
750754
@@ -798,7 +802,7 @@ static int test_wrong_bind_address(MYSQL *unused __attribute__((unused)))
798802 diag ("test doesn't work with unix sockets" );
799803 return SKIP ;
800804 }
801-
805+
802806 mysql = mysql_init (NULL );
803807
804808 mysql_options (mysql , MYSQL_OPT_BIND , bind_addr );
@@ -868,7 +872,7 @@ static int test_get_options(MYSQL *unused __attribute__((unused)))
868872 MYSQL_OPT_PROTOCOL , MYSQL_OPT_READ_TIMEOUT , MYSQL_OPT_WRITE_TIMEOUT , 0 };
869873 my_bool options_bool []= {MYSQL_OPT_RECONNECT , MYSQL_REPORT_DATA_TRUNCATION ,
870874 MYSQL_OPT_COMPRESS , MYSQL_OPT_SSL_VERIFY_SERVER_CERT , MYSQL_SECURE_AUTH ,
871- #ifdef _WIN32
875+ #ifdef _WIN32
872876 MYSQL_OPT_NAMED_PIPE ,
873877#endif
874878 0 };
@@ -911,7 +915,7 @@ static int test_get_options(MYSQL *unused __attribute__((unused)))
911915 mysql_options (mysql , options_char [i ], char1 );
912916 char2 = NULL ;
913917 mysql_get_optionv (mysql , options_char [i ], (void * )& char2 );
914- if (options_char [i ] != MYSQL_SET_CHARSET_NAME )
918+ if (options_char [i ] != MYSQL_SET_CHARSET_NAME )
915919 FAIL_IF (strcmp (char1 , char2 ), "mysql_get_optionv (char) failed" );
916920 }
917921
@@ -1048,7 +1052,7 @@ static int test_conc496(MYSQL *mysql)
10481052 rc = mysql_query (mysql , "CREATE TEMPORARY TABLE t1(a int) ENGINE=InnoDB" );
10491053 check_mysql_rc (rc , mysql );
10501054 rc = mysql_query (mysql , "COMMIT" );
1051-
1055+
10521056 check_mysql_rc (rc , mysql );
10531057
10541058 if (!mysql_session_track_get_first (mysql , SESSION_TRACK_TRANSACTION_STATE , & data , & len ))
@@ -1126,7 +1130,7 @@ static int test_reset(MYSQL *mysql)
11261130 check_mysql_rc (rc , mysql );
11271131
11281132 rc = mysql_query (mysql , "SELECT 1 FROM DUAL" );
1129- FAIL_IF (!rc , "Error expected" );
1133+ FAIL_IF (!rc , "Error expected" );
11301134
11311135 rc = mysql_reset_connection (mysql );
11321136 check_mysql_rc (rc , mysql );
@@ -1555,11 +1559,11 @@ static int test_conc327(MYSQL *unused __attribute__((unused)))
15551559 fclose (fp2 );
15561560 }
15571561 }
1558-
1562+
15591563 FAIL_IF (failed_opening_files , "fopen failed" );
15601564
15611565 fprintf (fp1 , "!include %s\n" , cnf_file2 );
1562-
1566+
15631567 fprintf (fp2 , "[client]\ndefault-character-set = latin2\nreconnect= 1\n" );
15641568 fclose (fp1 );
15651569 fclose (fp2 );
@@ -1595,7 +1599,7 @@ static int test_conc327(MYSQL *unused __attribute__((unused)))
15951599 FAIL_IF (failed_opening_files , "fopen failed" );
15961600
15971601 fprintf (fp2 , "!includedir %s\n" , env );
1598-
1602+
15991603 fprintf (fp1 , "[client]\ndefault-character-set = latin2\nreconnect= 1\n" );
16001604 fclose (fp1 );
16011605 fclose (fp2 );
@@ -1709,7 +1713,7 @@ static int test_conc312(MYSQL *my)
17091713 {
17101714 diag ("Error: %s" , mysql_error (my ));
17111715 diag ("caching_sha256_password not supported" );
1712- return SKIP ;
1716+ return SKIP ;
17131717 }
17141718
17151719 sprintf (query , "GRANT ALL ON %s.* TO 'foo'@'%s'" , schema , this_host );
@@ -1724,7 +1728,7 @@ static int test_conc312(MYSQL *my)
17241728 }
17251729
17261730 mysql_close (mysql );
1727-
1731+
17281732 sprintf (query , "DROP USER 'foo'@'%s'" , this_host );
17291733 rc = mysql_query (my , query );
17301734 check_mysql_rc (rc , mysql );
@@ -1808,7 +1812,7 @@ static int test_conc392(MYSQL *mysql)
18081812 diag ("Server doesn't support session tracking (cap=%lu)" , mysql -> server_capabilities );
18091813 return SKIP ;
18101814 }
1811-
1815+
18121816 rc = mysql_query (mysql , "set session_track_state_change=1" );
18131817 check_mysql_rc (rc , mysql );
18141818
@@ -1817,7 +1821,7 @@ static int test_conc392(MYSQL *mysql)
18171821 diag ("session_track_get_first failed" );
18181822 return FAIL ;
18191823 }
1820-
1824+
18211825 FAIL_IF (len != 1 , "Expected length 1" );
18221826 return OK ;
18231827}
@@ -1900,7 +1904,7 @@ static int test_default_auth(MYSQL *my __attribute__((unused)))
19001904 diag ("Connection failed. Error: %s" , mysql_error (mysql ));
19011905 mysql_close (mysql );
19021906 return FAIL ;
1903-
1907+
19041908 }
19051909 mysql_close (mysql );
19061910 return OK ;
@@ -1965,7 +1969,7 @@ static int test_conc490(MYSQL *my __attribute__((unused)))
19651969static int test_conc544 (MYSQL * mysql )
19661970{
19671971 int rc ;
1968- MYSQL * my = mysql_init ( NULL ) ;
1972+ MYSQL * my ;
19691973 char query [1024 ];
19701974
19711975 SKIP_SKYSQL ;
@@ -1984,6 +1988,8 @@ static int test_conc544(MYSQL *mysql)
19841988 return SKIP ;
19851989 }
19861990
1991+ my = mysql_init (NULL );
1992+
19871993 rc = mysql_optionsv (my , MARIADB_OPT_RESTRICTED_AUTH , "client_ed25519" );
19881994 check_mysql_rc (rc , mysql );
19891995
@@ -2036,8 +2042,8 @@ static int test_conn_str(MYSQL *my __attribute__((unused)))
20362042 int rc = OK ;
20372043
20382044 snprintf (conn_str , sizeof (conn_str )- 1 , "host=%s;user=%s;password={%s};port=%d;socket=%s" ,
2039- hostname ? hostname : "localhost" , username ? username : "" ,
2040- password ? password : "" ,
2045+ hostname ? hostname : "localhost" , username ? username : "" ,
2046+ password ? password : "" ,
20412047 port , socketname ? socketname : "" );
20422048
20432049 /* SkySQL requires secure connection */
@@ -2066,7 +2072,7 @@ static int test_conn_str_1(MYSQL *my __attribute__((unused)))
20662072 FILE * fp ;
20672073 int rc ;
20682074 char conn_str [1024 ];
2069-
2075+
20702076 SKIP_MAXSCALE ;
20712077
20722078 mysql = mysql_init (NULL );
@@ -2075,7 +2081,7 @@ static int test_conn_str_1(MYSQL *my __attribute__((unused)))
20752081 return FAIL ;
20762082
20772083 sprintf (conn_str , "connection=host=%s;user=%s;password=%s;port=%d;ssl_enforce=1;socket=%s" ,
2078- hostname ? hostname : "localhost" , username ? username : "" ,
2084+ hostname ? hostname : "localhost" , username ? username : "" ,
20792085 password ? password : "" , ssl_port , socketname ? socketname : "" );
20802086
20812087 fprintf (fp , "[client]\n" );
@@ -2141,7 +2147,7 @@ static int test_conc365(MYSQL *my __attribute__((unused)))
21412147
21422148 if (rc )
21432149 return rc ;
2144-
2150+
21452151 mysql = mysql_init (NULL );
21462152 mysql_options (mysql , MARIADB_OPT_HOST , tmp );
21472153 if (!my_test_connect (mysql , NULL , username ,
@@ -2569,9 +2575,9 @@ struct my_tests_st my_tests[] = {
25692575 {"test_compress" , test_compress , TEST_CONNECTION_NONE , 0 , NULL , NULL },
25702576 {"test_reconnect" , test_reconnect , TEST_CONNECTION_DEFAULT , 0 , NULL , NULL },
25712577 {"test_conc21" , test_conc21 , TEST_CONNECTION_DEFAULT , 0 , NULL , NULL },
2572- {"test_conc26" , test_conc26 , TEST_CONNECTION_NONE , 0 , NULL , NULL },
2578+ {"test_conc26" , test_conc26 , TEST_CONNECTION_NONE , 0 , NULL , NULL },
25732579 {"test_connection_timeout" , test_connection_timeout , TEST_CONNECTION_NONE , 0 , NULL , NULL },
2574- {"test_connection_timeout2" , test_connection_timeout2 , TEST_CONNECTION_NONE , 0 , NULL , NULL },
2580+ {"test_connection_timeout2" , test_connection_timeout2 , TEST_CONNECTION_NONE , 0 , NULL , NULL },
25752581 {"test_connection_timeout3" , test_connection_timeout3 , TEST_CONNECTION_NONE , 0 , NULL , NULL },
25762582 {NULL , NULL , 0 , 0 , NULL , NULL }
25772583};
0 commit comments