lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
To: lttng-dev@lists.lttng.org
Cc: jgalar@efficios.com
Subject: [PATCH lttng-tools 5/5] Tests: fix shellcheck warning
Date: Fri, 25 Oct 2019 18:12:04 -0400	[thread overview]
Message-ID: <20191025221204.29696-5-jonathan.rajotte-julien__31134.6573334717$1572041696$gmane$org@efficios.com> (raw)
In-Reply-To: <20191025221204.29696-1-jonathan.rajotte-julien@efficios.com>

No need to use random string for session name here, use the test name.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
---
 tests/regression/tools/base-path/test_ust | 36 ++++++++++-------------
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/tests/regression/tools/base-path/test_ust b/tests/regression/tools/base-path/test_ust
index d60a2302a..84d434551 100755
--- a/tests/regression/tools/base-path/test_ust
+++ b/tests/regression/tools/base-path/test_ust
@@ -16,10 +16,8 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 TEST_DESC="Streaming Base Path Override - User space tracing"
 
-CURDIR=$(dirname $0)/
+CURDIR=$(dirname "$0")/
 TESTDIR=$CURDIR/../../..
-NR_ITER=5
-NR_USEC_WAIT=0
 TESTAPP_PATH="$TESTDIR/utils/testapp"
 TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
@@ -29,7 +27,7 @@ TRACE_PATH=$(mktemp -d)
 
 NUM_TESTS=37
 
-source $TESTDIR/utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
 
 if [ ! -x "$TESTAPP_BIN" ]; then
 	BAIL_OUT "No UST events binary detected."
@@ -37,7 +35,7 @@ fi
 
 function ust_app_stream_base_path ()
 {
-	local session_name=$(randstring 16 0)
+	local session_name="ust_app_stream_base_path"
 	local base_path="my/custom/path1"
 
 	diag "Test base path override for trace streaming"
@@ -52,16 +50,15 @@ function ust_app_stream_base_path ()
 	destroy_lttng_session_ok $session_name
 
 	# validate test
-	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-	if [ $? -eq 0 ]; then
+	if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
 		# only delete if successful
-		rm -rf $TRACE_PATH
+		rm -rf "$TRACE_PATH"
 	fi
 }
 
 function ust_app_snapshot_create_base_path ()
 {
-	local session_name=$(randstring 16 0)
+	local session_name="ust_app_snapshot_create_base_path"
 	local base_path="my/custom/path2"
 
 	diag "Test base path override for remote trace snapshot (URI on create)"
@@ -80,16 +77,15 @@ function ust_app_snapshot_create_base_path ()
 	destroy_lttng_session_ok $session_name
 
 	# validate test
-	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-	if [ $? -eq 0 ]; then
+	if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
 		# only delete if successful
-		rm -rf $TRACE_PATH
+		rm -rf "$TRACE_PATH"
 	fi
 }
 
 function ust_app_snapshot_base_path ()
 {
-	local session_name=$(randstring 16 0)
+	local session_name="ust_app_snapshot_base_path"
 	local base_path="my/custom/path3"
 
 	diag "Test base path override for remote trace snapshot (URI on snapshot)"
@@ -107,16 +103,15 @@ function ust_app_snapshot_base_path ()
 	destroy_lttng_session_ok $session_name
 
 	# validate test
-	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-	if [ $? -eq 0 ]; then
+	if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
 		# only delete if successful
-		rm -rf $TRACE_PATH
+		rm -rf "$TRACE_PATH"
 	fi
 }
 
 function ust_app_snapshot_add_output_base_path ()
 {
-	local session_name=$(randstring 16 0)
+	local session_name="ust_app_snapshot_add_output_base_path"
 	local base_path="my/custom/path4"
 
 	diag "Test base path override for remote trace snapshot (URI on add-output)"
@@ -135,10 +130,9 @@ function ust_app_snapshot_add_output_base_path ()
 	destroy_lttng_session_ok $session_name
 
 	# validate test
-	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
-	if [ $? -eq 0 ]; then
+	if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
 		# only delete if successful
-		rm -rf $TRACE_PATH
+		rm -rf "$TRACE_PATH"
 	fi
 }
 
@@ -176,7 +170,7 @@ tests=( ust_app_stream_base_path
 	ust_app_snapshot_add_output_base_path
 	ust_app_stream_base_path_via_load
 )
-for fct_test in ${tests[@]};
+for fct_test in "${tests[@]}";
 do
 	${fct_test}
 done
-- 
2.17.1

  parent reply	other threads:[~2019-10-25 22:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191025221204.29696-1-jonathan.rajotte-julien@efficios.com>
2019-10-25 22:12 ` [PATCH lttng-tools 2/5] Refactor: Move set session path to own function Jonathan Rajotte
2019-10-25 22:12 ` [PATCH lttng-tools 3/5] Cleanup: remove unused internal lttng_session_descriptor_get_base_path Jonathan Rajotte
2019-10-25 22:12 ` [PATCH lttng-tools 4/5] Tests: base path: lttng load for session configuration Jonathan Rajotte
2019-10-25 22:12 ` Jonathan Rajotte [this message]
2019-11-06 18:17 ` [PATCH lttng-tools 1/5] Fix: move set base_path of session to URI configuration Jérémie Galarneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20191025221204.29696-5-jonathan.rajotte-julien__31134.6573334717$1572041696$gmane$org@efficios.com' \
    --to=jonathan.rajotte-julien@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).