test: Shellcheck - correct rule: Consider using { cmd1; cmd2; }

Correct shellcheck rule SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: Ic692e9f78f2d3d8a3b27d702884cbe97c880727c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474959
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Maciej Wawryk 2019-11-18 12:32:48 +01:00 committed by Tomasz Zawadzki
parent 5816421572
commit 029251878d
8 changed files with 89 additions and 65 deletions

View File

@ -69,12 +69,14 @@ mnt_pt=${mnt_dir}/osd-device-0-data
mkdir -p ${mnt_pt}
mkfs.xfs -f /dev/disk/by-partlabel/osd-device-0-data
mount /dev/disk/by-partlabel/osd-device-0-data ${mnt_pt}
echo -e "\tosd data = ${mnt_pt}" >> "$ceph_conf"
echo -e "\tosd journal = /dev/disk/by-partlabel/osd-device-0-journal" >> "$ceph_conf"
cat << EOL >> $ceph_conf
osd data = ${mnt_pt}
osd journal = /dev/disk/by-partlabel/osd-device-0-journal
# add mon address
echo -e "\t[mon.a]" >> "$ceph_conf"
echo -e "\tmon addr = ${mon_ip}:12046" >> "$ceph_conf"
[mon.a]
mon addr = ${mon_ip}:12046
EOL
# create mon
rm -rf "${mon_dir:?}/"*

View File

@ -242,8 +242,7 @@ if hash shellcheck 2>/dev/null; then
# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
SHCK_EXCLUDE="SC1083,SC2002,\
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\
SC2097,SC2098,SC2119,SC2120,SC2128,\
SC2129"
SC2097,SC2098,SC2119,SC2120,SC2128"
# 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.

View File

