summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/qemuimage-testlib43
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index daa1ac0605..051fee806c 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