Skip to content

CHORE: uninstall system unixODBC before tests to validate bundled…#658

Draft
jahnvi480 wants to merge 5 commits into
mainfrom
jahnvi/macos-uninstall-unixodbc-pipeline
Draft

CHORE: uninstall system unixODBC before tests to validate bundled…#658
jahnvi480 wants to merge 5 commits into
mainfrom
jahnvi/macos-uninstall-unixodbc-pipeline

Conversation

@jahnvi480

@jahnvi480 jahnvi480 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Work Item / Issue Reference

AB#<WORK_ITEM_ID>

GitHub Issue: #656


Summary

This pull request adds a new step to the macOS test pipeline to ensure that the bundled ODBC driver libraries are used during testing, rather than any system-installed versions. This helps verify that the built wheel is truly self-contained and does not rely on Homebrew-provided unixODBC or msodbcsql18.

Test pipeline improvements:

  • Added a script step to uninstall system unixODBC and msodbcsql18 via Homebrew, remove any leftover driver-manager dylibs from standard Homebrew locations, and verify that the bundled ODBC driver dependencies are used by checking with otool -L on the driver library. (eng/pipelines/pr-validation-pipeline.yml)

@github-actions github-actions Bot added the pr-size: small Minimal code update label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

80%


📈 Total Lines Covered: 6743 out of 8343
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 59.9%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.connection.connection.cpp: 76.2%
mssql_python.pybind.ddbc_bindings.cpp: 76.2%
mssql_python.__init__.py: 77.3%
mssql_python.row.py: 77.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.connection.py: 83.6%
mssql_python.logging.py: 85.5%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

jahnvi480 and others added 4 commits July 2, 2026 21:36
Revert the 'uninstall system unixODBC' step (it only ran on the x86_64
runner, whose dylib is already correct, and it broke the benchmark by
removing unixODBC that pyodbc needs).

Add test_macos_dylibs_have_no_absolute_dependency_paths in
test_000_dependencies.py. It runs 'otool -L' on every bundled dylib in
both libs/macos/arm64 and libs/macos/x86_64 and fails if a sibling
bundled library is referenced via an absolute path instead of
@loader_path/@rpath. Because otool reads Mach-O load commands of any
architecture, the x86_64 macOS CI lane now catches the arm64-only
packaging bug behind GitHub #656.
Verified against the shipped binaries that:
- arm64/libmsodbcsql.18.dylib hardcodes /opt/homebrew/lib/libodbcinst.2.dylib
  (the GH #656 break); x86_64 gets rewritten to @loader_path at build time
  because configure_dylibs.sh only fixes ARCH=\ on the Intel runner.
- ddbc_bindings dlopens libmsodbcsql.18.dylib DIRECTLY, so libodbc.2.dylib is
  off the runtime load path (and is never touched by configure_dylibs.sh).

The previous test scanned every dylib, so it would have flagged the dead
libodbc.2.dylib and could never go green even after the real fix. Replace it
with test_macos_driver_load_chain_is_relocatable, which starts at the driver
and follows only its bundled sibling deps -- matching what dlopen resolves at
runtime, ignoring external openssl, and catching the arm64 bug from an x86_64
runner via otool.
…river

newer Homebrew (6.x) refuses to load formulae from third-party taps unless trusted, so brew install msodbcsql18 in the macOS benchmark step failed with "Refusing to load formula ... from untrusted tap". the driver never installed, so every pyodbc connection failed with "[unixODBC][Driver Manager]Can't open lib 'ODBC Driver 18 for SQL Server' : file not found" and the benchmark's pyodbc column came out all N/A. the step has continueOnError so the job stayed green.

add brew trust microsoft/mssql-release between the tap and install. verified locally: forcing HOMEBREW_REQUIRE_TAP_TRUST=1 reproduces the error, brew trust clears it, and msodbcsql18 resolves.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added pr-size: medium Moderate update size and removed pr-size: small Minimal code update labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: medium Moderate update size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants