X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fmi%2Ftest_mi_version;fp=tests%2Fregression%2Ftools%2Fmi%2Ftest_mi_version;h=1d89453bb5986cbc05132e7f7b5b40dbe6b5b979;hp=0000000000000000000000000000000000000000;hb=68270f0f604eefdc89583950a7cfa02fe7a0cab5;hpb=99e88aea851afcb1c9388469c68c7e1fe2b8982a diff --git a/tests/regression/tools/mi/test_mi_version b/tests/regression/tools/mi/test_mi_version new file mode 100755 index 000000000..1d89453bb --- /dev/null +++ b/tests/regression/tools/mi/test_mi_version @@ -0,0 +1,78 @@ +#!/bin/bash +# +# Copyright (C) - 2014 Jonathan Rajotte +# +# 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