Skip to content

feat(test): add ABI compatibility check test for shared libraries - #2629

Open
wolfv wants to merge 3 commits into
mainfrom
claude/abi-compatibility-test-sv3m1l
Open

feat(test): add ABI compatibility check test for shared libraries#2629
wolfv wants to merge 3 commits into
mainfrom
claude/abi-compatibility-test-sv3m1l

Conversation

@wolfv

@wolfv wolfv commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds a new abi_check package test that verifies shared libraries in a package remain ABI compatible with previously published versions. The test downloads the lowest published version matching a pin expression (e.g., x.x for same major.minor) and compares the exported symbols, sonames, and library presence.

Key Changes

  • New ABI check implementation (crates/rattler_build_core/src/package_test/abi_check.rs):

    • Extracts ABI surface from shared libraries using goblin for ELF, Mach-O, and PE formats
    • Parses exported symbols from dynamic symbol tables (ELF), export tries (Mach-O), and export tables (PE)
    • Detects ABI violations: removed libraries, changed sonames/install names, and removed symbols
    • Implements intelligent library matching across version bumps (e.g., libfoo.so.1.2.3libfoo.so.1.2.5)
    • Selects baseline record by lowest version with closest build string match
  • Recipe parsing and evaluation:

    • Added AbiCheckTest struct to stage0 and stage1 recipe types with configurable pin, libraries, and ignore_symbols
    • Implemented evaluation logic to parse pin expressions and glob patterns
    • Added comprehensive tests for parsing and evaluation
  • Test infrastructure:

    • Added AbiCheckFailed and AbiCheckError variants to TestError enum
    • Integrated ABI check test execution into the test runner
  • Documentation:

    • Added reference documentation explaining the ABI check test syntax and behavior
    • Added testing guide section on ABI compatibility checking

Implementation Details

  • The test uses the x.x pin syntax (same as version pinnings) to define the compatibility range
  • Libraries are matched across versions using multiple strategies: exact path, normalized name in same directory, soname, and normalized name anywhere
  • Symbol comparison filters out ignored patterns (glob-based)
  • Supports platform-specific binary formats: ELF (Linux), Mach-O (macOS), and PE (Windows)
  • Gracefully skips testing for noarch packages and when no baseline version is found

https://claude.ai/code/session_01FtZdiZvbdfcisDw4xk3ap3

…ished versions

Adds a new `abi_check` package test that downloads the lowest previously
published version of the package matching a pin expression (`x.x` syntax,
as used in pinnings) and compares the ABI surface of the shared libraries
shipped in both packages. Within the pinned version range the test fails
when:

- a shared library was removed from the package
- the soname (ELF), install name (Mach-O) or DLL name (PE) changed
- exported symbols were removed from a library

The binaries are parsed with goblin (ELF dynamic symbol table, Mach-O
export trie with a symtab fallback and fat binary support, PE export
table). The baseline package is resolved through the repodata gateway of
the configured test channels and fetched via the package cache. When no
previously published version matches the pin (e.g. the first release in
a pin range) the check is skipped with a warning, as it is for noarch
packages.

Recipe syntax:

  tests:
    - abi_check:
        pin: x.x            # default
        libraries:          # optional glob filter, default: all shared libs
          - lib/libfoo*
        ignore_symbols:     # optional globs for symbols to ignore
          - _internal_*

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtZdiZvbdfcisDw4xk3ap3
@wolfv wolfv changed the title Add ABI compatibility check test for shared libraries feat(test): add ABI compatibility check test for shared libraries Jul 3, 2026
claude added 2 commits July 3, 2026 14:54
The new AbiCheck variant of TestType was not covered in the exhaustive
match in the Python package inspection API. Add a PyAbiCheckTest wrapper
(pin, libraries, ignore_symbols) and register it in the package module,
mirroring the other test types.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtZdiZvbdfcisDw4xk3ap3
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtZdiZvbdfcisDw4xk3ap3
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