Tests: move `list_triggers_matches_ok` to utils.sh
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 12 May 2021 15:09:37 +0000 (11:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 14 May 2021 18:10:22 +0000 (14:10 -0400)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4cd3816fa7cbc1032582b2a99f67a3b14222f972

tests/regression/tools/trigger/test_list_triggers_cli
tests/utils/utils.sh

index 1ca35356ec9aa99b00d503062bb29fd20110ac8e..7a6050fc861c32f49722231ed99360d881b30190 100755 (executable)
@@ -51,21 +51,6 @@ else
 fi
 
 
-function list_triggers_matches_ok ()
-{
-       local test_name="$1"
-       local expected_stdout_file="$2"
-
-       "${FULL_LTTNG_BIN}" list-triggers > "${tmp_stdout}" 2> "${tmp_stderr}"
-       ok $? "${test_name}: exit code is 0"
-
-       diff -u "${expected_stdout_file}" "${tmp_stdout}"
-       ok $? "${test_name}: expected stdout"
-
-       diff -u /dev/null "${tmp_stderr}"
-       ok $? "${test_name}: expected stderr"
-}
-
 test_top_level_options ()
 {
        diag "Listing top level options"
index f3b4c68c1337720cc599cb534c5131d411bebe42..9ff25a0a57762fb029b91958a5c4b7183123f5ef 100644 (file)
@@ -2247,6 +2247,29 @@ function lttng_remove_trigger_ok()
        lttng_remove_trigger 0 "$@"
 }
 
+function list_triggers_matches_ok ()
+{
+       local tmp_stdout=$(mktemp -t test_list_triggers_cli_stdout.XXXXXX)
+       local tmp_stderr=$(mktemp -t test_list_triggers_cli_stderr.XXXXXX)
+
+       local test_name="$1"
+       local expected_stdout_file="$2"
+
+       diag "$TESTDIR/../src/bin/lttng/$LTTNG_BIN list-triggers"
+
+       "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" list-triggers > "${tmp_stdout}" 2> "${tmp_stderr}"
+       ok $? "${test_name}: exit code is 0"
+
+       diff -u "${expected_stdout_file}" "${tmp_stdout}"
+       ok $? "${test_name}: expected stdout"
+
+       diff -u /dev/null "${tmp_stderr}"
+       ok $? "${test_name}: expected stderr"
+
+       rm -f "${tmp_stdout}"
+       rm -f "${tmp_stderr}"
+}
+
 function validate_path_pattern ()
 {
        local message=$1
This page took 0.02663 seconds and 4 git commands to generate.