Skip to content

A missing --env bootstrap or an unwritable report path fails silently and exits 0 #875

Description

@Chemaclass

🤔 Background

Same class as #871 and #873: an unusable path is accepted, the work it was meant to do is skipped, and the run still reports success.

--env / --boot with a missing file

src/main.sh sources the bootstrap without checking that it exists. A typo'd path leaks a raw shell error, runs no tests at all, and exits 0:

$ ./bashunit --env missing.sh tests/
src/main.sh: line 242: missing.sh: No such file or directory
$ echo $?
0

That is the entire output — no header, no test lines, no totals. With a valid bootstrap the same command runs the suite normally, so the failure mode is "green build that tested nothing".

Report paths that cannot be written

--report-json, --log-junit and friends do not check that the destination is writable. The suite runs, the report is silently not produced, and the run exits 0:

$ ./bashunit --report-json /nope/dir/o.json tests/
 All tests passed
src/reports.sh: line 207: /nope/dir/o.json: No such file or directory
$ echo $?
0
$ test -f /nope/dir/o.json || echo "no report written"
no report written

A CI job that runs tests and then uploads the report gets a green build and an empty artifact.

Also unvalidated

Suggested fix

Fail fast at the boundary, matching bashunit::main::validate_config_or_exit added in #874:

  • --env/--boot: error and exit non-zero when the file does not exist or is not readable.
  • Report options: verify the parent directory exists and is writable before the run starts, so the failure is reported up front rather than after the suite has passed.
  • --seed: validate as a non-negative integer.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions