aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-04-05 16:35:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-05 17:35:49 +0100
commitf94cb0d175309ad6b29598c57ba74cf1c3646661 (patch)
treeb68d32fa20d2859e70c46046598a1e26746dd647 /scripts
parent24e4a570eb527cff017386976296d5747c1adf57 (diff)
downloadopenembedded-core-f94cb0d175309ad6b29598c57ba74cf1c3646661.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. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-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`
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
bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/bash
#
# Copyright (c) 2016,  Intel Corporation.
# All Rights Reserved
#
# This program is free software;  you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY;  without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program;  if not, see <http://www.gnu.org/licenses/>
#

#
# This script is for running tools from native oe sysroot
#

if [ $# -lt 1 -o "$1" = '--help' -o "$1" = '-h' ] ; then
    echo 'oe-run-native: the following arguments are required: <native recipe> <native tool>'
    echo 'Usage: oe-run-native native-recipe tool [parameters]'
    echo ''
    echo 'OpenEmbedded run-native - runs native tools'
    echo ''
    echo 'arguments:'
    echo '  native-recipe       The recipe which provoides tool'
    echo '  tool                Native tool to run'
    echo ''
    exit 2
fi

native_recipe="$1"
tool="$2"

if [ "${native_recipe%-native}" = "$native_recipe" ]; then
    echo Error: $native_recipe is not a native recipe
    echo Error: Use \"oe-run-native -h\" for help
    exit 1
fi

shift

SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
        echo "Error: Unable to find oe-find-native-sysroot script"
        exit 1
fi
. $SYSROOT_SETUP_SCRIPT $native_recipe

OLD_PATH=$PATH

# look for a tool only in native sysroot
PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin
tool_find=`/usr/bin/which $tool 2>/dev/null`

if [ -n "$tool_find" ] ; then
    # add old path to allow usage of host tools
    PATH=$PATH:$OLD_PATH $@
else
    echo "Error: Unable to find '$tool' in $PATH"
    echo "Error: Have you run 'bitbake $native_recipe -caddto_recipe_sysroot'?"
    exit 1
fi