Commit | Line | Data |
---|---|---|
b6ef8b72 AW |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2018 Anders Wallin <wallinux@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="Auto load session(s)" | |
19 | ||
20 | CURDIR=$(dirname $0)/ | |
21 | CONFIG_DIR="${CURDIR}/configuration" | |
22 | TESTDIR=$CURDIR/../../../ | |
b6ef8b72 AW |
23 | export LTTNG_SESSION_CONFIG_XSD_PATH=$(readlink -m ${TESTDIR}../src/common/config/) |
24 | ||
25 | DIR=$(readlink -f $TESTDIR) | |
26 | ||
27 | NUM_TESTS=9 | |
28 | ||
29 | source $TESTDIR/utils/utils.sh | |
30 | ||
31 | # MUST set TESTDIR before calling those functions | |
32 | plan_tests $NUM_TESTS | |
33 | ||
34 | print_test_banner "$TEST_DESC" | |
35 | ||
36 | function test_auto_load_file() | |
37 | { | |
38 | diag "Test auto load file" | |
39 | ||
40 | start_lttng_sessiond $CURDIR/load-42.lttng | |
41 | list_lttng_with_opts load-42 | |
42 | stop_lttng_sessiond | |
43 | } | |
44 | ||
45 | function test_auto_load_dir() | |
46 | { | |
47 | diag "Test auto load directory" | |
48 | ||
49 | cp -f $CURDIR/load-42.lttng $LTTNG_DIR/ | |
50 | ||
51 | start_lttng_sessiond $LTTNG_DIR | |
52 | list_lttng_with_opts load-42 | |
53 | stop_lttng_sessiond | |
54 | } | |
55 | ||
56 | function test_auto_load_lttng_home() | |
57 | { | |
58 | diag "Test auto load by setting LTTNG_HOME" | |
59 | ||
60 | mkdir -p $LTTNG_HOME/.lttng/sessions/auto | |
61 | cp -f $CURDIR/load-42.lttng $LTTNG_HOME/.lttng/sessions/auto | |
62 | ||
63 | start_lttng_sessiond | |
64 | list_lttng_with_opts load-42 | |
65 | stop_lttng_sessiond | |
66 | } | |
67 | ||
68 | TESTS=( | |
69 | test_auto_load_file | |
70 | test_auto_load_dir | |
71 | test_auto_load_lttng_home | |
72 | ) | |
73 | ||
74 | for fct_test in ${TESTS[@]}; | |
75 | do | |
76 | export LTTNG_HOME=$(mktemp -d) | |
77 | export LTTNG_DIR=$(mktemp -d) | |
78 | ||
79 | ${fct_test} | |
80 | rm -rf $LTTNG_DIR | |
81 | rm -rf $LTTNG_HOME | |
82 | if [ $? -ne 0 ]; then | |
83 | break; | |
84 | fi | |
85 | done |