You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Travis and Appveyor integration:
- added travis support - fixed appveyor settings - fixed some warnings (gcc 4.8) - removed sleep commands - disabled failing tests when running against MySQL server, mostly related to stored procedures and binary protocol - reverted fix for MDEV_10361 Still open: TLS/SSL appveyor tests, since .msi installation on appveyor doesn't provide certificates.
This commit is contained in:
@@ -134,6 +134,9 @@ static unsigned int port = 0;
|
||||
static char *socketname = 0;
|
||||
static char *username = 0;
|
||||
static int force_tls= 0;
|
||||
static uchar is_mariadb= 0;
|
||||
static char *this_host= 0;
|
||||
static unsigned char travis_test= 0;
|
||||
/*
|
||||
static struct my_option test_options[] =
|
||||
{
|
||||
@@ -216,6 +219,22 @@ int do_verify_prepare_field(MYSQL_RES *result,
|
||||
return OK;
|
||||
}
|
||||
|
||||
void get_this_host(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (mysql_query(mysql, "select substr(current_user(), locate('@', current_user())+1)"))
|
||||
return;
|
||||
|
||||
if ((res= mysql_store_result(mysql)))
|
||||
{
|
||||
if ((row= mysql_fetch_row(res)))
|
||||
this_host= strdup(row[0]);
|
||||
mysql_free_result(res);
|
||||
}
|
||||
}
|
||||
|
||||
/* Prepare statement, execute, and process result set for given query */
|
||||
|
||||
int my_stmt_result(MYSQL *mysql, const char *buff)
|
||||
@@ -436,7 +455,10 @@ MYSQL *test_connect(struct my_tests_st *test)
|
||||
static int reset_connection(MYSQL *mysql) {
|
||||
int rc;
|
||||
|
||||
rc= mysql_change_user(mysql, username, password, schema);
|
||||
if (is_mariadb)
|
||||
rc= mysql_change_user(mysql, username, password, schema);
|
||||
else
|
||||
rc= mysql_reset_connection(mysql);
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "SET sql_mode=''");
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -452,6 +474,9 @@ static int reset_connection(MYSQL *mysql) {
|
||||
void get_envvars() {
|
||||
char *envvar;
|
||||
|
||||
if (getenv("MYSQL_TEST_TRAVIS"))
|
||||
travis_test= 1;
|
||||
|
||||
if (!hostname && (envvar= getenv("MYSQL_TEST_HOST")))
|
||||
hostname= envvar;
|
||||
if (!username)
|
||||
@@ -504,6 +529,8 @@ MYSQL *my_test_connect(MYSQL *mysql,
|
||||
diag("Error: TLS connection not established");
|
||||
return NULL;
|
||||
}
|
||||
if (!this_host)
|
||||
get_this_host(mysql);
|
||||
return mysql;
|
||||
}
|
||||
|
||||
@@ -512,7 +539,6 @@ void run_tests(struct my_tests_st *test) {
|
||||
int i, rc, total=0;
|
||||
MYSQL *mysql, *mysql_default= NULL; /* default connection */
|
||||
|
||||
|
||||
while (test[total].function)
|
||||
total++;
|
||||
plan(total);
|
||||
@@ -522,6 +548,7 @@ void run_tests(struct my_tests_st *test) {
|
||||
diag("Testing against MySQL Server %s", mysql_get_server_info(mysql_default));
|
||||
diag("Host: %s", mysql_get_host_info(mysql_default));
|
||||
diag("Client library: %s", mysql_get_client_info());
|
||||
is_mariadb= mariadb_connection(mysql_default);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -567,6 +594,9 @@ void run_tests(struct my_tests_st *test) {
|
||||
skip(1, "%s", test[i].skipmsg);
|
||||
}
|
||||
}
|
||||
if (this_host)
|
||||
free(this_host);
|
||||
|
||||
if (mysql_default) {
|
||||
diag("close default");
|
||||
mysql_close(mysql_default);
|
||||
|
Reference in New Issue
Block a user