Skip to content

test(executor): add async execute() and environment API tests#1497

Merged
annejan merged 1 commit into
mainfrom
test/executor-async-tests
May 16, 2026
Merged

test(executor): add async execute() and environment API tests#1497
annejan merged 1 commit into
mainfrom
test/executor-async-tests

Conversation

@nogeenharrie

@nogeenharrie nogeenharrie commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds 10 new tests for Executor: async execute() signal/stdout/exit-code/starting/sequential/workdir, setEnvironment()/environment(), and cancelNext() in both the empty-queue and while-running cases
  • Cross-platform tests (environmentDefaultsEmpty, setAndGetEnvironment, cancelNextEmptyReturnsMinusOne) run on all platforms; async tests remain in the existing #ifndef Q_OS_WIN guard
  • Uses QStandardPaths::findExecutable("sh") for the binary path in async tests because Executor::execute() resolves names relative to the application directory rather than PATH
  • Uses QTRY_COMPARE_WITH_TIMEOUT instead of spy.wait() for reliable async signal polling; sorts both lists before QCOMPARE to handle QProcess::setEnvironment()'s internal sort

Test plan

  • All 31 tests pass locally (31 passed, 0 failed, 1 skipped) with ./tests/auto/executor/tst_executor -platform offscreen
  • clang-format applied

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for executor functionality, including asynchronous execution, signal emissions, output capture, environment handling, and working directory behavior to improve test reliability and robustness.

Review Change Stack

Adds 10 new tests covering the async execute() path, setEnvironment(),
environment(), and cancelNext() — areas previously untested.

Async tests use QStandardPaths::findExecutable("sh") for the binary
path because Executor::execute() resolves names relative to the
application directory rather than PATH.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 890ee69e-0763-4622-baa4-5badcc441bfd

📥 Commits

Reviewing files that changed from the base of the PR and between b2df519 and 6231eaf.

📒 Files selected for processing (1)
  • tests/auto/executor/tst_executor.cpp

📝 Walkthrough

Walkthrough

This PR extends the Executor test suite with new coverage for asynchronous execution, signal emissions, environment state management, and cancellation behavior. It adds environment-focused tests, POSIX-only async execution tests validating signals and stdout capture, and multi-process sequential execution tests using temporary directories.

Changes

Executor test coverage

Layer / File(s) Summary
Test declarations and setup
tests/auto/executor/tst_executor.cpp
QStandardPaths include and declarations for async execution tests (testAsyncExecution, testAsyncStdout, testAsyncNonZeroExit, testAsyncSequential, testAsyncWorkingDirectory, testAsyncQueuedCancel) and environment tests (testDefaultEnvironment, testSetEnvironment, testCancelNextEmpty).
Test implementations
tests/auto/executor/tst_executor.cpp
Environment tests verify default empty state, setEnvironment() consistency, and cancelNext() returning -1 when no process is queued. POSIX-only async tests use QSignalSpy and QTRY_COMPARE_WITH_TIMEOUT to validate starting/finished signal emissions, stdout capture, non-zero exit code handling, multiple sequential async executions, and working-directory behavior with temporary directories.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size:M

Suggested reviewers

  • annejan

Poem

🐰 New tests bloom like spring clover,
Signals caught as they pass over,
Async flows and env states shine,
Coverage charts now align,
QtPass executor tests divine!

🚥 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 clearly and concisely summarizes the main change: adding async execute() and environment API tests to the executor test suite.
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 test/executor-async-tests

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.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 55.017% (+0.1%) from 54.868% — test/executor-async-tests into main

@codecov

codecov Bot commented May 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.00%. Comparing base (b2df519) to head (6231eaf).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1497      +/-   ##
==========================================
+ Coverage   49.86%   50.00%   +0.13%     
==========================================
  Files          44       44              
  Lines        4386     4386              
==========================================
+ Hits         2187     2193       +6     
+ Misses       2199     2193       -6     
Flag Coverage Δ
qtpass 50.00% <ø> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@annejan
annejan merged commit 29cf0d5 into main May 16, 2026
27 checks passed
@annejan
annejan deleted the test/executor-async-tests branch May 16, 2026 18:57
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.

3 participants