1d89453bb5986cbc05132e7f7b5b40dbe6b5b979
[lttng-tools.git] / tests / regression / tools / mi / test_mi_version
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
18 TEST_DESC="Mi test command version"
19
20 CURDIR=$(dirname $0)/
21 TESTDIR=$CURDIR/../../../
22 XSD_PATH=$TESTDIR/../src/common/mi_lttng.xsd
23 SESSIOND_BIN="lttng-sessiond"
24 RELAYD_BIN="lttng-relayd"
25 LTTNG_BIN="lttng --mi xml"
26
27 XML_VALIDATE="$CURDIR/validate_xml $XSD_PATH"
28
29 LTTNG=$TESTDIR/../src/bin/lttng/$LTTNG_BIN
30
31
32 DIR=$(readlink -f $TESTDIR)
33
34 NUM_TESTS=4
35
36 source $TESTDIR/utils/utils.sh
37
38 # MUST set TESTDIR before calling those functions
39 plan_tests $NUM_TESTS
40
41 print_test_banner "$TEST_DESC"
42
43 function 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
53 function test_version_validation()
54 {
55 mi_print_version version.xml
56 $XML_VALIDATE version.xml
57 ok $? "Machine Interface Version xsd validation"
58 }
59
60 start_lttng_sessiond
61
62 TESTS=(
63 test_version_validation
64 )
65
66 for fct_test in ${TESTS[@]};
67 do
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
76 done
77
78 stop_lttng_sessiond
This page took 0.043032 seconds and 3 git commands to generate.