Commit 8109f45e authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

test/json_config: Fix string notify_get_types is compared with



The $enabled_types consisted of a newline, two tabs and a trailing
space. In that form it was checked against a string that consisted
of array items returned in a form of:

foo
bar

The check initially was failing since plain [ was splitting these
strings into multiple words without proper quoting in place. This
could be seen in the build log:

  line 52: [: too many arguments

This is fixed by replacing [ with [[ and using proper quoting on the
rhs of the expression.

Additionally, $enabled_types is now converted to an array to make
the comparision more natural without worrying about the whitespaces.

Change-Id: I6e3e539f36567443b36327f3bcc083de387b8474
Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1864


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 5fbd7a9e
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -45,12 +45,11 @@ function tgt_check_notification_types() {
	timing_enter "${FUNCNAME[0]}"

	local ret=0
	local enabled_types="bdev_register
		bdev_unregister	"
	local enabled_types=("bdev_register" "bdev_unregister")

	get_types=$(tgt_rpc notify_get_types | jq -r '.[]')
	if [ $enabled_types != $get_types ]; then
		echo "ERROR: expected types:" $enabled_types ", but got:" $get_types
	local get_types=($(tgt_rpc notify_get_types | jq -r '.[]'))
	if [[ ${enabled_types[*]} != "${get_types[*]}" ]]; then
		echo "ERROR: expected types: ${enabled_types[*]}, but got: ${get_types[*]}"
		ret=1
	fi