]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
fs-test.sh: fix pre-requisite detection
authorStephen Warren <swarren@wwwdotorg.org>
Sat, 3 Oct 2015 19:56:48 +0000 (13:56 -0600)
committerTom Rini <trini@konsulko.com>
Sat, 24 Oct 2015 17:50:34 +0000 (13:50 -0400)
In the following snippet:

if [ ! -x `which $prereq` ]; then

When $prereq does not exist, `which $prereq` evaluates to the empty string,
which results in *no* argument being passed to the -x operator, which then
evaluates to true, which is the equivalent of the prereq having been found. In
order for this to fail as expected, we must pass an empty argument, which then
causes -x to fail. Do this by wrapping the `` in quotes so there's always an
argument to -x, even if the value of the argument is zero-length.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
test/fs/fs-test.sh

index 6f0a3455ed392bbad75d3cf9c987be0b283ed98f..fc41c04c15e66c14e2a0272be39fe8211bc1a069 100755 (executable)
@@ -58,7 +58,7 @@ GB2p5="${MOUNT_DIR}/${BIG_FILE}"
 # Check if the prereq binaries exist, or exit
 function check_prereq() {
        for prereq in $PREREQ_BINS; do
-               if [ ! -x `which $prereq` ]; then
+               if [ ! -x "`which $prereq`" ]; then
                        echo "Missing $prereq binary. Exiting!"
                        exit
                fi