diff options
author | Botao Sun <botao.sun@linaro.org> | 2013-12-14 14:31:33 +1100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-01-09 09:55:30 +0000 |
commit | 389b039d2e989f8356f67f4a191209d6690f4175 (patch) | |
tree | 10952e442a0d616f51236de9cf4518cbff3eb519 /ubuntu/scripts | |
parent | 14ccff47a51dfd6da1309cfb9845bf5ed7d81dab (diff) |
Add Gator Data Streaming Test for Linaro ubuntu
Test code has been validated in LAVA.
Signed-off by: Botao Sun <botao.sun@linaro.org>
Change-Id: I5c471773f7eca280af7f54be0b4b1b1c3f70ac20
Diffstat (limited to 'ubuntu/scripts')
-rwxr-xr-x | ubuntu/scripts/gator-data-streaming-ubuntu.sh | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/ubuntu/scripts/gator-data-streaming-ubuntu.sh b/ubuntu/scripts/gator-data-streaming-ubuntu.sh new file mode 100755 index 0000000..b976596 --- /dev/null +++ b/ubuntu/scripts/gator-data-streaming-ubuntu.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# Gator data streaming test for ubuntu +# +# Copyright (C) 2013, 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> + +source include/sh-test-lib + +# Location of XML template and data streaming result folder +xml_template="/root/session.xml" +data_streaming_result="/root/linaro-ubuntu-gator-data-streaming.apc" + +# Create sample XML file as a template +echo -ne "<?xml version="1.0" encoding="US-ASCII" ?> \n<session version="1" output_path="x" call_stack_unwinding="yes" parse_debug_info="yes" \nhigh_resolution="no" buffer_mode="streaming" sample_rate="normal" duration="10" \ntarget_host="linaro-ubuntu-boards" target_port="8080"> \n</session> \n" > $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
\ No newline at end of file |