@ -62,9 +62,11 @@ function on_error_exit() {
function configure_raid_bdev() {
rm -rf $testdir/rpcs.txt
echo bdev_malloc_create 32 512 -b Base_1 >> $testdir/rpcs.txt
echo bdev_malloc_create 32 512 -b Base_2 >> $testdir/rpcs.txt
echo bdev_raid_create -z 64 -r 0 -b \"Base_1 Base_2\" -n raid0 >> $testdir/rpcs.txt
cat <<- EOL >> $testdir/rpcs.txt
bdev_malloc_create 32 512 -b Base_1
bdev_malloc_create 32 512 -b Base_2
bdev_raid_create -z 64 -r 0 -b \"Base_1 Base_2\" -n raid0
EOL
$rpc_py < $testdir/rpcs.txt
rm -rf $testdir/rpcs.txt

View File

@ -10,9 +10,11 @@ run_step() {
exit 1
fi
echo "--spdk=$ROCKSDB_CONF" >> "$1"_flags.txt
echo "--spdk_bdev=Nvme0n1" >> "$1"_flags.txt
echo "--spdk_cache_size=$CACHE_SIZE" >> "$1"_flags.txt
cat <<- EOL >> "$1"_flags.txt
--spdk=$ROCKSDB_CONF
--spdk_bdev=Nvme0n1
--spdk_cache_size=$CACHE_SIZE
EOL
echo -n Start $1 test phase...
/usr/bin/time taskset 0xFF $DB_BENCH --flagfile="$1"_flags.txt &> "$1"_db_bench.txt
@ -77,44 +79,54 @@ fi
cd $RESULTS_DIR
cp $testdir/common_flags.txt insert_flags.txt
echo "--benchmarks=fillseq" >> insert_flags.txt
echo "--threads=1" >> insert_flags.txt
echo "--disable_wal=1" >> insert_flags.txt
echo "--use_existing_db=0" >> insert_flags.txt
echo "--num=$NUM_KEYS" >> insert_flags.txt
cat << EOL >> insert_flags.txt
--benchmarks=fillseq
--threads=1
--disable_wal=1
--use_existing_db=0
--num=$NUM_KEYS
EOL
cp $testdir/common_flags.txt randread_flags.txt
echo "--benchmarks=readrandom" >> randread_flags.txt
echo "--threads=16" >> randread_flags.txt
echo "--duration=$DURATION" >> randread_flags.txt
echo "--disable_wal=1" >> randread_flags.txt
echo "--use_existing_db=1" >> randread_flags.txt
echo "--num=$NUM_KEYS" >> randread_flags.txt
cat << EOL >> randread_flags.txt
--benchmarks=readrandom
--threads=16
--duration=$DURATION
--disable_wal=1
--use_existing_db=1
--num=$NUM_KEYS
EOL
cp $testdir/common_flags.txt overwrite_flags.txt
echo "--benchmarks=overwrite" >> overwrite_flags.txt
echo "--threads=1" >> overwrite_flags.txt
echo "--duration=$DURATION" >> overwrite_flags.txt
echo "--disable_wal=1" >> overwrite_flags.txt
echo "--use_existing_db=1" >> overwrite_flags.txt
echo "--num=$NUM_KEYS" >> overwrite_flags.txt
cat << EOL >> overwrite_flags.txt
--benchmarks=overwrite
--threads=1
--duration=$DURATION
--disable_wal=1
--use_existing_db=1
--num=$NUM_KEYS
EOL
cp $testdir/common_flags.txt readwrite_flags.txt
echo "--benchmarks=readwhilewriting" >> readwrite_flags.txt
echo "--threads=4" >> readwrite_flags.txt
echo "--duration=$DURATION" >> readwrite_flags.txt
echo "--disable_wal=1" >> readwrite_flags.txt
echo "--use_existing_db=1" >> readwrite_flags.txt
echo "--num=$NUM_KEYS" >> readwrite_flags.txt
cat << EOL >> readwrite_flags.txt
--benchmarks=readwhilewriting
--threads=4
--duration=$DURATION
--disable_wal=1
--use_existing_db=1
--num=$NUM_KEYS
EOL
cp $testdir/common_flags.txt writesync_flags.txt
echo "--benchmarks=overwrite" >> writesync_flags.txt
echo "--threads=1" >> writesync_flags.txt
echo "--duration=$DURATION" >> writesync_flags.txt
echo "--disable_wal=0" >> writesync_flags.txt
echo "--use_existing_db=1" >> writesync_flags.txt
echo "--sync=1" >> writesync_flags.txt
echo "--num=$NUM_KEYS" >> writesync_flags.txt
cat << EOL >> writesync_flags.txt
--benchmarks=overwrite
--threads=1
--duration=$DURATION
--disable_wal=0
--use_existing_db=1
--sync=1
--num=$NUM_KEYS
EOL
timing_enter rocksdb_insert
run_step insert

View File

@ -29,11 +29,13 @@ $rpc_py bdev_lvol_create -l lvs0 lvol0 32
killprocess $bdev_svc_pid
# Minimal number of bdev io pool (128) and cache (1)
echo "[Bdev]" > $testdir/bdevperf.conf
echo "BdevIoPoolSize 128" >> $testdir/bdevperf.conf
echo "BdevIoCacheSize 1" >> $testdir/bdevperf.conf
echo "[AIO]" >> $testdir/bdevperf.conf
echo "AIO $testdir/aio.bdev aio0 4096" >> $testdir/bdevperf.conf
cat << EOL > $testdir/bdevperf.conf
[Bdev]
BdevIoPoolSize 128
BdevIoCacheSize 1
[AIO]
AIO $testdir/aio.bdev aio0 4096
EOL
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 128 -o 4096 -w write -t 5 -r /var/tmp/spdk.sock &
bdev_perf_pid=$!

View File

@ -84,22 +84,23 @@ export UBSAN_OPTIONS='halt_on_error=1:print_stacktrace=1:abort_on_error=1'
# and known leaks in external executables or libraries from showing up.
asan_suppression_file="/var/tmp/asan_suppression_file"
sudo rm -rf "$asan_suppression_file"
cat << EOL >> "$asan_suppression_file"
# ASAN has some bugs around thread_local variables. We have a destructor in place
# to free the thread contexts, but ASAN complains about the leak before those
# destructors have a chance to run. So suppress this one specific leak using
# LSAN_OPTIONS.
echo "leak:spdk_fs_alloc_thread_ctx" >> "$asan_suppression_file"
leak:spdk_fs_alloc_thread_ctx
# Suppress known leaks in fio project
echo "leak:/usr/src/fio/parse.c" >> "$asan_suppression_file"
echo "leak:/usr/src/fio/iolog.c" >> "$asan_suppression_file"
echo "leak:/usr/src/fio/init.c" >> "$asan_suppression_file"
echo "leak:fio_memalign" >> "$asan_suppression_file"
echo "leak:spdk_fio_io_u_init" >> "$asan_suppression_file"
leak:/usr/src/fio/parse.c
leak:/usr/src/fio/iolog.c
leak:/usr/src/fio/init.c
leak:fio_memalign
leak:spdk_fio_io_u_init
# Suppress leaks in libiscsi
echo "leak:libiscsi.so" >> "$asan_suppression_file"
leak:libiscsi.so
EOL
# Suppress leaks in libfuse3
echo "leak:libfuse3.so" >> "$asan_suppression_file"
@ -766,9 +767,11 @@ ramp_time=0
EOL
if [ "$workload" == "verify" ]; then
echo "verify=sha1" >> $config_file
echo "verify_backlog=1024" >> $config_file
echo "rw=randwrite" >> $config_file
cat <<- EOL >> $config_file
verify=sha1
verify_backlog=1024
rw=randwrite
EOL
# To avoid potential data race issue due to the AIO device
# flush mechanism, add the flag to serialize the writes.

View File

@ -56,10 +56,12 @@ timing_enter create_subsystems
rm -rf $testdir/rpcs.txt
for i in $(seq 1 $num_subsystems)
do
echo bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i >> $testdir/rpcs.txt
echo nvmf_create_subsystem nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i >> $testdir/rpcs.txt
echo nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i Malloc$i >> $testdir/rpcs.txt
echo nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT >> $testdir/rpcs.txt
cat <<- EOL >> $testdir/rpcs.txt
bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i
nvmf_create_subsystem nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i
nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i Malloc$i
nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
EOL
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode$i traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT hostaddr:$NVMF_FIRST_TARGET_IP\" Nvme$i" >> $testdir/bdevperf.conf
done

View File

@ -23,9 +23,11 @@ function prepare_fio_cmd_tc1() {
cp $fio_job $tmp_detach_job
vm_check_scsi_location $vm_num
for disk in $SCSI_DISK; do
echo "[nvme-host$disk]" >> $tmp_detach_job
echo "filename=/dev/$disk" >> $tmp_detach_job
echo "size=100%" >> $tmp_detach_job
cat <<- EOL >> $tmp_detach_job
[nvme-host$disk]
filename=/dev/$disk
size=100%
EOL
done
vm_scp "$vm_num" $tmp_detach_job 127.0.0.1:/root/default_integrity_2discs.job
run_fio+="--client=127.0.0.1,$(vm_fio_socket $vm_num) --remote-config /root/default_integrity_2discs.job "