tests: use -z / -n to test for string empty / non-empty
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 2 Aug 2022 19:21:21 +0000 (15:21 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 16 Aug 2022 19:50:22 +0000 (15:50 -0400)
commit75e396f6b20bdf52c76a3c7312e7fb815ac1e5e9
tree43e650339d817169928d96393c63efcf39c4137c
parent8dea686a2397bdadb81f44a3e74fd39fd7397ee2
tests: use -z / -n to test for string empty / non-empty

shellcheck gives many warnings of this kind

    In env.sh.in line 44:
    if [ "x${BT_TESTS_CC_BIN:-}" = "x" ]; then
         ^---------------------^ SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose.

    Did you mean:
    if [ "${BT_TESTS_CC_BIN:-}" = "" ]; then

Fix them by using test's -z and -n switches, which test for empty and
non-empty strings, respectively.  In some cases, we are checking for the
string to have a specific value ( = "x1"), in which case I left the
comparison, but just removed the leading x's.

Change-Id: I3cd841d881916696419d540ed629e685d2edce9d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8635
Tested-by: jenkins <jenkins@lttng.org>
48 files changed:
tests/bindings/python/bt2/test_python_bt2
tests/cli/convert/test_auto_source_discovery_grouping
tests/cli/convert/test_auto_source_discovery_log_level
tests/cli/convert/test_auto_source_discovery_params
tests/cli/convert/test_convert_args
tests/cli/list-plugins/test_list_plugins
tests/cli/params/test_params
tests/cli/query/test_query
tests/cli/test_exit_status
tests/cli/test_help
tests/cli/test_intersection
tests/cli/test_output_ctf_metadata
tests/cli/test_output_path_ctf_non_lttng_trace
tests/cli/test_packet_seq_num
tests/cli/test_trace_copy
tests/cli/test_trace_read
tests/cli/test_trimmer
tests/ctf-writer/test_ctf_writer
tests/lib/conds/test_conds
tests/lib/test_plugin
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_i386-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc64le-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_x86_64-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_i386-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc64le-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_x86_64-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_succeed
tests/plugins/flt.utils.muxer/succeed/test_succeed
tests/plugins/flt.utils.trimmer/test_trimming
tests/plugins/sink.ctf.fs/succeed/test_succeed
tests/plugins/sink.ctf.fs/test_assume_single_trace
tests/plugins/sink.ctf.fs/test_stream_names
tests/plugins/sink.text.details/succeed/test_succeed
tests/plugins/sink.text.pretty/test_enum
tests/plugins/sink.text.pretty/test_pretty_python
tests/plugins/src.ctf.fs/fail/test_fail
tests/plugins/src.ctf.fs/query/test_query_metadata_info
tests/plugins/src.ctf.fs/query/test_query_support_info
tests/plugins/src.ctf.fs/query/test_query_trace_info
tests/plugins/src.ctf.fs/succeed/test_succeed
tests/plugins/src.ctf.fs/test_deterministic_ordering
tests/plugins/src.ctf.lttng-live/test_live
tests/python-plugin-provider/test_python_plugin_provider
tests/utils/env.sh.in
tests/utils/run_python_bt2
tests/utils/utils.sh
This page took 0.028911 seconds and 4 git commands to generate.