Fix test: add custom output redirector to utils.sh
[lttng-tools.git] / tests / regression / tools / mi / test_mi_version
CommitLineData
68270f0f
JRJ
1#!/bin/bash
2#
3# Copyright (C) - 2014 Jonathan Rajotte <jonathan.r.julien@gmail.com>
4#
5# This library is free software; you can redistribute it and/or modify it under
6# the terms of the GNU Lesser General Public License as published by the Free
7# Software Foundation; version 2.1 of the License.
8#
9# This library is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12# details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this library; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18TEST_DESC="Mi test command version"
19
20CURDIR=$(dirname $0)/
21TESTDIR=$CURDIR/../../../
22XSD_PATH=$TESTDIR/../src/common/mi_lttng.xsd
23SESSIOND_BIN="lttng-sessiond"
24RELAYD_BIN="lttng-relayd"
25LTTNG_BIN="lttng --mi xml"
26
27XML_VALIDATE="$CURDIR/validate_xml $XSD_PATH"
28
29LTTNG=$TESTDIR/../src/bin/lttng/$LTTNG_BIN
30
31
32DIR=$(readlink -f $TESTDIR)
33
34NUM_TESTS=4
35
36source $TESTDIR/utils/utils.sh
37
38# MUST set TESTDIR before calling those functions
39plan_tests $NUM_TESTS
40
41print_test_banner "$TEST_DESC"
42
43function mi_print_version()
44{
45 local opt=$2
46 local output_path=$1
47
48 $LTTNG version $opt > $output_path
49 ok $? "Machine Interface Lttng version"
50
51}
52
53function test_version_validation()
54{
55 mi_print_version version.xml
56 $XML_VALIDATE version.xml
57 ok $? "Machine Interface Version xsd validation"
58}
59
60start_lttng_sessiond
61
62TESTS=(
63 test_version_validation
64)
65
66for fct_test in ${TESTS[@]};
67do
68 TRACE_PATH=$(mktemp -d)
69
70 ${fct_test}
71 if [ $? -ne 0 ]; then
72 break;
73 fi
74 # Only delete if successful
75 rm -rf $TRACE_PATH
76done
77
78stop_lttng_sessiond
This page took 0.035802 seconds and 4 git commands to generate.