X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=d0f76bc6f678adff8375397f673b1e89d95162be;hp=1525b7b2a400a4219b754e015493dbbfd7349493;hb=65e663fa0c098f8f8ddd0f0f3d91dbd25d1daa4d;hpb=5ee26199ebe087bb725f096a932a22b0c73f2bc0 diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 1525b7b2a..d0f76bc6f 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -1,17 +1,7 @@ -# Copyright (C) - 2012 David Goulet +# Copyright (C) 2012 David Goulet # -# 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. +# SPDX-License-Identifier: LGPL-2.1-only # -# 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 SESSIOND_BIN="lttng-sessiond" SESSIOND_MATCH=".*lttng-sess.*" @@ -46,7 +36,7 @@ export LTTNG_SESSIOND_PATH="/bin/true" source $TESTDIR/utils/tap/tap.sh -if [ -z $LTTNG_TEST_TEARDOWN_TIMEOUT ]; then +if [ -z ${LTTNG_TEST_TEARDOWN_TIMEOUT+x} ]; then LTTNG_TEST_TEARDOWN_TIMEOUT=60 fi @@ -1468,8 +1458,9 @@ function lttng_load_fail() function lttng_track() { - local expected_to_fail=$1 - local opts=$2 + local expected_to_fail="$1" + shift 1 + local opts="$@" $TESTDIR/../src/bin/lttng/$LTTNG_BIN track $opts >$OUTPUT_DEST ret=$? if [[ $expected_to_fail -eq "1" ]]; then @@ -1492,8 +1483,9 @@ function lttng_track_fail() function lttng_untrack() { - local expected_to_fail=$1 - local opts=$2 + local expected_to_fail="$1" + shift 1 + local opts="$@" $TESTDIR/../src/bin/lttng/$LTTNG_BIN untrack $opts >$OUTPUT_DEST ret=$? if [[ $expected_to_fail -eq "1" ]]; then @@ -1527,6 +1519,46 @@ function lttng_untrack_kernel_all_ok() ok $? "Lttng untrack all pid on the kernel domain" } +function lttng_track_ust_ok() +{ + lttng_track_ok -u "$@" +} + +function lttng_track_ust_fail() +{ + lttng_track_fail -u "$@" +} + +function lttng_track_kernel_ok() +{ + lttng_track_ok -k "$@" +} + +function lttng_track_kernel_fail() +{ + lttng_track_fail -k "$@" +} + +function lttng_untrack_ust_ok() +{ + lttng_untrack_ok -u "$@" +} + +function lttng_untrack_ust_fail() +{ + lttng_untrack_fail -u "$@" +} + +function lttng_untrack_kernel_ok() +{ + lttng_untrack_ok -k "$@" +} + +function lttng_untrack_kernel_fail() +{ + lttng_untrack_fail -k "$@" +} + function lttng_add_context_list() { $TESTDIR/../src/bin/lttng/$LTTNG_BIN add-context --list 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST @@ -1836,6 +1868,24 @@ function validate_trace_empty() return $ret } +function validate_folder_is_empty() +{ + local folder=$1 + + test -z "$(ls -A "$folder")" + ok $? "Folder ${folder} is empty" +} + +function validate_trace_session_ust_empty() +{ + validate_folder_is_empty "$1"/ust +} + +function validate_trace_session_kernel_empty() +{ + validate_trace_empty "$1"/kernel +} + function regenerate_metadata () { local expected_to_fail=$1