[ODBC-338] odbc_connstring testcase failure for rhel 7.x Created: 2021-09-01  Updated: 2022-09-16

Status: Open
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.13
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Shiva Burade Assignee: Lawrin Novitsky
Resolution: Unresolved Votes: 0
Labels: odbc_connstring,, tests
Environment:

OS: RHEL 7.9 / 7.8
arch: intel
MariaDB version: 10.5



 Description   

I am getting obdc_connstring test case failure when building from the source. I used ctest to run the test cases, all the test cases are successful except odbc_connstring.

On further debugging odbc_connstring, the test case has many sub-tests and out of which only all_other_fields_test sub-test is failing at around line 292.
https://github.com/mariadb-corporation/mariadb-connector-odbc/blob/master/test/connstring.c#L291

Furthermore, if I comment lines 287 and 288, test case does not fail and passes successfully. But I am not sure if that is appropriate to do or not.

Steps followed to build mariadb odbc connector from source:

yum install -y mariadb mariadb-server unixODBC unixODBC-devel git cmake gcc libarchive openssl-devel openssl tar curl libcurl-devel krb5-devel make
git clone https://github.com/MariaDB/mariadb-connector-odbc.git
cd mariadb-connector-odbc
git checkout 3.1.13
git submodule init
git submodule update
 
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off  -DWITH_SSL=OPENSSL -DCMAKE_INSTALL_PREFIX=/usr/local
make
make install

Steps followed to run tests:

sudo mysql_install_db --user=mysql
sudo mysqld_safe --user=mysql &
sudo ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
sudo mysql -u root -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('rootpass');"
export TEST_DRIVER=maodbc_test
export TEST_SCHEMA=test
export TEST_DSN=maodbc_test
export TEST_UID=root
export TEST_PASSWORD=rootpass
edit /etc/odbc.ini and /etc/odbcinst.ini with appropriate values.
ctest



 Comments   
Comment by Vivian Kong [ 2022-09-13 ]

The failure is still seen on version 3.1.16.

Comment by Lawrin Novitsky [ 2022-09-13 ]

Thank you for your report.
I am actually inclined to blame UnixODBC here, and this testsuite had many problems with this DM. Or another possible reason - something in your odbc.ini interfere.
Unlike other testsuites, connstring isn't testing the driver using public ODBC API only, but is testing directly the code around connection string parsing and DSN reading and storing. Honestly, I think that it's quite enough if it runs well with Windows DM. but we do run it with UnixODBC and iOdbc on various platforms, and all is well.

There are odbc.ini and odbcinst.ini generated in the test folder during the build. Could you please try
1) export ODBCINI=(YourBuildDir)/test/odbc.ini
export ODBCSYSINI=(YourBuildDir)/test
2) Edit those files accordingly - since you install drivers on your system. If you do all export TEST_* before building, ini files should have that info correct, otherwise connection credentials need to be fixed as well
3) run
ctest --output-on-failure
and give here the output if odbc_connstring is still failing

Comment by Vivian Kong [ 2022-09-16 ]

Thanks @Lawrin.

I tried to rebuild the driver by export the TEST_* variables first and rerun the test but I'm still seeing the failure:

