Skip to content

Add widechar ODBC call tests (driving Unicode fix)#290

Merged
irodushka merged 1 commit intoFirebirdSQL:masterfrom
fdcastel:tests/widechar-odbc-calls
Apr 20, 2026
Merged

Add widechar ODBC call tests (driving Unicode fix)#290
irodushka merged 1 commit intoFirebirdSQL:masterfrom
fdcastel:tests/widechar-odbc-calls

Conversation

@fdcastel
Copy link
Copy Markdown
Member

Summary

Adds a dedicated test file tests/test_wide_errors.cpp that exercises both ConvertingString constructor scenarios in MainUnicode.cpp:

  • Output pathSQLGetDiagRecW, SQLErrorW (uses ConvertingString(length, sqlState) to widen the error text back to the caller's SQLWCHAR buffer).
  • Input pathSQLExecDirectW, SQLPrepareW (uses ConvertingString(connection, wcString, length) / convUnicodeToString to narrow the caller's SQLWCHAR query into bytes).

Why this PR exists (and why it's separate from #289)

Per @irodushka's plan in #289 (comment):

  1. ASAN/Valgrind CI stays strictly scoped to Add ASAN and Valgrind integration for CI test suite #289.
  2. This PR provides the regression coverage for the known Linux widechar bugs (truncation to one SQLWCHAR on read-back, stack smash on small buffers).
  3. A follow-up PR will ship the MainUnicode.cpp rewrite and un-skip these tests on Linux.

Linux behaviour (today)

Every test in the new file starts with:

SKIP_ON_LINUX_WIDECHAR();

which is a GTEST_SKIP with a pointer to issue #287 Tier 1b. The pattern matches existing per-platform skips in tests/test_wchar.cpp:111 and tests/test_errors.cpp. This keeps Linux CI green; Windows runs them for real and they must pass. Removing the skip is the visible diff in the follow-up Unicode-fix PR.

Test plan

  • CI green on Linux (tests show as SKIPPED)
  • CI green on Windows (tests run and pass)
  • Locally remove the SKIP_ON_LINUX_WIDECHAR() guards on Linux and confirm the tests fail the way we expect (truncation / overrun) — that's what makes them useful as driving tests for the follow-up PR.

Related

…ectW / SQLPrepareW)

Exercises both ConvertingString constructor paths in MainUnicode.cpp:
output buffer (SQLGetDiagRecW / SQLErrorW) and input buffer
(SQLExecDirectW / SQLPrepareW). Linux tests skip with a pointer to the
follow-up Unicode rewrite PR; they are meant to drive that PR's
implementation. Windows runs them for real.

Per the plan in FirebirdSQL#289 comment 4279111183. Tracked as issue FirebirdSQL#287 Tier 1b.
@irodushka
Copy link
Copy Markdown
Contributor

@fdcastel

Great job.
I'll try to implement an improved version of conv +- within a week.

@irodushka irodushka merged commit d4f4879 into FirebirdSQL:master Apr 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants