#!/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