aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-04-05 16:35:31 +0100
committerRoss Burton <ross.burton@intel.com>2013-04-23 11:07:45 +0100
commit392e93f1701a801afe90a1c550813c8ace4950c9 (patch)
treece3f09333e3e75577604dbdbe636e3cf8405aeaf
parentb4fe96393912377cd003af8c72557df3448cde86 (diff)
downloadopenembedded-core-392e93f1701a801afe90a1c550813c8ace4950c9.zip
openembedded-core-392e93f1701a801afe90a1c550813c8ace4950c9.tar.gz
openembedded-core-392e93f1701a801afe90a1c550813c8ace4950c9.tar.bz2
qemuimage-testlib: add function to fetch the remote syslog
Add 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 <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/qemuimage-testlib43
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index daa1ac0..051fee8 100755
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -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
+} \ No newline at end of file