Skip to content

fix: Fix test extension loading paths and Makefile (issue #8)#9

Merged
gabewillen merged 1 commit into
agentflare-ai:mainfrom
dirtyfilthy:fix/issue-8-test-bug-fixes
Dec 12, 2025
Merged

fix: Fix test extension loading paths and Makefile (issue #8)#9
gabewillen merged 1 commit into
agentflare-ai:mainfrom
dirtyfilthy:fix/issue-8-test-bug-fixes

Conversation

@dirtyfilthy

Copy link
Copy Markdown
Contributor

Description

This PR fixes three critical bugs that prevented tests from running:

  1. Extension Loading Path Issue: SQLite's sqlite3_load_extension() automatically appends .so (or .dylib on macOS) to extension paths. Tests were passing paths like "../build/libgraph.so", causing SQLite to attempt loading "../build/libgraph.so.so", which failed.

  2. Makefile References Non-Existent Tests: The Makefile referenced test files that don't exist (test_loading, test_insert_nodes, test_query_nodes), causing make test to fail immediately.

  3. Dynamic Symbol Resolution Issue: Tests statically linked SQLite but dynamically loaded the extension. The extension couldn't resolve SQLite symbols because they weren't exported from the test binary.

Related Issues

Closes #8

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🔧 Build/CI configuration change
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • ✅ Test improvement

Changes Made

  • Fixed extension loading paths in 58 test files (removed .so/.dylib suffixes)
  • Updated tests/Makefile to reference only existing test files
  • Added -Wl,--export-dynamic to LDFLAGS for dynamic symbol resolution
  • Fixed TCK test generator (generate_tck_tests.py) to produce correct paths

Testing

  • All existing tests pass (make test)
  • Added new tests for new functionality
  • Tested with Valgrind for memory leaks
  • Tested with AddressSanitizer
  • Manual testing performed
  • Performance testing performed (if applicable)

Test Evidence

Before fixes:

$ cd tests && make test
make: *** No rule to make target 'test_loading.c', needed by 'test_loading'.  Stop.

After fixes:

$ cd tests && make test
=== Running Basic Tests ===
Running test_match_return_simple...
✅ test_match_return_simple PASSED

Running test_storage...
✅ test_storage PASSED

Running test_virtual_table_crud...
✅ test_virtual_table_crud PASSED

Running test_performance...
✅ test_performance PASSED

🎉 ALL BASIC TESTS PASSED!

Documentation

  • Updated API documentation
  • Updated README.md (if needed)
  • Updated CHANGELOG.md
  • Added code comments where necessary
  • Updated examples (if applicable)

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have checked for memory leaks
  • I have updated the documentation accordingly
  • My changes are compatible with the supported platforms (Linux x86_64)

Breaking Changes

N/A

Performance Impact

  • No performance impact
  • Performance improved
  • Performance slightly degraded (justified because...)
  • Performance significantly degraded (needs discussion)

Screenshots / Examples

N/A

Additional Context

This fix addresses the root cause of test failures. The changes are minimal and focused:

  • Only path strings were modified (no test logic changes)
  • Makefile updated to reflect actual test files
  • Single linker flag added for proper symbol resolution

All 4 basic tests now pass successfully.

Reviewer Notes

Please verify:

  1. Extension paths are correct (no .so/.dylib suffixes)
  2. Makefile only references existing test files
  3. Tests run successfully with make test

For Maintainers:

  • Code review completed
  • All CI checks passing
  • Documentation reviewed
  • Version number updated (if needed)
  • CHANGELOG.md updated

…ai#8)

- Fix extension loading paths: Remove .so/.dylib suffixes from all test files
  (SQLite automatically appends these suffixes)
- Fix Makefile: Update BASIC_TESTS to reference only existing test files
- Fix symbol resolution: Add -Wl,--export-dynamic to LDFLAGS for dynamic
  extension loading
- Fix TCK test generator to produce correct paths

Fixes agentflare-ai#8
@gabewillen gabewillen merged commit 4f62f90 into agentflare-ai:main Dec 12, 2025
16 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.

[Bug]: Test Infrastructure Is Broken

2 participants