diff --git a/scripts/check_format.sh b/scripts/check_format.sh index bd9b6a711d..5c769bef81 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -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 diff --git a/test/config_converter/test_converter.sh b/test/config_converter/test_converter.sh index 5594df2d5d..7e241e38c8 100755 --- a/test/config_converter/test_converter.sh +++ b/test/config_converter/test_converter.sh @@ -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 diff --git a/test/iscsi_tgt/perf/iscsi_target.sh b/test/iscsi_tgt/perf/iscsi_target.sh index 4c122f96df..d1e5e5a9d9 100755 --- a/test/iscsi_tgt/perf/iscsi_target.sh +++ b/test/iscsi_tgt/perf/iscsi_target.sh @@ -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 diff --git a/test/json_config/alias_rpc/alias_rpc.sh b/test/json_config/alias_rpc/alias_rpc.sh index 7c8ae7e76c..5af7f39ca3 100755 --- a/test/json_config/alias_rpc/alias_rpc.sh +++ b/test/json_config/alias_rpc/alias_rpc.sh @@ -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" diff --git a/test/json_config/json_diff.sh b/test/json_config/json_diff.sh index 8b4bd6cbee..ce36d5a87c 100755 --- a/test/json_config/json_diff.sh +++ b/test/json_config/json_diff.sh @@ -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 diff --git a/test/make/check_so_deps.sh b/test/make/check_so_deps.sh index 608f6c790e..1d6c2bc374 100755 --- a/test/make/check_so_deps.sh +++ b/test/make/check_so_deps.sh @@ -27,7 +27,7 @@ function replace_defined_variables() { fi done for dep in "${bad_values[@]}"; do - dep_def_arr=($(cat $libdeps_file | grep -v "#" | grep "${dep}" | cut -d "=" -f 2 | xargs)) + dep_def_arr=($(grep -v "#" $libdeps_file | grep "${dep}" | cut -d "=" -f 2 | xargs)) new_values=($(replace_defined_variables "${dep_def_arr[@]}")) good_values=( "${good_values[@]}" "${new_values[@]}" ) done @@ -42,7 +42,7 @@ function confirm_deps() { #keep the space here to differentiate bdev and bdev_* lib_shortname=$(basename $lib | sed 's,libspdk_,,g' | sed 's,\.so, ,g') - lib_make_deps=($(cat $libdeps_file | grep "DEPDIRS-${lib_shortname}" | cut -d "=" -f 2 | xargs)) + lib_make_deps=($(grep "DEPDIRS-${lib_shortname}" $libdeps_file | cut -d "=" -f 2 | xargs)) lib_make_deps=($(replace_defined_variables "${lib_make_deps[@]}")) for ign_dep in "${IGNORED_LIBS[@]}"; do diff --git a/test/nvme/hotplug.sh b/test/nvme/hotplug.sh index 3b2863dd9f..672c985d41 100755 --- a/test/nvme/hotplug.sh +++ b/test/nvme/hotplug.sh @@ -135,7 +135,7 @@ timing_exit wait_for_example trap - SIGINT SIGTERM EXIT -qemupid=$(cat "$qemu_pidfile" | awk '{printf $0}') +qemupid=$(awk '{printf $0}' "$qemu_pidfile") kill -9 $qemupid rm "$qemu_pidfile" rm "$test_img" diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index 9b88cdb6a3..8a9e94462e 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -239,42 +239,42 @@ function get_results(){ case "$1" in iops) - iops=$(cat $NVME_FIO_RESULTS | jq -r '.jobs[] | (.read.iops + .write.iops)') + iops=$(jq -r '.jobs[] | (.read.iops + .write.iops)' $NVME_FIO_RESULTS) iops=${iops%.*} echo $iops ;; mean_lat_usec) - mean_lat=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.lat_ns.mean * $reads_pct + .write.lat_ns.mean * $writes_pct)") + mean_lat=$(jq -r ".jobs[] | (.read.lat_ns.mean * $reads_pct + .write.lat_ns.mean * $writes_pct)" $NVME_FIO_RESULTS) mean_lat=${mean_lat%.*} echo $(( mean_lat/100000 )) ;; p99_lat_usec) - p99_lat=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.000000\" * $reads_pct + .write.clat_ns.percentile.\"99.000000\" * $writes_pct)") + p99_lat=$(jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.000000\" * $reads_pct + .write.clat_ns.percentile.\"99.000000\" * $writes_pct)" $NVME_FIO_RESULTS) p99_lat=${p99_lat%.*} echo $(( p99_lat/100000 )) ;; p99_99_lat_usec) - p99_99_lat=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.990000\" * $reads_pct + .write.clat_ns.percentile.\"99.990000\" * $writes_pct)") + p99_99_lat=$(jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.990000\" * $reads_pct + .write.clat_ns.percentile.\"99.990000\" * $writes_pct)" $NVME_FIO_RESULTS) p99_99_lat=${p99_99_lat%.*} echo $(( p99_99_lat/100000 )) ;; stdev_usec) - stdev=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.clat_ns.stddev * $reads_pct + .write.clat_ns.stddev * $writes_pct)") + stdev=$(jq -r ".jobs[] | (.read.clat_ns.stddev * $reads_pct + .write.clat_ns.stddev * $writes_pct)" $NVME_FIO_RESULTS) stdev=${stdev%.*} echo $(( stdev/100000 )) ;; mean_slat_usec) - mean_slat=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.slat_ns.mean * $reads_pct + .write.slat_ns.mean * $writes_pct)") + mean_slat=$(jq -r ".jobs[] | (.read.slat_ns.mean * $reads_pct + .write.slat_ns.mean * $writes_pct)" $NVME_FIO_RESULTS) mean_slat=${mean_slat%.*} echo $(( mean_slat/100000 )) ;; mean_clat_usec) - mean_clat=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.clat_ns.mean * $reads_pct + .write.clat_ns.mean * $writes_pct)") + mean_clat=$(jq -r ".jobs[] | (.read.clat_ns.mean * $reads_pct + .write.clat_ns.mean * $writes_pct)" $NVME_FIO_RESULTS) mean_clat=${mean_clat%.*} echo $(( mean_clat/100000 )) ;; bw_Kibs) - bw=$(cat $NVME_FIO_RESULTS | jq -r ".jobs[] | (.read.bw + .write.bw)") + bw=$(jq -r ".jobs[] | (.read.bw + .write.bw)" $NVME_FIO_RESULTS) bw=${bw%.*} echo $(( bw )) ;; diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 4a880e5656..16a2be6f0f 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -990,7 +990,7 @@ function vm_start_fio_server() for vm_num in "$@"; do notice "Starting fio server on VM$vm_num" if [[ $fio_bin != "" ]]; then - cat $fio_bin | vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' + vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' < $fio_bin vm_exec $vm_num /root/fio $readonly --eta=never --server --daemonize=/root/fio.pid else vm_exec $vm_num fio $readonly --eta=never --server --daemonize=/root/fio.pid @@ -1092,7 +1092,7 @@ function run_fio() vm_exec $vm_num cat /root/$job_fname if ! $run_server_mode; then if [[ -n "$fio_bin" ]]; then - cat $fio_bin | vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' + vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' < $fio_bin fi notice "Running local fio on VM $vm_num" diff --git a/test/vhost/perf_bench/vhost_perf.sh b/test/vhost/perf_bench/vhost_perf.sh index 7044183db2..5305aeef6c 100755 --- a/test/vhost/perf_bench/vhost_perf.sh +++ b/test/vhost/perf_bench/vhost_perf.sh @@ -194,7 +194,7 @@ if [[ $run_precondition == true ]]; then # Using the same precondition routine possible for lvols thanks # to --clear-method option. Lvols should not UNMAP on creation. $rootdir/scripts/gen_nvme.sh > $rootdir/nvme.cfg - mapfile -t nvmes < <(cat $rootdir/nvme.cfg | grep -oP "Nvme\d+") + mapfile -t nvmes < <(grep -oP "Nvme\d+" $rootdir/nvme.cfg) fio_filename=$(printf ":%sn1" "${nvmes[@]}") fio_filename=${fio_filename:1} $precond_fio_bin --name="precondition" \