diff options
author | Ross Burton <ross.burton@intel.com> | 2013-04-05 16:35:31 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-04-05 17:36:34 +0100 |
commit | 8f78158759a26eefa800438bdccc1c0ba5a6b884 (patch) | |
tree | 6e27cd622133f63628cce80c19d372500017d7e7 /scripts/qemuimage-testlib | |
parent | 4b5001de2f5303523e0b40fa30484f37c7c48564 (diff) | |
download | poky-8f78158759a26eefa800438bdccc1c0ba5a6b884.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: f94cb0d175309ad6b29598c57ba74cf1c3646661)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/qemuimage-testlib')
-rwxr-xr-x | scripts/qemuimage-testlib | 43 |
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 | ||
116 | Test_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 | ||
126 | eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr:"$src" "$des" | ||
127 | set timeout $time_out | ||
128 | expect { | ||
129 | "*assword:" { send "\r"; exp_continue} | ||
130 | "*(yes/no)?" { send "yes\r"; exp_continue } | ||
131 | eof { exit [ lindex [wait] 3 ] } | ||
132 | } | ||
133 | EOF` | ||
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 |
113 | Test_SSH() | 147 | Test_SSH() |
114 | { | 148 | { |
@@ -709,3 +743,12 @@ Test_Toolchain() | |||
709 | 743 | ||
710 | return $ret | 744 | return $ret |
711 | } | 745 | } |
746 | |||
747 | Test_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 | ||