[Fuego] [PATCH v2] Add a core function: assert_has_program().

Wang Mingyu wangmy at cn.fujitsu.com
Thu Oct 18 05:53:14 UTC 2018


This function is used to combine the code that check whether a program or file exists, from 2 lines into a single function call.
Called like so:
assert_has_program expect

Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/scripts/functions.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
index ff7b272..dffacbd 100644
--- a/engine/scripts/functions.sh
+++ b/engine/scripts/functions.sh
@@ -961,3 +961,13 @@ function is_on_sdk {
     export $2=$LOCATION
     rm -f $tmpfile
 }
+
+# check for a program or file on the target, and send message if the program or file is missing
+# $1 has the program that is required on the target board
+# this has the side effect of defining PROGRAM_$1 (uppercased)
+# with the value as the directory where $1 is found on the board.
+function assert_has_program {
+   progVar=PROGRAM_${1//[-,.]/_}
+   is_on_target_path $1 ${progVar}
+   assert_define ${progVar} "Missing '$1' program on target board"
+}
-- 
1.8.3.1





More information about the Fuego mailing list