Return-Path: From: Wang Mingyu Date: Fri, 21 Dec 2018 02:41:45 -0800 Message-ID: <1545388905-85738-2-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1545388905-85738-1-git-send-email-wangmy@cn.fujitsu.com> References: <1545388905-85738-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Modify the function is_on_target to search commands that are not under the PATH. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Signed-off-by: Wang Mingyu --- engine/scripts/functions.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh index e75760b..70578fe 100644 --- a/engine/scripts/functions.sh +++ b/engine/scripts/functions.sh @@ -944,15 +944,16 @@ function is_on_target { # FIXTHIS: race condition tmpfile=$(mktemp /tmp/found_loc.XXXXXX) cmd "touch $tmpfile" - if [ -z "$3" ] ; then - safe_cmd "find / -name \"$1\" | head -n 1 >$tmpfile" - else + if [ ! -z "$3" ] ; then # split search path on colon for d in $(echo "$3" | tr ":" "\n") ; do # execute a command on the target to detect $d/$1 cmd "if [ -z \"\$(cat $tmpfile)\" -a -e \"$d/$1\" ] ; then echo \"$d/$1\" >$tmpfile ; fi" done fi + if [ ! -s $tmpfile ] ; then + safe_cmd "find / -name \"$1\" | head -n 1 >$tmpfile" + fi get $tmpfile $tmpfile LOCATION=$(cat $tmpfile) export $2=$LOCATION -- 1.8.3.1