qemuimage-testlib: silence some key warnings
PATCH 1/4 qemuimage-testlib: silence some key warnings
Set StrictHostKeyChecking to no to silence the fingerprint warnings, and instead of creating a temporary file for the known hosts and then deleting it just use /dev/null.
Signed-off-by Ross Burton <[email protected]>
--- scripts/qemuimage-testlib | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/qemuimage-testlib +2 -6
@@ -84,13 +84,12 @@ Test_SCP() local ip_addr=$1 local src=$2 local des=$3 - local tmpfile=`mktemp` local time_out=60 local ret=0 # We use expect to interactive with target by ssh local exp_cmd=`cat << EOF -eval spawn scp -o UserKnownHostsFile=$tmpfile "$src" root@$ip_addr:"$des" +eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$src" root@$ip_addr:"$des" set timeout $time_out expect { "*assword:" { send "\r"; exp_continue}
@@ -107,7 +106,6 @@ EOF` expect -c "$exp_cmd" ret=$? - rm -rf $tmpfile return $ret }
@@ -117,11 +115,10 @@ Test_SSH() local ip_addr=$1 shift local command=$@ - local tmpfile=`mktemp` local time_out=60 local ret=0 local exp_cmd=`cat << EOF -eval spawn ssh -o UserKnownHostsFile=$tmpfile root@$ip_addr "$command" +eval spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr "$command" set timeout $time_out expect { "*assword:" { send "\r"; exp_continue}
@@ -138,7 +135,6 @@ EOF` expect -c "$exp_cmd" ret=$? - rm -rf $tmpfile return $ret }
Signature · 1 line
1.7.10.4
PATCH 2/4 connman_test.sh: show all processes when dumping ps
We know the grep failed because the error case is being executed, so don't do the grep again when attempting to help diagnose the problem, as seeing the full process list might be useful.
Signed-off-by Ross Burton <[email protected]>
--- scripts/qemuimage-tests/tools/connman_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qemuimage-tests/tools/connman_test.sh +1 -1
@@ -45,7 +45,7 @@ fi if [ $count -ne 1 ]; then Target_Info "connmand has issue when running in background, Pls, check the output of ps" - ${PS} | grep connmand + ${PS} exit 1 fi
Signature · 1 line
1.7.10.4
PATCH 3/4 qemuimage-testlib: add function to fetch the remote syslog
In reply to Ross BurtonAdd a new function to scp from the target, and another to fetch /var/log/messages and dump it to the console.
Signed-off-by Ross Burton <[email protected]>
--- scripts/qemuimage-testlib | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
scripts/qemuimage-testlib +43 -0
@@ -109,6 +109,40 @@ EOF` return $ret } +# function to copy files from target to host +# $1 is the ip address of target +# $2 is the files, which need to be copied into target +# $3 is the path on target, where files are copied into +Test_SCP_From() +{ + local ip_addr=$1 + local src=$2 + local des=$3 + local time_out=60 + local ret=0 + + # We use expect to interactive with target by ssh + local exp_cmd=`cat << EOF +eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr:"$src" "$des" +set timeout $time_out +expect { + "*assword:" { send "\r"; exp_continue} + "*(yes/no)?" { send "yes\r"; exp_continue } + 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=$? + return $ret +} + # function to run command in $ip_addr via ssh Test_SSH() {
@@ -709,3 +743,12 @@ Test_Toolchain() return $ret } + +Test_Display_Syslog() +{ + local tmplog=`mktemp` + Test_SCP_From ${TARGET_IPADDR} /var/log/messages $tmplog + echo "System logs:" + cat $tmplog + rm -f $tmplog +}
Signature · 1 line
1.7.10.4
PATCH 4/4 sanity/connman: when connman test fails, dump syslog
In reply to Ross BurtonSigned-off-by Ross Burton <[email protected]>
--- scripts/qemuimage-tests/sanity/connman | 1 + 1 file changed, 1 insertion(+)
scripts/qemuimage-tests/sanity/connman +1 -0
@@ -46,6 +46,7 @@ if [ ${RET} -eq 0 ]; then exit 0 else Test_Info "Connman Test FAIL, Pls. check above error log" + Test_Display_Syslog Test_Kill_Qemu Test_Print_Result "connman" 1 exit 1
Signature · 1 line
1.7.10.4