Skip to content

Commit f3fa489

Browse files
committed
Fix of error in connstring in actions on MacOS
Fixed some testcases(merged from 3.2 and new fix). Added output of additional debug info to actions config and to failing tests.
1 parent 9384c10 commit f3fa489

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ env:
2020
MYSQL_TEST_USER: root
2121
MYSQL_TEST_PASSWD: "heyPassw+-_20oRd"
2222
MYSQL_TEST_DB: testo
23+
TEST_DSN: maodbc_test
24+
TEST_UID: root
25+
TEST_SERVER: mariadb.example.com
26+
TEST_PASSWORD: "heyPassw+-_20oRd"
27+
TEST_PORT: 3306
28+
TEST_SCHEMA: testo
29+
ODBCINI: "${{ github.workspace }}/test/odbc.ini"
30+
ODBCSYSINI: ${{ github.workspace }}/test
31+
ODBCINTSTINI: ${{ github.workspace }}/test/odbcinst.ini
2332

2433
jobs:
2534
setup:
@@ -69,13 +78,6 @@ jobs:
6978
sudo apt install unixodbc-dev
7079
cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL .
7180
cmake --build . --config RelWithDebInfo
72-
env:
73-
TEST_DSN: maodbc_test
74-
TEST_UID: ${{ env.MYSQL_TEST_USER }}
75-
TEST_SERVER: ${{ env.MYSQL_TEST_HOST }}
76-
TEST_PASSWORD: ${{ env.MYSQL_TEST_PASSWD }}
77-
TEST_PORT: ${{ env.MYSQL_TEST_PORT }}
78-
TEST_SCHEMA: ${{ env.MYSQL_TEST_DB }}
7981
8082
- name: make macos
8183
if: ${{ startsWith(matrix.os, 'mac') }}
@@ -87,38 +89,23 @@ jobs:
8789
echo "TEST_DRIVER=${{ github.workspace }}/RelWithDebInfo/libmaodbc.dylib" >> $GITHUB_ENV
8890
cmake -G Xcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="" -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO -DWITH_SIGNCODE=OFF -DODBC_LIB_DIR=/opt/homebrew/opt/libiodbc/lib -DODBC_INCLUDE_DIR=/opt/homebrew/opt/libiodbc/include -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DWITH_EXTERNAL_ZLIB=On .
8991
cmake --build . --config RelWithDebInfo
90-
env:
91-
TEST_DSN: maodbc_test
92-
TEST_UID: ${{ env.MYSQL_TEST_USER }}
93-
TEST_SERVER: ${{ env.MYSQL_TEST_HOST }}
94-
TEST_PASSWORD: ${{ env.MYSQL_TEST_PASSWD }}
95-
TEST_PORT: ${{ env.MYSQL_TEST_PORT }}
96-
TEST_SCHEMA: ${{ env.MYSQL_TEST_DB }}
9792
9893
- name: make windows
9994
if: ${{ startsWith(matrix.os, 'windows') }}
10095
shell: powershell
10196
run: |
10297
cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DWITH_MSI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=SCHANNEL .
10398
cmake --build . --config RelWithDebInfo
104-
env:
105-
TEST_DSN: maodbc_test
106-
TEST_UID: ${{ env.MYSQL_TEST_USER }}
107-
TEST_SERVER: ${{ env.MYSQL_TEST_HOST }}
108-
TEST_PASSWORD: ${{ env.MYSQL_TEST_PASSWD }}
109-
TEST_PORT: ${{ env.MYSQL_TEST_PORT }}
110-
TEST_SCHEMA: ${{ env.MYSQL_TEST_DB }}
11199
112100
- name: Run test suite
113101
shell: bash
114102
run: |
115103
echo "$PWD"
116104
117-
118-
ls -lrt
105+
chmod 777 test
106+
ls -lrta
119107
cd ./test
120108
echo "$PWD"
121-
ls -lrt
122109
if [ "$DB_TYPE" = "mysql" ] ; then
123110
cp ../libmariadb/caching_sha2_password.* ../
124111
fi
@@ -127,16 +114,17 @@ jobs:
127114
TEST_DRIVER="MariaDB ODBC 3.1 Driver"
128115
# INSTALLFOLDER=''
129116
ls ./RelWithDebInfo
130-
cd ../wininstall && for msi in mariadb-connector-odbc-*.msi ; do msiexec /i $msi /qn /norestart; done
117+
cd ../packaging/windows && for msi in mariadb-connector-odbc-*.msi ; do msiexec /i $msi /qn /norestart; done
131118
set +x
132119
odbcconf CONFIGDSN "$TEST_DRIVER" "DSN=$TEST_DSN;SERVER=$TEST_SERVER;DATABASE=$TEST_SCHEMA;USER=$TEST_UID;PASSWORD=$TEST_PASSWORD;PORT=$TEST_PORT;$TEST_ADD_PARAM"
133120
set -ex
134121
else
135-
export ODBCINI="${{ github.workspace }}/test/odbc.ini"
136-
export ODBCSYSINI=${{ github.workspace }}/test
137122
138-
cat $ODBCSYSINI/odbcinst.ini
139-
cat $ODBCSYSINI/odbc.ini | grep -v PASSWORD
123+
cat $ODBCINSTINI
124+
cat $ODBCINI | grep -v PASSWORD
125+
126+
chmod 666 $ODBCINI $ODBCSYSINI/odbcinst.ini
127+
ls -lrt
140128
fi
141129
ctest --verbose
142130
@@ -147,13 +135,7 @@ jobs:
147135
DB_TYPE: ${{ matrix.db-type }}
148136
LOCAL_DB: ${{ steps.setup-env.outputs.database-type }}
149137
os: ${{ matrix.os }}
150-
TEST_DSN: maodbc_test
151138
TEST_DRIVER: ${{ env.TEST_DRIVER || 'maodbc_test' }}
152-
TEST_UID: ${{ env.MYSQL_TEST_USER }}
153-
TEST_SERVER: ${{ env.MYSQL_TEST_HOST }}
154-
TEST_PASSWORD: ${{ env.MYSQL_TEST_PASSWD }}
155-
TEST_PORT: ${{ env.MYSQL_TEST_PORT }}
156-
TEST_SCHEMA: ${{ env.MYSQL_TEST_DB }}
157139
TEST_SOCKET:
158140
SSLCERT: ${{ matrix.db-type == 'container' && format('{0}/.github/workflows/certs/server.crt', github.workspace) || '' }}
159141
MARIADB_PLUGIN_DIR: ${{ github.workspace }}

