Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682231

[PATCH v3 5/5] selftests: ftrace: Check given string is not zero-length

From Masami Hiramatsu <mhiramat@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v3 5/5] selftests: ftrace: Check given string is not zero-length
Date 2017-07-06 11:20 +0200
Message-ID <u0b74-2ls-25@gated-at.bofh.it> (permalink)
References <u0aXn-2hr-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use [ ! -z "$VAR" ] instead of [ "$VAR" ] to check
whether the given string variable is not zero-length
since it obviously shows what it means.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/testing/selftests/ftrace/ftracetest |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 453f73d..aab3d5e 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -8,7 +8,7 @@
 # Released under the terms of the GPL v2.
 
 usage() { # errno [message]
-[ "$2" ] && echo $2
+[ ! -z "$2" ] && echo $2
 echo "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
 echo " Options:"
 echo "		-h|--help  Show help message"
@@ -50,7 +50,7 @@ parse_opts() { # opts
   local OPT_TEST_CASES=
   local OPT_TEST_DIR=
 
-  while [ "$1" ]; do
+  while [ ! -z "$1" ]; do
     case "$1" in
     --help|-h)
       usage 0
@@ -96,7 +96,7 @@ parse_opts() { # opts
     ;;
     esac
   done
-  if [ "$OPT_TEST_CASES" ]; then
+  if [ ! -z "$OPT_TEST_CASES" ]; then
     TEST_CASES=$OPT_TEST_CASES
   fi
 }

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/5] selftests: ftrace: ftracetest improvements Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-06 11:10 +0200
  [PATCH v3 2/5] selftests: ftrace: Add --fail-unsupported option Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-06 11:10 +0200
  [PATCH v3 1/5] selftests: ftrace: Do not failure if there is unsupported tests Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-06 11:10 +0200
  [PATCH v3 3/5] selftests: ftrace: Add more verbosity for immediate log Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-06 11:20 +0200
  [PATCH v3 5/5] selftests: ftrace: Check given string is not zero-length Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-06 11:20 +0200
  [PATCH v3 4/5] selftests: ftrace: Output only to console with "--logdir -" Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-06 11:20 +0200
    Re: [PATCH v3 4/5] selftests: ftrace: Output only to console with  "--logdir -" Steven Rostedt <rostedt@goodmis.org> - 2017-07-06 16:00 +0200
      Re: [PATCH v3 4/5] selftests: ftrace: Output only to console with  "--logdir -" Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-07 02:50 +0200

csiph-web