Skip to content

test: find true and false where the host keeps them - #926

Merged
TheWitness merged 1 commit into
Cacti:developfrom
somethingwithproof:fix/portable-true-in-command-test
Dec 4, 2026
Merged

TheWitness merged 1 commit into
Cacti:developfrom
somethingwithproof:fix/portable-true-in-command-test

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Problem

inlineOutcomeProvider in TholdCommandExecutionTest runs /bin/true and /bin/false. macOS has them only in /usr/bin, so the command exits 127 and "success without output" fails with a WARNING where a NOTE is expected. "failure without output" passes there for the wrong reason.

Fix

The provider picks the directory when it runs: /bin if /bin/true is executable, otherwise /usr/bin. A fixed /usr/bin path would break on Alpine, which has them only in /bin. Test-only change; the cases still run a real binary by absolute path.

Verification

  • Linux container, PHP 8.3: TholdCommandExecutionTest 17 passed.
  • With the original paths pointed at files that do not exist, the test fails with the 127 WARNING quoted in the issue.
  • Not run on macOS itself; /usr/bin/true and /usr/bin/false exist there.

Fixes #925

inlineOutcomeProvider ran /bin/true and /bin/false. macOS has them only
in /usr/bin, so the command exited 127 and the success case failed with
a WARNING; the failure case passed for the wrong reason. Alpine has them
only in /bin, so the directory is chosen when the provider runs.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@TheWitness TheWitness left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed. The provider now resolves true/false from /bin or /usr/bin, and the other cases already use paths that exist on both systems. The suite passes merged with current develop (754 tests).

@TheWitness
TheWitness merged commit 06cf287 into Cacti:develop Dec 4, 2026
7 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.

TholdCommandExecutionTest fails on macOS: /bin/true does not exist

2 participants