15
15
# Copyright (c) 2016, Intel Corporation.
16
16
#
17
17
18
- . $STF_SUITE/include/libtest.shlib
18
+ . " $STF_SUITE" /include/libtest.shlib
19
19
20
20
# Defaults common to all the tests in the regression group
21
21
export PERF_RUNTIME=${PERF_RUNTIME:-'180'}
@@ -46,12 +46,12 @@ function get_suffix
46
46
typeset sync=$2
47
47
typeset iosize=$3
48
48
49
- typeset sync_str=$(get_sync_str $sync)
49
+ typeset sync_str=$(get_sync_str " $sync" )
50
50
typeset filesystems=$(get_nfilesystems)
51
51
52
52
typeset suffix="$sync_str.$iosize-ios"
53
53
suffix="$suffix.$threads-threads.$filesystems-filesystems"
54
- echo $suffix
54
+ echo " $suffix"
55
55
}
56
56
57
57
function do_fio_run_impl
@@ -65,12 +65,12 @@ function do_fio_run_impl
65
65
typeset sync=$6
66
66
typeset iosize=$7
67
67
68
- typeset sync_str=$(get_sync_str $sync)
68
+ typeset sync_str=$(get_sync_str " $sync" )
69
69
log_note "Running with $threads $sync_str threads, $iosize ios"
70
70
71
71
if [[ -n $threads_per_fs && $threads_per_fs -ne 0 ]]; then
72
- log_must test $do_recreate
73
- verify_threads_per_fs $threads $threads_per_fs
72
+ log_must test " $do_recreate"
73
+ verify_threads_per_fs " $threads" " $threads_per_fs"
74
74
fi
75
75
76
76
if $do_recreate; then
@@ -105,7 +105,7 @@ function do_fio_run_impl
105
105
# the default filesystem (e.g. against a clone).
106
106
#
107
107
export DIRECTORY=$(get_directory)
108
- log_note "DIRECTORY: " $DIRECTORY
108
+ log_note "DIRECTORY: $DIRECTORY"
109
109
110
110
export RUNTIME=$PERF_RUNTIME
111
111
export RANDSEED=$PERF_RANDSEED
@@ -122,33 +122,33 @@ function do_fio_run_impl
122
122
# disable client cache for reads.
123
123
if [[ $NFS -eq 1 ]]; then
124
124
export DIRECT=1
125
- do_setup_nfs $script
125
+ do_setup_nfs " $script"
126
126
else
127
127
export DIRECT=0
128
128
fi
129
129
130
130
# This will be part of the output filename.
131
- typeset suffix=$(get_suffix $threads $sync $iosize)
131
+ typeset suffix=$(get_suffix " $threads" " $sync" " $iosize" )
132
132
133
133
# Start the data collection
134
- do_collect_scripts $suffix
134
+ do_collect_scripts " $suffix"
135
135
136
136
# Define output file
137
137
typeset logbase="$(get_perf_output_dir)/$(basename \
138
- $SUDO_COMMAND)"
138
+ " $SUDO_COMMAND" )"
139
139
typeset outfile="$logbase.fio.$suffix"
140
140
141
141
# Start the load
142
142
if [[ $NFS -eq 1 ]]; then
143
- log_must ssh -t $NFS_USER@$NFS_CLIENT "
143
+ log_must ssh -t " $NFS_USER@$NFS_CLIENT" "
144
144
fio --output-format=${PERF_FIO_FORMAT} \
145
145
--output /tmp/fio.out /tmp/test.fio
146
146
"
147
- log_must scp $NFS_USER@$NFS_CLIENT:/tmp/fio.out $outfile
148
- log_must ssh -t $NFS_USER@$NFS_CLIENT "sudo -S umount $NFS_MOUNT"
147
+ log_must scp " $NFS_USER@$NFS_CLIENT" :/tmp/fio.out " $outfile"
148
+ log_must ssh -t " $NFS_USER@$NFS_CLIENT" "sudo -S umount $NFS_MOUNT"
149
149
else
150
- log_must fio --output-format=${PERF_FIO_FORMAT} \
151
- --output $outfile $FIO_SCRIPTS/$script
150
+ log_must fio --output-format=" ${PERF_FIO_FORMAT}" \
151
+ --output " $outfile" " $FIO_SCRIPTS/$script"
152
152
fi
153
153
}
154
154
@@ -176,13 +176,13 @@ function do_fio_run
176
176
for sync in $PERF_SYNC_TYPES; do
177
177
for iosize in $PERF_IOSIZES; do
178
178
do_fio_run_impl \
179
- $script \
180
- $do_recreate \
181
- $clear_cache \
182
- $threads \
183
- $threads_per_fs \
184
- $sync \
185
- $iosize
179
+ " $script" \
180
+ " $do_recreate" \
181
+ " $clear_cache" \
182
+ " $threads" \
183
+ " $threads_per_fs" \
184
+ " $sync" \
185
+ " $iosize"
186
186
done
187
187
done
188
188
done
@@ -195,12 +195,12 @@ function do_fio_run
195
195
function do_setup_nfs
196
196
{
197
197
typeset script=$1
198
- zfs set sharenfs=on $TESTFS
199
- log_must chmod -R 777 /$TESTFS
198
+ zfs set sharenfs=on " $TESTFS"
199
+ log_must chmod -R 777 /" $TESTFS"
200
200
201
- ssh -t $NFS_USER@$NFS_CLIENT "mkdir -m 777 -p $NFS_MOUNT"
202
- ssh -t $NFS_USER@$NFS_CLIENT "sudo -S umount $NFS_MOUNT"
203
- log_must ssh -t $NFS_USER@$NFS_CLIENT "
201
+ ssh -t " $NFS_USER@$NFS_CLIENT" "mkdir -m 777 -p $NFS_MOUNT"
202
+ ssh -t " $NFS_USER@$NFS_CLIENT" "sudo -S umount $NFS_MOUNT"
203
+ log_must ssh -t " $NFS_USER@$NFS_CLIENT" "
204
204
sudo -S mount $NFS_OPTIONS $NFS_SERVER:/$TESTFS $NFS_MOUNT
205
205
"
206
206
#
@@ -211,9 +211,9 @@ function do_setup_nfs
211
211
export jobnum='$jobnum'
212
212
while read line; do
213
213
eval echo "$line"
214
- done < $FIO_SCRIPTS/$script > /tmp/test.fio
214
+ done < " $FIO_SCRIPTS/$script" > /tmp/test.fio
215
215
log_must sed -i -e "s%directory.*%directory=$NFS_MOUNT%" /tmp/test.fio
216
- log_must scp /tmp/test.fio $NFS_USER@$NFS_CLIENT:/tmp
216
+ log_must scp /tmp/test.fio " $NFS_USER@$NFS_CLIENT" :/tmp
217
217
log_must rm /tmp/test.fio
218
218
}
219
219
@@ -233,17 +233,17 @@ function do_collect_scripts
233
233
typeset oIFS=$IFS
234
234
IFS=','
235
235
for item in $PERF_COLLECT_SCRIPTS; do
236
- collect_scripts+=($(echo $item | sed 's/^ *//g'))
236
+ collect_scripts+=($(echo " $item" | sed 's/^ *//g'))
237
237
done
238
238
IFS=$oIFS
239
239
240
240
typeset idx=0
241
241
while [[ $idx -lt "${#collect_scripts[@]}" ]]; do
242
242
typeset logbase="$(get_perf_output_dir)/$(basename \
243
- $SUDO_COMMAND)"
243
+ " $SUDO_COMMAND" )"
244
244
typeset outfile="$logbase.${collect_scripts[$idx + 1]}.$suffix"
245
245
246
- timeout $PERF_RUNTIME ${collect_scripts[$idx]} > $outfile 2>&1 &
246
+ timeout " $PERF_RUNTIME" " ${collect_scripts[$idx]}" >" $outfile" 2>&1 &
247
247
((idx += 2))
248
248
done
249
249
@@ -256,9 +256,9 @@ function do_collect_scripts
256
256
function get_perf_output_dir
257
257
{
258
258
typeset dir="$PWD/perf_data"
259
- [[ -d $dir ]] || mkdir -p $dir
259
+ [[ -d $dir ]] || mkdir -p " $dir"
260
260
261
- echo $dir
261
+ echo " $dir"
262
262
}
263
263
264
264
function apply_zinject_delays
@@ -270,7 +270,7 @@ function apply_zinject_delays
270
270
271
271
for disk in $DISKS; do
272
272
log_must zinject \
273
- -d $disk -D ${ZINJECT_DELAYS[$idx]} $PERFPOOL
273
+ -d " $disk" -D " ${ZINJECT_DELAYS[$idx]}" " $PERFPOOL"
274
274
done
275
275
276
276
((idx += 1))
@@ -302,16 +302,16 @@ function recreate_perf_pool
302
302
# This function handles the case where the pool already exists,
303
303
# and will destroy the previous pool and recreate a new pool.
304
304
#
305
- create_pool $PERFPOOL $DISKS
305
+ create_pool " $PERFPOOL" " $DISKS"
306
306
}
307
307
308
308
function verify_threads_per_fs
309
309
{
310
310
typeset threads=$1
311
311
typeset threads_per_fs=$2
312
312
313
- log_must test -n $threads
314
- log_must test -n $threads_per_fs
313
+ log_must test -n " $threads"
314
+ log_must test -n " $threads_per_fs"
315
315
316
316
#
317
317
# A value of "0" is treated as a "special value", and it is
@@ -325,7 +325,7 @@ function verify_threads_per_fs
325
325
# than or equal to zero; since we just verified the value isn't
326
326
# 0 above, then it must be greater than zero here.
327
327
#
328
- log_must test $threads_per_fs -ge 0
328
+ log_must test " $threads_per_fs" -ge 0
329
329
330
330
#
331
331
# This restriction can be lifted later if needed, but for now,
@@ -341,9 +341,9 @@ function populate_perf_filesystems
341
341
typeset nfilesystems=${1:-1}
342
342
343
343
export TESTFS=""
344
- for i in $(seq 1 $nfilesystems); do
344
+ for i in $(seq 1 " $nfilesystems" ); do
345
345
typeset dataset="$PERFPOOL/fs$i"
346
- create_dataset $dataset $PERF_FS_OPTS
346
+ create_dataset " $dataset" " $PERF_FS_OPTS"
347
347
if [[ -z "$TESTFS" ]]; then
348
348
TESTFS="$dataset"
349
349
else
@@ -354,13 +354,13 @@ function populate_perf_filesystems
354
354
355
355
function get_nfilesystems
356
356
{
357
- typeset filesystems=( $TESTFS )
357
+ typeset filesystems=($TESTFS)
358
358
echo ${#filesystems[@]}
359
359
}
360
360
361
361
function get_directory
362
362
{
363
- typeset filesystems=( $TESTFS )
363
+ typeset filesystems=($TESTFS)
364
364
typeset directory=
365
365
366
366
typeset idx=0
@@ -376,7 +376,7 @@ function get_directory
376
376
((idx += 1))
377
377
done
378
378
379
- echo $directory
379
+ echo " $directory"
380
380
}
381
381
382
382
function get_min_arc_size
@@ -447,43 +447,43 @@ function get_dbuf_cache_size
447
447
dbuf_cache_size=$(($(get_arc_target) / 2**dbuf_cache_shift))
448
448
fi || log_fail "get_dbuf_cache_size failed"
449
449
450
- echo $dbuf_cache_size
450
+ echo " $dbuf_cache_size"
451
451
}
452
452
453
453
# Create a file with some information about how this system is configured.
454
454
function get_system_config
455
455
{
456
456
typeset config=$PERF_DATA_DIR/$1
457
457
458
- echo "{" >>$config
458
+ echo "{" >>" $config"
459
459
if is_linux; then
460
- echo " \"ncpus\": \"$(lscpu | awk '/^CPU\(s\)/ {print $2; exit}')\"," >>$config
460
+ echo " \"ncpus\": \"$(lscpu | awk '/^CPU\(s\)/ {print $2; exit}')\"," >>" $config"
461
461
echo " \"physmem\": \"$(free -b | \
462
- awk '$1 == "Mem:" { print $2 }')\"," >>$config
463
- echo " \"c_max\": \"$(get_max_arc_size)\"," >>$config
464
- echo " \"hostname\": \"$(uname -n)\"," >>$config
465
- echo " \"kernel version\": \"$(uname -sr)\"," >>$config
462
+ awk '$1 == "Mem:" { print $2 }')\"," >>" $config"
463
+ echo " \"c_max\": \"$(get_max_arc_size)\"," >>" $config"
464
+ echo " \"hostname\": \"$(uname -n)\"," >>" $config"
465
+ echo " \"kernel version\": \"$(uname -sr)\"," >>" $config"
466
466
else
467
467
dtrace -qn 'BEGIN{
468
468
printf(" \"ncpus\": %d,\n", `ncpus);
469
469
printf(" \"physmem\": %u,\n", `physmem * `_pagesize);
470
470
printf(" \"c_max\": %u,\n", `arc_stats.arcstat_c_max.value.ui64);
471
471
printf(" \"kmem_flags\": \"0x%x\",", `kmem_flags);
472
- exit(0)}' >>$config
473
- echo " \"hostname\": \"$(uname -n)\"," >>$config
474
- echo " \"kernel version\": \"$(uname -v)\"," >>$config
472
+ exit(0)}' >>" $config"
473
+ echo " \"hostname\": \"$(uname -n)\"," >>" $config"
474
+ echo " \"kernel version\": \"$(uname -v)\"," >>" $config"
475
475
fi
476
476
if is_linux; then
477
477
lsblk -dino NAME,SIZE | awk 'BEGIN {
478
478
printf(" \"disks\": {\n"); first = 1}
479
479
{disk = $1} {size = $2;
480
480
if (first != 1) {printf(",\n")} else {first = 0}
481
481
printf(" \"%s\": \"%s\"", disk, size)}
482
- END {printf("\n },\n")}' >>$config
482
+ END {printf("\n },\n")}' >>" $config"
483
483
484
484
zfs_tunables="/sys/module/zfs/parameters"
485
485
486
- printf " \"tunables\": {\n" >>$config
486
+ printf " \"tunables\": {\n" >>" $config"
487
487
for tunable in \
488
488
zfs_arc_max \
489
489
zfs_arc_sys_free \
@@ -500,28 +500,28 @@ function get_system_config
500
500
do
501
501
if [ "$tunable" != "zfs_arc_max" ]
502
502
then
503
- printf ",\n" >>$config
503
+ printf ",\n" >>" $config"
504
504
fi
505
505
printf " \"$tunable\": \"$(<$zfs_tunables/$tunable)\"" \
506
- >>$config
506
+ >>" $config"
507
507
done
508
- printf "\n }\n" >>$config
508
+ printf "\n }\n" >>" $config"
509
509
else
510
510
iostat -En | awk 'BEGIN {
511
511
printf(" \"disks\": {\n"); first = 1}
512
512
/^c/ {disk = $1}
513
513
/^Size: [^0]/ {size = $2;
514
514
if (first != 1) {printf(",\n")} else {first = 0}
515
515
printf(" \"%s\": \"%s\"", disk, size)}
516
- END {printf("\n },\n")}' >>$config
516
+ END {printf("\n },\n")}' >>" $config"
517
517
518
518
sed -n 's/^set \(.*\)[ ]=[ ]\(.*\)/\1=\2/p' /etc/system | \
519
519
awk -F= 'BEGIN {printf(" \"system\": {\n"); first = 1}
520
520
{if (first != 1) {printf(",\n")} else {first = 0};
521
521
printf(" \"%s\": %s", $1, $2)}
522
- END {printf("\n }\n")}' >>$config
522
+ END {printf("\n }\n")}' >>" $config"
523
523
fi
524
- echo "}" >>$config
524
+ echo "}" >>" $config"
525
525
}
526
526
527
527
#
@@ -535,33 +535,33 @@ function pool_to_lun_list
535
535
536
536
case "$UNAME" in
537
537
Linux)
538
- ctds=$(zpool list -HLv $pool | \
538
+ ctds=$(zpool list -HLv " $pool" | \
539
539
awk '/sd[a-z]*|loop[0-9]*|dm-[0-9]*/ {print $1}')
540
540
541
541
for ctd in $ctds; do
542
542
lun_list="$lun_list$ctd:"
543
543
done
544
544
;;
545
545
FreeBSD)
546
- lun_list+=$(zpool list -HLv $pool | \
546
+ lun_list+=$(zpool list -HLv " $pool" | \
547
547
awk '/a?da[0-9]+|md[0-9]+|mfid[0-9]+|nda[0-9]+|nvd[0-9]+|vtbd[0-9]+/
548
548
{ printf "%s:", $1 }')
549
549
;;
550
550
*)
551
- ctds=$(zpool list -v $pool |
551
+ ctds=$(zpool list -v " $pool" |
552
552
awk '/c[0-9]*t[0-9a-fA-F]*d[0-9]*/ {print $1}')
553
553
554
554
for ctd in $ctds; do
555
555
# Get the device name as it appears in /etc/path_to_inst
556
- devname=$(readlink -f /dev/dsk/${ctd}s0 | sed -n 's/\/devices\([^:]*\):.*/\1/p')
556
+ devname=$(readlink -f /dev/dsk/" ${ctd}" s0 | sed -n 's/\/devices\([^:]*\):.*/\1/p')
557
557
# Add a string composed of the driver name and instance
558
558
# number to the list for comparison with dev_statname.
559
559
lun=$(sed 's/"//g' /etc/path_to_inst | awk -v dn="$devname" '$0 ~ dn {print $3$2}')
560
560
lun_list="$lun_list$lun:"
561
561
done
562
562
;;
563
563
esac
564
- echo $lun_list
564
+ echo " $lun_list"
565
565
}
566
566
567
567
function print_perf_settings
0 commit comments