Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Windows ODBC tests to CI #7

Merged
merged 13 commits into from
Jun 27, 2024
56 changes: 52 additions & 4 deletions .github/workflows/ODBC.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: JDBC
name: ODBC
on:
push:
pull_request:
Expand All @@ -9,6 +9,10 @@ env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
OVERRIDE_GIT_DESCRIBE: ${{ inputs.override_git_describe }}

concurrency:
group: ODBC-${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}-${{ inputs.override_git_describe }}
cancel-in-progress: true

jobs:
odbc-linux-amd64:
name: ODBC Linux (amd64)
Expand Down Expand Up @@ -106,7 +110,7 @@ jobs:
odbc-windows-amd64:
name: ODBC Windows (amd64)
runs-on: windows-latest
needs: odbc-linux-amd64
# needs: odbc-linux-amd64
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -125,10 +129,54 @@ jobs:
shell: bash
run: make release

- name: ODBC Tests
- name: Setup ODBC
shell: bash
run: |
bin/Release/odbc_install.exe //CI //Install
Reg Query "HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"
Reg Query "HKLM\SOFTWARE\ODBC\ODBC.INI\DuckDB"
Reg Query "HKLM\SOFTWARE\ODBC\ODBCINST.INI\DuckDB Driver"

- name: Enable ODBC Trace HKCU
shell: bash
run: |
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC" //f
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC" //v Trace //t REG_SZ //d 1
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC" //v TraceDll //t REG_SZ //d "C:\Windows\system32\odbctrac.dll"
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC" //v TraceFile //t REG_SZ //d "D:\a\duckdb\duckdb\ODBC_TRACE.log"
echo "----------------------------------------------------------------"
Reg Query "HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC"

- name: Test Standard ODBC tests
if: ${{ inputs.skip_tests != 'true' }}
shell: bash
run: |
bin/Release/test_odbc.exe

- name: Setup Register For Connection Tests
shell: bash
run: |
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\DuckDB" //v database //t REG_SZ //d "/d/a/duckdb/duckdb/test/sql/storage_version/storage_version.db"
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\DuckDB" //v access_mode //t REG_SZ //d "READ_ONLY"
REG ADD "HKCU\SOFTWARE\ODBC\ODBC.INI\DuckDB" //v allow_unsigned_extensions //t REG_SZ //d "true"
echo "----------------------------------------------------------------"
Reg Query "HKCU\SOFTWARE\ODBC\ODBC.INI\DuckDB"

- name: Test Connection ODBC tests
if: ${{ inputs.skip_tests != 'true' }}
shell: bash
run: ./build/release/bin/Release/test_odbc.exe
run: |
bin/Release/test_connection_odbc.exe

- name: Print ODBC trace on failure
if: ${{ failure() }}
shell: bash
run: cat ODBC_TRACE.log

- name: System.Data.ODBC tests
shell: bash
run: |
bin/Release/SystemDataODBC_tests.exe

- name: Deploy
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions test/tests/select.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "odbc_test_common.h"

#include <iostream>

using namespace odbc_test;

Expand All @@ -15,7 +15,7 @@ TEST_CASE("Test Select Statement", "[odbc]") {
// Allocate a statement handle
EXECUTE_AND_CHECK("SQLAllocHandle (HSTMT)", SQLAllocHandle, SQL_HANDLE_STMT, dbc, &hstmt);

// Execute a simple query
// Execute a simple query
EXECUTE_AND_CHECK("SQLExecDirect (SELECT 1 UNION ALL SELECT 2)", SQLExecDirect, hstmt,
ConvertToSQLCHAR("SELECT 1 UNION ALL SELECT 2"), SQL_NTS);

Expand Down
Loading