test/catalog2.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ ODBC_TEST(odbc361)
18831883
* Besides other catalog functions are affected - not only SQLStatistics
18841884
* The problem arose when application reads (db or) table name with SQLTables, and it has original letter cases,
18851885
* but then if to use it as the parameter to (catalog or) table argument for various catalog functions, the server compares
1886-
* it to lowercase values of (db or) table name, and it failed(since ordinary argument comparison has to be cace-sensitive.
1886+
* it to lowercase values of (db or) table name, and it failed(since ordinary argument comparison has to be case-sensitive.
18871887
* The test basically makes sure, that this works
18881888
*/
18891889
ODBC_TEST(odbc391)
@@ -1940,8 +1940,9 @@ ODBC_TEST(odbc391)
19401940
EXPECT_STMT(Stmt, SQLFetch(Stmt), SQL_NO_DATA);
19411941
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
19421942

1943-
CHECK_STMT_RC(Stmt, SQLSpecialColumns(Stmt, SQL_ROWVER, dbname, (SQLSMALLINT)dbnameLen, NULL, 0, tname, (SQLSMALLINT)tnameLen,
1944-
SQL_SCOPE_TRANSACTION, SQL_NULLABLE));
1943+
CHECK_STMT_RC(Stmt, SQLSpecialColumns(Stmt, SQL_ROWVER, dbname, (SQLSMALLINT)dbnameLen, NULL, 0,
1944+
tname, (SQLSMALLINT)tnameLen, SQL_SCOPE_TRANSACTION,
1945+
ServerNotOlderThan(Connection, 10, 10, 2) || IsMysql ? SQL_NULLABLE : SQL_NO_NULLS));
19451946
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
19461947
EXPECT_STMT(Stmt, SQLFetch(Stmt), SQL_NO_DATA);
19471948
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));