25/25 Test #25: odbc_connstring ..................***Failed    8.34 sec
# DSN=maodbc_test;UID=root;PWD={********};PORT=3306;DATABASE=test;OPTION=67108866;SERVER=localhost;
1..13
# MariaDB C/ODBC test DSN for automatic testing MariaDB C/ODBC test DSN for automatic testing
# MariaDB C/ODBC test DSN for automatic testing MariaDB C/ODBC test DSN for automatic testing
# maodbc_test maodbc_test
# localhost localhost
# Changed description Changed description
# MariaDB C/ODBC test DSN for automatic testing MariaDB C/ODBC test DSN for automatic testing
ok 1 - connstring_parsing_test
# DSN=madb_connstr_options_test1:::DSN=madb_connstr_options_test1;DRIVER=maodbc_test;OPTIONS=0
# DSN=madb_connstr_options_test2:::DSN=madb_connstr_options_test2;DRIVER=maodbc_test;OPTIONS=1
# DSN=madb_connstr_options_test3:::DSN=madb_connstr_options_test3;DRIVER=maodbc_test;OPTIONS=2
# DSN=madb_connstr_options_test4:::DSN=madb_connstr_options_test4;DRIVER=maodbc_test;OPTIONS=4
# DSN=madb_connstr_options_test5:::DSN=madb_connstr_options_test5;DRIVER=maodbc_test;OPTIONS=8
# DSN=madb_connstr_options_test6:::DSN=madb_connstr_options_test6;DRIVER=maodbc_test;OPTIONS=16
# DSN=madb_connstr_options_test7:::DSN=madb_connstr_options_test7;DRIVER=maodbc_test;OPTIONS=32
# DSN=madb_connstr_options_test8:::DSN=madb_connstr_options_test8;DRIVER=maodbc_test;OPTIONS=64
# DSN=madb_connstr_options_test9:::DSN=madb_connstr_options_test9;DRIVER=maodbc_test;OPTIONS=128
# DSN=madb_connstr_options_test10:::DSN=madb_connstr_options_test10;DRIVER=maodbc_test;OPTIONS=256
# DSN=madb_connstr_options_test11:::DSN=madb_connstr_options_test11;DRIVER=maodbc_test;OPTIONS=512
# DSN=madb_connstr_options_test12:::DSN=madb_connstr_options_test12;DRIVER=maodbc_test;OPTIONS=1024
# DSN=madb_connstr_options_test13:::DSN=madb_connstr_options_test13;DRIVER=maodbc_test;OPTIONS=2048
# DSN=madb_connstr_options_test14:::DSN=madb_connstr_options_test14;DRIVER=maodbc_test;OPTIONS=4096
# DSN=madb_connstr_options_test15:::DSN=madb_connstr_options_test15;DRIVER=maodbc_test;OPTIONS=8192
# DSN=madb_connstr_options_test16:::DSN=madb_connstr_options_test16;DRIVER=maodbc_test;OPTIONS=16384
# DSN=madb_connstr_options_test17:::DSN=madb_connstr_options_test17;DRIVER=maodbc_test;OPTIONS=32768
# DSN=madb_connstr_options_test18:::DSN=madb_connstr_options_test18;DRIVER=maodbc_test;OPTIONS=65536
# DSN=madb_connstr_options_test19:::DSN=madb_connstr_options_test19;DRIVER=maodbc_test;OPTIONS=131072
# DSN=madb_connstr_options_test20:::DSN=madb_connstr_options_test20;DRIVER=maodbc_test;OPTIONS=262144
# DSN=madb_connstr_options_test21:::DSN=madb_connstr_options_test21;DRIVER=maodbc_test;OPTIONS=524288
# DSN=madb_connstr_options_test22:::DSN=madb_connstr_options_test22;DRIVER=maodbc_test;OPTIONS=1048576
# DSN=madb_connstr_options_test23:::DSN=madb_connstr_options_test23;DRIVER=maodbc_test;OPTIONS=2097152
# DSN=madb_connstr_options_test24:::DSN=madb_connstr_options_test24;DRIVER=maodbc_test;OPTIONS=4194304
# DSN=madb_connstr_options_test25:::DSN=madb_connstr_options_test25;DRIVER=maodbc_test;OPTIONS=8388608
# DSN=madb_connstr_options_test26:::DSN=madb_connstr_options_test26;DRIVER=maodbc_test;OPTIONS=16777216
# DSN=madb_connstr_options_test27:::DSN=madb_connstr_options_test27;DRIVER=maodbc_test;OPTIONS=33554432
# DSN=madb_connstr_options_test28:::DSN=madb_connstr_options_test28;DRIVER=maodbc_test;OPTIONS=67108864
# DSN=madb_connstr_options_test29:::DSN=madb_connstr_options_test29;DRIVER=maodbc_test;OPTIONS=134217728
# DSN=madb_connstr_options_test30:::DSN=madb_connstr_options_test30;DRIVER=maodbc_test;OPTIONS=268435456
# DSN=madb_connstr_options_test31:::DSN=madb_connstr_options_test31;DRIVER=maodbc_test;OPTIONS=536870912
# DSN=madb_connstr_options_test32:::DSN=madb_connstr_options_test32;DRIVER=maodbc_test;OPTIONS=1073741824
# DSN=madb_connstr_options_test33:::DSN=madb_connstr_options_test33;DRIVER=maodbc_test;OPTIONS=2147483648
ok 2 - options_test
# maodbc_test maodbc_test
# MariaDB C/ODBC test DSN for automatic testing DESCRIPTION
Strings do not match (File: /home/tester/mariadb-connector-odbc/test/connstring.c Line: 291)
not ok 3 - all_other_fields_test
# localhost localhost
# test test
# user user
# password password
# servername servername
# randomdbname randomdbname
ok 4 - aliases_tests
ok 5 - dependent_fields_tests
# some.other.host some.other.host
ok 6 - driver_vs_dsn
# MariaDB C/ODBC test DSN for automatic testing MariaDB C/ODBC test DSN for automatic testing
# MariaDB C/ODBC test DSN for automatic testing MariaDB C/ODBC test DSN for automatic testing
# maodbc_test maodbc_test
# localhost localhost
# Changed description Changed description
# MariaDB C/ODBC test DSN for automatic testing MariaDB C/ODBC test DSN for automatic testing
ok 7 - odbc188_nt_pairs
# USE_MYCNF: 1 7405570 65536
ok 8 - odbc229_usecnf
# TlsVerion: 5, Port: 3307
ok 9 - odbc228_tlsversion
# pwd}sec}}ure} pwd}sec}}ure}
# user_with_brace_in_pwd user_with_brace_in_pwd
# Test dsn Test dsn
# testhost.mariadb.com testhost.mariadb.com
# pwd}sec}}ure} pwd}sec}}ure}
# user_with_brace_in_pwd user_with_brace_in_pwd
# Test dsn Test dsn
# testhost.mariadb.com testhost.mariadb.com
ok 10 - odbc284_escapebrace
# DSN=maodbc_test;UID=root;PWD={********};PORT=3306;DATABASE=test;OPTION=67108866;SERVER=localhost;INTERACTIVE=1
ok 11 - odbc288_interactive
# DSN=maodbc_test;UID=root;PWD={********};PORT=3306;DATABASE=test;OPTION=67108866;SERVER=localhost;FORWARDONLY=1
ok 12 - odbc290_forwardonly
# DSN=maodbc_test;UID=root;PWD={********};PORT=3306;DATABASE=test;OPTION=67108866;SERVER=240.0.0.1:3307,localhost:3306;CONN_TIMEOUT=5
# DSN=maodbc_test;UID=root;PWD={********};PORT=3306;DATABASE=test;OPTION=67108866;SERVER=localhost:3306,240.0.0.1:3307;CONN_TIMEOUT=5
ok 13 - odbc366_failover
 
 
96% tests passed, 1 tests failed out of 25
 
Total Test time (real) =  40.52 sec
 
The following tests FAILED:
         25 - odbc_connstring (Failed)

Here is my setup:

$ echo $ODBCINI
/home/tester/mariadb-connector-odbc/test/odbc.ini
$ echo $ODBCSYSINI
/home/tester/mariadb-connector-odbc/test
$ cat /home/tester/mariadb-connector-odbc/test/odbc.ini
[ODBC Data Sources]
maodbc_test=MariaDB ODBC Connector Test
 
[maodbc_test]
Driver=/home/tester/mariadb-connector-odbc/libmaodbc.so
DESCRIPTION=MariaDB ODBC Connector Test
SERVER=localhost
PORT=3306
DATABASE=test
UID=root
PASSWORD=rootpass
FORCETLS=0
TCPIP=1

Generated at Thu Feb 08 03:27:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.