Skip to content

Database unit tests fail when run from build directory #57

Description

@bHimes

Problem

All database unit tests (50 tests) fail when run from the build directory but pass when run from /tmp.

Error Observed

Can't open database: unable to open database file
From ../../../src/core/database.cpp:538
bool Database::CreateNewDatabase(wxFileName)

Observations

  • From build dir: ./build/clang-gpu-debug-static/src/unit_test_runner → FAILS
  • From /tmp: cd /tmp && /path/to/unit_test_runner "[database]" → PASSES (1336 assertions, 49 tests)
  • Build directory should be writable, so permissions unlikely the issue

Current Hypothesis

Issue may be related to:

  • Path construction in test helpers or Database class
  • CWD assumptions in temporary file creation
  • Relative vs absolute path handling
  • wxFileName::CreateTempFileName() behavior from different directories

Expected Behavior

wxFileName::CreateTempFileName() should use /tmp regardless of CWD, so tests should work from any directory.

Temporary Workaround

Tests are tagged [.broken] to exclude from CI until root cause is identified and fixed.

Files Affected

All test files in src/test/core/database/:

  • database_batch_ops.cpp (9 tests)
  • database_insert.cpp (5 tests)
  • database_lifecycle.cpp (11 tests)
  • database_queries.cpp (8 tests)
  • database_tables.cpp (9 tests)
  • database_transactions.cpp (7 tests)
  • batch_debug.cpp (1 test)

Total: 50 tests tagged with [.broken]

Investigation Needed

  1. Debug why wxFileName::CreateTempFileName() fails from build directory
  2. Add directory writability assertions to test setup
  3. Fix root cause so tests work from any directory
  4. Remove [.broken] tags once fixed

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions