@@ -15,7 +15,6 @@ _begin_fstest ioctl trim auto
tmp=`mktemp -d`
trap "_cleanup; exit \$status" 0 1 3
trap "_destroy; exit \$status" 2 15
-chpid=0
mypid=$$
# Import common functions.
@@ -151,29 +150,28 @@ function check_sums() {
function run_process() {
local p=$1
- repeat=10
+ if [ -n "$SOAK_DURATION" ]; then
+ local duration="$SOAK_DURATION"
+ else
+ local duration="$((30 * TIME_FACTOR))"
+ fi
+ local stopat="$(( $(date +%s) + duration))"
- sleep $((5*$p))s &
- export chpid=$! && wait $chpid &> /dev/null
- chpid=0
-
- while [ $repeat -gt 0 ]; do
+ sleep $((5*$p))s
+ while [ "$(date +%s)" -lt "$stopat" ]; do
# Remove old directories.
rm -rf $SCRATCH_MNT/$p
- export chpid=$! && wait $chpid &> /dev/null
# Copy content -> partition.
mkdir $SCRATCH_MNT/$p
cp -axT $content/ $SCRATCH_MNT/$p/
- export chpid=$! && wait $chpid &> /dev/null
check_sums
- repeat=$(( $repeat - 1 ))
done
}
-nproc=20
+nproc=$((4 * LOAD_FACTOR))
# Copy $here to the scratch fs and make coipes of the replica. The fstests
# output (and hence $seqres.full) could be in $here, so we need to snapshot
@@ -194,11 +192,9 @@ pids=""
echo run > $tmp.fstrim_loop
fstrim_loop &
fstrim_pid=$!
-p=1
-while [ $p -le $nproc ]; do
+for ((p = 1; p < nproc; p++)); do
run_process $p &
pids="$pids $!"
- p=$(($p+1))
done
echo "done."