Skip to content

[TEST] Infrastructure (§1): non-ASCII paths, exit-code mapping, read-only config, downstream Qt contract (#9460) - #9603

Merged
timosachsenberg merged 4 commits into
developfrom
9460-tests-section1-infra
Jul 10, 2026
Merged

timosachsenberg merged 4 commits into
developfrom
9460-tests-section1-infra

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Context

Closes the remaining §1 (Qt removal / core infrastructure) [AUTO] gaps of the OpenMS 3.6.0 pre-release testing plan (#9460). Tests only — no production code changed.

Changes

Item Test Verified
L37 TOPP_FileConverter_nonascii* — read and write through a non-ASCII (UTF-8) path; the name is materialized into the temp dir at test time via cmake -E copy, so no non-ASCII fixture filename is committed. Reuses FileConverter_1_output.mzML as reference. The permanent #9452 regression. ✅ green (Linux)
L40 File_test — pin the "siblings only, no PATH fallback" contract of findSiblingTOPPExecutable (its TODO: probe in PATH, cf. #9204) + a negative findExecutable case. ✅ green
L41 third_party_tests.cmake — a present-but-failing external program (/bin/false) returns EXTERNAL_PROGRAM_ERROR (9), distinct from the EXTERNAL_PROGRAM_NOTFOUND (14) of a missing binary. ✅ green (returns 9 vs 14, empirically confirmed)
L45 UpdateCheck_test (new) — an unwritable config dir (forced via XDG_CONFIG_HOME → a regular file, so mkdir fails with ENOTDIR for any user) makes UpdateCheck::run() log a warning and return gracefully before any network request, no crash. The $HOME-not-writable fix #9075. ✅ green
L35 PathUtils_test — Windows-only UNC + ANSI-codepage to_path() cases under #ifdef _WIN32, mirroring the existing \xE4 branch. ⚠️ Windows CI only (cannot execute on Linux)
L56 external/ — a second downstream target that does its own find_package(Qt6) + links Qt6::Core, proving OpenMS exports no transitive Qt6. Guarded so the external-code test still configures without Qt6. ⚠️ exercised by the external-build lane

Test plan

ctest -R '^(File_test|UpdateCheck_test|PathUtils_test)$' and the new TOPP_FileConverter_nonascii* / TOPP_CometAdapter_failing / TOPP_CometAdapter_missing cells all pass locally on Linux. L35 compiles/runs only on Windows CI; L56 runs in the external-build lane.

Part of #9460 (§1).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added/extended unit tests for executable resolution (including missing executable and sibling lookup behavior) and improved coverage for config directory creation failure during update checks.
    • Expanded Windows path handling tests for UNC network-share paths, including non-ASCII byte scenarios.
    • Added regression coverage for non-ASCII (UTF-8) file conversion paths in FileConverter.
    • Added optional Qt6 Core “link contract” checks and a new external Comet adapter test for failing runtime executables.

…only config, downstream Qt contract (#9460)

Close the remaining §1 [AUTO] gaps of the OpenMS 3.6.0 pre-release testing plan (#9460). Tests only.

- PathUtils_test: Windows-only UNC + ANSI-codepage to_path() cases under #ifdef _WIN32 (L35).
- TOPP FileConverter: read AND write through a non-ASCII (UTF-8) path, materialized at test time
  via `cmake -E copy` (the permanent #9452 regression) (L37).
- File_test: pin the "siblings only, no PATH fallback" contract of findSiblingTOPPExecutable
  (its TODO / #9204) plus a negative findExecutable case (L40).
- THIRDPARTY: assert a present-but-failing external program returns EXTERNAL_PROGRAM_ERROR (9),
  distinct from the EXTERNAL_PROGRAM_NOTFOUND (14) of a missing binary (L41).
- UpdateCheck_test (new): an unwritable config dir logs a warning and returns gracefully -- no
  network request, no crash (the $HOME-not-writable fix #9075) (L45).
- external/: a second downstream target that finds Qt6 itself and links Qt6::Core, proving
  OpenMS exports no transitive Qt6 (L56).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d2adddcb-dab4-4435-aa7f-a6a88d868730

📥 Commits

Reviewing files that changed from the base of the PR and between d604554 and 98895a8.

📒 Files selected for processing (2)
  • src/tests/external/TestExternalCodeQt.cpp
  • src/tests/topp/THIRDPARTY/third_party_tests.cmake
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/tests/external/TestExternalCodeQt.cpp
  • src/tests/topp/THIRDPARTY/third_party_tests.cmake

📝 Walkthrough

Walkthrough

This PR adds new test coverage across multiple areas: a UpdateCheck unit test for config-directory creation failure, negative test cases for File::findExecutable and findSiblingTOPPExecutable, Windows UNC path decoding tests in PathUtils_test, an external Qt6 link-contract test (TestExternalCodeQt), TOPP FileConverter non-ASCII path regression tests, and a CometAdapter external-program-error detection test on non-Windows.

Changes

Test coverage additions

Layer / File(s) Summary
UpdateCheck config-dir failure unit test
src/tests/class_tests/openms/executables.cmake, src/tests/class_tests/openms/source/UpdateCheck_test.cpp
Registers UpdateCheck_test in the CMake executable list and adds a new test that sets XDG_CONFIG_HOME to a temporary file on Unix, asserts UpdateCheck::run does not throw, and verifies the "Could not create config directory" warning is emitted. Marked NOT_TESTABLE on non-Unix platforms.
File utility negative test cases
src/tests/class_tests/openms/source/File_test.cpp
Adds a negative case for File::findExecutable (missing executable returns false, string unchanged) and pins the findSiblingTOPPExecutable contract to not fall back to PATH using cmd (Windows) or echo (non-Windows).
PathUtils Windows UNC path decoding
src/tests/class_tests/openms/source/PathUtils_test.cpp
Adds two Windows-specific to_path() test cases for UNC share paths — one ASCII and one with a Windows-1252 0xE4 byte — asserting no exception, non-empty path, and correct wide-character decoding.
External Qt6 link-contract test
src/tests/external/CMakeLists.txt, src/tests/external/TestExternalCodeQt.cpp
Introduces an optional TestExternalCodeQt target that links MSExperiment with QString to verify Qt6 must be explicitly linked by callers and is not silently re-exported by OpenMS. CMake skips registration if Qt6 Core is not found.
TOPP FileConverter non-ASCII and CometAdapter failure tests
src/tests/topp/CMakeLists.txt, src/tests/topp/THIRDPARTY/third_party_tests.cmake
Adds three chained FileConverter tests using a non-ASCII UTF-8 temp filename (copy, convert, diff), and a non-Windows CometAdapter test using /bin/false to assert return code 9 (EXTERNAL_PROGRAM_ERROR).

Possibly related issues

  • Release testing #9460: This PR directly addresses the Tier 1 test coverage gaps described in that issue — Unicode path handling (PathUtils, FileConverter), config directory creation (UpdateCheck), subprocess/external program error handling (CometAdapter), and Qt removal infrastructure verification (TestExternalCodeQt).

Possibly related PRs

  • OpenMS/OpenMS#9528: Both PRs extend PathUtils_test.cpp with to_path() round-trip assertions for non-ASCII paths including Windows-1252 ä and UNC byte-preservation scenarios.

Poem

🐇 Hop, hop, I test the path!
UNC and ä dodge the compiler's wrath,
UpdateCheck warned — no config dir found,
Qt links explicit, on safe ground.
False executables meet their fate,
CometAdapter fails, error code straight.
Every test green, all tests align. ✅

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective: adding multiple test infrastructure items for OpenMS 3.6.0 pre-release testing (non-ASCII paths, exit-code mapping, read-only config, Qt contract), covering all six test additions across the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 9460-tests-section1-infra

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tests/external/TestExternalCodeQt.cpp`:
- Around line 23-34: The main function uses std::endl when outputting to
std::cout, which flushes the buffer unnecessarily and impacts performance.
Replace std::endl with \n in the std::cout statement within the main function to
align with coding guidelines that prefer the more efficient newline character
for performance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d57442e8-fa9c-4d08-9dd0-2b8dfff5b1de

📥 Commits

Reviewing files that changed from the base of the PR and between 9a206aa and d604554.

📒 Files selected for processing (8)
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/File_test.cpp
  • src/tests/class_tests/openms/source/PathUtils_test.cpp
  • src/tests/class_tests/openms/source/UpdateCheck_test.cpp
  • src/tests/external/CMakeLists.txt
  • src/tests/external/TestExternalCodeQt.cpp
  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/THIRDPARTY/third_party_tests.cmake

@timosachsenberg timosachsenberg mentioned this pull request Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Adversarial review result: cleanup required before merge.

git diff --check reports trailing whitespace in the added src/tests/external/CMakeLists.txt block. Please strip that whitespace.

Also remove tracker references from added source/CMake comments before merge; source comments should describe the durable behavior being tested without tying it to external tracker IDs. I did not run the tests locally.

timosachsenberg and others added 2 commits July 1, 2026 13:28
… external CMakeLists to LF

- Remove external tracker/issue references (#9460 §1, #9452, #9204, #9075, Lxx)
  from added test comments; comments now describe the durable behavior under test.
- Normalize src/tests/external/CMakeLists.txt to LF (matches .gitattributes eol=lf),
  which also clears the trailing-whitespace (CR) that git diff --check flagged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Addressed review feedback in d00fe84:

  • Trailing whitespace in src/tests/external/CMakeLists.txt: the file was CRLF throughout while .gitattributes declares eol: lf, so the CR bytes were what git diff --check flagged. Normalized the whole file to LF; git diff --check is now clean.
  • Tracker references in comments: removed the external issue/PR IDs (#9460 §1, #9452, #9204, #9075, Lxx) from all added source/CMake comments. They now describe only the durable behavior under test.
  • CodeRabbit std::endl: already fixed — TestExternalCodeQt.cpp uses '\n' (the std::endl remaining in the tree is in the pre-existing TestExternalCode.cpp, untouched here).

CI was green before these changes; only comments and line endings changed (no test logic touched).

@timosachsenberg
timosachsenberg merged commit 436a761 into develop Jul 10, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the 9460-tests-section1-infra branch July 10, 2026 05:22
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.

1 participant