Skip to content

Commit

Permalink
tests: Check if program exists before using it
Browse files Browse the repository at this point in the history
The tests/make-test-runtime.sh scripts sets '-e' in lieu of
implementing useful error checking, but doesn't actually check
if the programs it uses exist in the first place; and aborts
silently when they're not available.

It is more useful to warn about them, and stop execution earlier.
This leaves some leftover files, but arguably that's better than
leaving leftover files AND people scratching their heads.

Warn about missing required programs.

Related: flatpak#5020
  • Loading branch information
GeorgesStavracas committed Oct 3, 2023
1 parent f66b1ec commit 3ba1823
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/make-test-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ add_bin() {
local f=$1
shift

# Check if the program is installed
if ! command -v "${f}" &> /dev/null; then
echo "${f} not found"
exit 1
fi

if grep -qFe "${f}" $BINS; then
# Already handled
return 0
Expand Down

0 comments on commit 3ba1823

Please sign in to comment.