Mi test: Basic test structure
[lttng-tools.git] / tests / regression / tools / mi / test_mi_version
diff --git a/tests/regression/tools/mi/test_mi_version b/tests/regression/tools/mi/test_mi_version
new file mode 100755 (executable)
index 0000000..1d89453
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# Copyright (C) - 2014 Jonathan Rajotte <jonathan.r.julien@gmail.com>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library 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 Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+TEST_DESC="Mi test command version"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../../
+XSD_PATH=$TESTDIR/../src/common/mi_lttng.xsd
+SESSIOND_BIN="lttng-sessiond"
+RELAYD_BIN="lttng-relayd"
+LTTNG_BIN="lttng --mi xml"
+
+XML_VALIDATE="$CURDIR/validate_xml $XSD_PATH"
+
+LTTNG=$TESTDIR/../src/bin/lttng/$LTTNG_BIN
+
+
+DIR=$(readlink -f $TESTDIR)
+
+NUM_TESTS=4
+
+source $TESTDIR/utils/utils.sh
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+function mi_print_version()
+{
+       local opt=$2
+       local output_path=$1
+
+       $LTTNG version $opt > $output_path
+       ok $? "Machine Interface Lttng version"
+
+}
+
+function test_version_validation()
+{
+       mi_print_version version.xml
+       $XML_VALIDATE version.xml
+       ok $? "Machine Interface Version xsd validation"
+}
+
+start_lttng_sessiond
+
+TESTS=(
+       test_version_validation
+)
+
+for fct_test in ${TESTS[@]};
+do
+       TRACE_PATH=$(mktemp -d)
+
+       ${fct_test}
+       if [ $? -ne 0 ]; then
+               break;
+       fi
+       # Only delete if successful
+       rm -rf $TRACE_PATH
+done
+
+stop_lttng_sessiond
This page took 0.023547 seconds and 4 git commands to generate.