Commit 13c6c8db authored by Pawel Kaminski's avatar Pawel Kaminski Committed by Tomasz Zawadzki
Browse files

test: shellcheck - apply rule SC2002



SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

Minor fix in test_converter: don't use python3 as
    config_converter.py is executable.

Change-Id: I250e893b48fa95e94778dcc31deb91e6ac0b39c0
Signed-off-by: default avatarPawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481600


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
parent 989261d6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ if hash shellcheck 2>/dev/null; then
	# go to: https://trello.com/c/29Z90j1W
	# Error descriptions can also be found at: https://github.com/koalaman/shellcheck/wiki
	# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
	SHCK_EXCLUDE="SC2002,SC2010"
	SHCK_EXCLUDE="SC2010"
	# SPDK fails some error checks which have been deprecated in later versions of shellcheck.
	# We will not try to fix these error checks, but instead just leave the error types here
	# so that we can still run with older versions of shellcheck.
@@ -267,8 +267,8 @@ if hash shellcheck 2>/dev/null; then
	#         or split robustly with mapfile or read -a.
	# SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
	# SC2223: This default assignment may cause DoS due to globbing. Quote it.
	SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1083,SC1090,SC1091,SC2015,SC2016,SC2034,SC2046,SC2086,SC2119,SC2120,\
SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"
	SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1083,SC1090,SC1091,SC2015,SC2016,SC2034,SC2046,SC2086,\
SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"

	SHCK_FORMAT="diff"
	SHCK_APPLY=true
+2 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@ function on_error_exit() {

trap 'on_error_exit' ERR

cat $CONVERTER_DIR/config.ini | python3 $SPDK_BUILD_DIR/scripts/config_converter.py > $CONVERTER_DIR/config_converter.json
cat $CONVERTER_DIR/config_virtio.ini | python3 $SPDK_BUILD_DIR/scripts/config_converter.py > $CONVERTER_DIR/config_virtio_converter.json
$SPDK_BUILD_DIR/scripts/config_converter.py < $CONVERTER_DIR/config.ini > $CONVERTER_DIR/config_converter.json
$SPDK_BUILD_DIR/scripts/config_converter.py < $CONVERTER_DIR/config_virtio.ini > $CONVERTER_DIR/config_virtio_converter.json
diff -I "cpumask" -I "max_queue_depth" -I "queue_depth" <(jq -S . $CONVERTER_DIR/config_converter.json) <(jq -S . $CONVERTER_DIR/spdk_config.json)
diff <(jq -S . $CONVERTER_DIR/config_virtio_converter.json) <(jq -S . $CONVERTER_DIR/spdk_config_virtio.json)
test_cleanup
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ do
	$rpc_py iscsi_create_target_node Target${i} Target${i}_alias "${bdevs[i]}:0" "$PORTAL_TAG:$INITIATOR_TAG" 64 -d
done

cat $testdir/perf.job | ssh_initiator "cat > perf.job"
ssh_initiator "cat > perf.job" < $testdir/perf.job
rm -f $testdir/perf.job
timing_exit iscsi_config

+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ spdk_tgt_pid=$!
waitforlisten $spdk_tgt_pid

# Test deprecated rpcs in json
cat $testdir/conf.json | $rootdir/scripts/rpc.py load_config -i
$rootdir/scripts/rpc.py load_config -i < $testdir/conf.json

# Test deprecated rpcs in rpc.py
$rootdir/scripts/rpc.py delete_malloc_bdev "Malloc0"
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ tmp_file_1=$(mktemp /tmp/$(basename ${1}).XXX)
tmp_file_2=$(mktemp /tmp/$(basename ${2}).XXX)
ret=0

cat $1 | $python_cmd $rootdir/test/json_config/config_filter.py -method "sort" > $tmp_file_1
cat $2 | $python_cmd $rootdir/test/json_config/config_filter.py -method "sort" > $tmp_file_2
$python_cmd $rootdir/test/json_config/config_filter.py -method "sort" < $1 > $tmp_file_1
$python_cmd $rootdir/test/json_config/config_filter.py -method "sort" < $2 > $tmp_file_2

if ! diff -u $tmp_file_1 $tmp_file_2; then
	ret=1
Loading