summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-04-05 15:35:31 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-23 12:00:54 (GMT)
commit84b91b829d817328d8dff5fb34f483dee3c12e30 (patch)
treebabb13b3255d5a07bae890423691de4d64b20598
parent1d58c4b99e1a0585c1936f0eb056dbe05b45a695 (diff)
downloadpoky-84b91b829d817328d8dff5fb34f483dee3c12e30.tar.gz
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. (From OE-Core rev: 392e93f1701a801afe90a1c550813c8ace4950c9) 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`
109 return $ret 109 return $ret
110} 110}
111 111
112# function to copy files from target to host
113# $1 is the ip address of target
114# $2 is the files, which need to be copied into target
115# $3 is the path on target, where files are copied into
116Test_SCP_From()
117{
118 local ip_addr=$1
119 local src=$2
120 local des=$3
121 local time_out=60
122 local ret=0
123
124 # We use expect to interactive with target by ssh
125 local exp_cmd=`cat << EOF
126eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr:"$src" "$des"
127set timeout $time_out
128expect {
129 "*assword:" { send "\r"; exp_continue}
130 "*(yes/no)?" { send "yes\r"; exp_continue }
131 eof { exit [ lindex [wait] 3 ] }
132}
133EOF`
134
135 expect=`which expect`
136 if [ ! -x "$expect" ]; then
137 Test_Error "ERROR: Please install expect"
138 return 1
139 fi
140
141 expect -c "$exp_cmd"
142 ret=$?
143 return $ret
144}
145
112# function to run command in $ip_addr via ssh 146# function to run command in $ip_addr via ssh
113Test_SSH() 147Test_SSH()
114{ 148{
@@ -709,3 +743,12 @@ Test_Toolchain()
709 743
710 return $ret 744 return $ret
711} 745}
746
747Test_Display_Syslog()
748{
749 local tmplog=`mktemp`
750 Test_SCP_From ${TARGET_IPADDR} /var/log/messages $tmplog
751 echo "System logs:"
752 cat $tmplog
753 rm -f $tmplog
754} \ No newline at end of file