test/datetime.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,18 +722,27 @@ ODBC_TEST(t_bug15773)
722722
ODBC_TEST(t_bug9927)
723723
{
724724
SQLCHAR col[10];
725+
SQLRETURN rc;
725726

726727
OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS t_bug9927");
727-
OK_SIMPLE_STMT(Stmt, IsMysql ? "CREATE TABLE t_bug9927 (a TIMESTAMP,"
728-
"b TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)" :
729-
"CREATE TABLE t_bug9927 (a TIMESTAMP DEFAULT 0,"
730-
"b TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)");
728+
OK_SIMPLE_STMT(Stmt, "CREATE TABLE t_bug9927 (a TIMESTAMP DEFAULT '2022-02-24 05:00:00',"
729+
"b TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)");
731730

732731
/* Not sure which exactly version that was introduced, but 10.11.2 is first ga */
733-
CHECK_STMT_RC(Stmt, SQLSpecialColumns(Stmt,SQL_ROWVER, NULL, 0,
732+
CHECK_STMT_RC(Stmt, SQLSpecialColumns(Stmt, SQL_ROWVER, NULL, 0,
734733
NULL, 0, (SQLCHAR *)"t_bug9927", SQL_NTS,
735734
0, ServerNotOlderThan(Connection, 10,10,2) || IsMysql ? SQL_NULLABLE : SQL_NO_NULLS));
736-
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
735+
rc= SQLFetch(Stmt);
736+
if (rc == SQL_NO_DATA)
737+
{
738+
PrintServerVersion(Connection, FALSE);
739+
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
740+
OK_SIMPLE_STMT(Stmt, "SELECT DATA_TYPE,TABLE_SCHEMA,TABLE_SCHEMA=DATABASE(),IS_NULLABLE "
741+
"FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t_bug9927'");
742+
my_print_non_format_result(Stmt);
743+
744+
}
745+
CHECK_STMT_RC(Stmt, rc);
737746

738747
IS_STR(my_fetch_str(Stmt, col, 2), "b", 1);
739748

test/tap.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,20 @@ int sqlwcharcmp(SQLWCHAR *s1, SQLWCHAR *s2, int n)
13991399
}
14001400

14011401

1402+
const char* PrintServerVersion(SQLHDBC Conn, BOOL onlyReturn)
1403+
{
1404+
static char ServerVersion[32];
1405+
SQLGetInfo(Conn, SQL_DBMS_VER, (SQLPOINTER)ServerVersion, sizeof(ServerVersion), NULL);
1406+
if (!onlyReturn)
1407+
{
1408+
diag(ServerVersion);
1409+
}
1410+
return ServerVersion;
1411+
}
14021412
BOOL ServerNotOlderThan(SQLHDBC Conn, unsigned int major, unsigned int minor, unsigned int patch)
14031413
{
14041414
unsigned int ServerMajor= 0, ServerMinor= 0, ServerPatch= 0;
1405-
SQLCHAR ServerVersion[32];
1406-
1407-
SQLGetInfo(Conn, SQL_DBMS_VER, ServerVersion, sizeof(ServerVersion), NULL);
1415+
const char *ServerVersion= PrintServerVersion(Conn, TRUE);
14081416

14091417
sscanf((const char*)ServerVersion, "%u.%u.%u", &ServerMajor, &ServerMinor, &ServerPatch);
14101418

0 commit comments

Comments
 (0)