From 9e6b264dc54240ed1b7b21c52f53ff42171e168c Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Mon, 7 Oct 2024 21:53:00 +0200 Subject: [PATCH] fix logical error introduced in PR#189, add smoke test for MariaDB (#192) * CI: smoke test against mariadb odbc * revert https://github.com/lurcher/unixODBC/pull/189 there's some logical error in that PR, will address it later --- .github/MariaDB_odbc_data_source_template.ini | 8 ++++++ .github/MariaDB_odbc_driver_template.ini | 3 ++ .github/workflows/main.yml | 28 +++++++++++++++++-- exe/isql.c | 2 +- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/MariaDB_odbc_data_source_template.ini create mode 100644 .github/MariaDB_odbc_driver_template.ini diff --git a/.github/MariaDB_odbc_data_source_template.ini b/.github/MariaDB_odbc_data_source_template.ini new file mode 100644 index 0000000..e8afe68 --- /dev/null +++ b/.github/MariaDB_odbc_data_source_template.ini @@ -0,0 +1,8 @@ +[MariaDB-server] +Description=MariaDB server +Driver=MariaDB ODBC 3.0 Driver +SERVER=127.0.0.1 +USER=test_user +PASSWORD=test_password +DATABASE=test_db +PORT=3306 diff --git a/.github/MariaDB_odbc_driver_template.ini b/.github/MariaDB_odbc_driver_template.ini new file mode 100644 index 0000000..f773a54 --- /dev/null +++ b/.github/MariaDB_odbc_driver_template.ini @@ -0,0 +1,3 @@ +[MariaDB ODBC 3.0 Driver] +Description = MariaDB Connector/ODBC v.3.0 +Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf9dd1b..e5a3f05 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -on: [ push, workflow_dispatch ] +on: [ push, pull_request, workflow_dispatch ] permissions: contents: read @@ -11,17 +11,39 @@ jobs: fail-fast: false name: ${{ matrix.cc }} runs-on: ubuntu-24.04 + services: + mariadb: + image: mariadb:latest + env: + MYSQL_ROOT_PASSWORD: root_password + MYSQL_DATABASE: test_db + MYSQL_USER: test_user + MYSQL_PASSWORD: test_password + options: >- + --health-cmd "healthcheck.sh --connect --innodb_initialized" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 3306:3306 steps: - uses: actions/checkout@v4 - name: Install apt dependencies run: | sudo apt-get update - sudo apt-get install -y libltdl-dev + sudo apt-get install -y libltdl-dev odbc-mariadb - name: configure run: | autoreconf -iv - CC=${{ matrix.cc }} ./configure + CC=${{ matrix.cc }} CFLAGS="-ggdb -fsanitize=address" ./configure --prefix=/ --exec-prefix=/ - name: build run: | ##make AM_MAKEFLAGS=CFLAGS=-Werror make + sudo make install + - name: mariadb smoke test + run: | + sudo -E ./exe/.libs/odbcinst -i -d -f .github/MariaDB_odbc_driver_template.ini + ./exe/.libs/odbcinst -i -s -h -f .github/MariaDB_odbc_data_source_template.ini + echo 'SELECT VERSION();' | ./exe/.libs/isql -v MariaDB-server -b + diff --git a/exe/isql.c b/exe/isql.c index e1180af..fd13e86 100644 --- a/exe/isql.c +++ b/exe/isql.c @@ -208,7 +208,7 @@ int main( int argc, char *argv[] ) * CONNECT ***************************/ - if (szPWD==NULL || szUID==NULL || !OpenDatabase( &hEnv, &hDbc, szDSN, szUID, szPWD )) + if (!OpenDatabase( &hEnv, &hDbc, szDSN, szUID, szPWD )) exit( 1 ); /****************************