mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-04 23:25:54 -04:00
tests: Check if program exists before using it
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: https://github.com/flatpak/flatpak/issues/5020
(cherry picked from commit 6a57fa42e4)
This commit is contained in:
committed by
Simon McVittie
parent
6fc12bfaa7
commit
595b4f1f4c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user