summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur She <arthur.she@linaro.org>2015-06-10 06:46:42 -0700
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2015-06-12 12:47:23 +0000
commit8e6b7ba81544eb3e68f30f52123fe38b5f49c5a5 (patch)
treeb040a88a279c69358de948b7d8bae0a9295919f1
parent109a5807bf04fe2a48df78c67b0ceb790c29bbcd (diff)
common: gator-data-streaming
Use self-build gatord instead of pre-built one. Change-Id: I4f327750c8b0bef801ef4e7598b5ff9c4cf68ec8
-rw-r--r--common/gator-data-streaming.yaml42
-rwxr-xr-xcommon/scripts/gator-data-streaming.sh96
-rwxr-xr-xcommon/scripts/include/sh-test-lib61
3 files changed, 199 insertions, 0 deletions
diff --git a/common/gator-data-streaming.yaml b/common/gator-data-streaming.yaml
new file mode 100644
index 0000000..406ea50
--- /dev/null
+++ b/common/gator-data-streaming.yaml
@@ -0,0 +1,42 @@
+metadata:
+ name: gator-data-streaming-ubuntu
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Gator Data Streaming Test checks DS5 profiling feature for Ubuntu builds. The test
+ creates a sample session XML file called 'session.xml', this file is passed as a
+ parameter to the gatord command to do a local capture and test results are generated
+ depending upon output of this command."
+ maintainer:
+ - botao.sun@linaro.org
+ - mahanth.gouda@linaro.org
+ - arthur.she@linaro.org
+ os:
+ - ubuntu
+ - openembedded
+ scope:
+ - functional
+ devices:
+ - arndale
+ - panda
+ - panda-es
+ - vexpress-a9
+ - vexpress-tc2
+ - juno
+
+install:
+ git-repos:
+ - url: https://git.linaro.org/arm/ds5/gator.git
+ steps:
+ - 'if [ -f "/usr/sbin/gatord" ]; then mv /usr/sbin/gatord /usr/sbin/gatord.bak; fi'
+ - 'cd gator/daemon'
+ - 'make all'
+ - 'cp gatord /usr/sbin'
+
+run:
+ steps:
+ - "cd common/scripts; ./gator-data-streaming.sh"
+
+parse:
+ pattern: "(?P<test_case_id>[a-zA-Z0-9_-]+):\\s(?P<result>\\w+)"
+ fixupdict:
+ FAIL: fail
+ PASS: pass
diff --git a/common/scripts/gator-data-streaming.sh b/common/scripts/gator-data-streaming.sh
new file mode 100755
index 0000000..542b925
--- /dev/null
+++ b/common/scripts/gator-data-streaming.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Gator data streaming test for ubuntu
+#
+# Copyright (C) 2010 - 2014, Linaro Limited.
+#
+# 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Botao Sun <botao.sun@linaro.org>
+
+. include/sh-test-lib
+
+# Creating a new directory called gator_files under tmp so that it can be uniformly used for both Ubuntu and OE instead of using root for session.xml file
+mkdir -p /tmp/gator_files
+
+# Location of XML template and data streaming result folder
+xml_template="/tmp/gator_files/session.xml"
+data_streaming_result="/tmp/gator_files/linaro-ubuntu-gator-data-streaming.apc"
+
+# Create sample XML file as a template
+echo "<?xml version=\"1.0\" encoding=\"US-ASCII\" ?> " > $xml_template
+echo "<session version=\"1\" output_path=\"x\" call_stack_unwinding=\"yes\" parse_debug_info=\"yes\" " >> $xml_template
+echo "high_resolution=\"no\" buffer_mode=\"streaming\" sample_rate=\"normal\" duration=\"10\" " >> $xml_template
+echo "target_host=\"linaro-ubuntu-boards\" target_port=\"8080\"> " >> $xml_template
+echo "</session>" >> $xml_template
+
+## Test case definitions
+# Check whether session.xml is available
+test_session_xml_not_empty() {
+ TEST="session_xml_not_empty"
+
+ if [ ! -f $xml_template ]; then
+ fail_test "Unable to find $xml_template"
+ return 1
+ fi
+
+ session_file=`cat $xml_template`
+ if [ -z "$session_file" ]; then
+ fail_test "Empty template session XML file at $xml_template"
+ return 1
+ fi
+
+ pass_test
+}
+
+# Check the gator data streaming command
+test_gator_data_streaming_cmd() {
+ TEST="gator_data_streaming_cmd"
+ /usr/sbin/gatord -s $xml_template -o $data_streaming_result
+ if [ $? -ne 0 ]; then
+ fail_test "Run gator data streaming command failed"
+ return 1
+ fi
+
+ pass_test
+}
+
+# Check whether data streaming result is available
+test_gator_data_streaming_result() {
+ TEST="gator_data_streaming_result"
+ if [ ! -d $data_streaming_result ]; then
+ fail_test "Gator data streaming result folder doesn't exist"
+ return 1
+ elif [ ! -f $data_streaming_result/captured.xml ]; then
+ fail_test "File captured.xml doesn't exist"
+ return 1
+ elif [ ! -s $data_streaming_result/captured.xml ]; then
+ fail_test "File captured.xml is empty"
+ return 1
+ fi
+
+ # Print some necessary directory structure information
+ ls -la $data_streaming_result
+
+ pass_test
+}
+
+# run the tests
+test_session_xml_not_empty
+test_gator_data_streaming_cmd
+test_gator_data_streaming_result
+
+# clean exit so lava-test can trust the results
+exit 0
diff --git a/common/scripts/include/sh-test-lib b/common/scripts/include/sh-test-lib
new file mode 100755
index 0000000..f57a2ef
--- /dev/null
+++ b/common/scripts/include/sh-test-lib
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Shared shell library for test management
+#
+# Copyright (C) 2010 - 2014, Linaro Limited.
+#
+# 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Ricardo Salveti <rsalveti@linaro.org>
+# Maintainer Botao Sun <botao.sun@linaro.org>
+
+error_msg() {
+ local msg="$1"
+ test -z "$msg" && msg="Unknown error"
+ echo "ERROR: $msg" >&2
+ exit 1
+}
+
+warn_msg() {
+ local msg="$1"
+ test -z "$msg" && msg="Unknown error"
+ printf "WARNING: %s\n\n" "$msg" >&2
+}
+
+check_return_fail() {
+ if [ $? -ne 0 ]; then
+ fail_test "$1"
+ return 0
+ else
+ return 1
+ fi
+}
+
+fail_test() {
+ local reason="$1"
+ echo "${TEST}: FAIL - ${reason}"
+}
+
+pass_test() {
+ echo "${TEST}: PASS"
+}
+
+check_root() {
+ if [ $(id -ru) -eq 0 ]; then
+ return 0
+ else
+ return 1
+ fi
+}