Skip to contentSkip to conversation

scripts/qemuimage-testlib: Output a slightly better error if expect is missing

PATCH New Richard Purdie 1 participant 1 message Nov 8, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/qemuimage-testlib: Output a slightly better error if expect is missing

---

scripts/qemuimage-testlib +14 -0
index 6a1b900..d0d1b74 100755
@@ -96,6 +96,13 @@ expect {
     eof          { exit [ lindex [wait] 3 ] }
 }
 EOF`
+
+	expect=`which expect`
+	if [ ! -x "$expect" ]; then
+		Test_Error "ERROR: Please install expect"
+		return 1
+	fi
+
 	expect -c "$exp_cmd"
 	ret=$?
 	rm -rf $tmpfile
@@ -120,6 +127,13 @@ expect {
     eof          { exit [ lindex [wait] 3 ] }
 }
 EOF`
+
+	expect=`which expect`
+	if [ ! -x "$expect" ]; then
+		Test_Error "ERROR: Please install expect"
+		return 1
+	fi
+
 	expect -c "$exp_cmd"
 	ret=$?
 	rm -rf $tmpfile