diff options
author | a1346054 | 2021-08-31 17:01:47 +0000 |
---|---|---|
committer | rfjakob | 2021-09-01 10:22:01 +0200 |
commit | c63f7e9f64ee394b3311edb7f36f56fd786d145a (patch) | |
tree | 84dec7ad0b4759532f622174c008e3aa645c5a29 /tests/stress_tests/extractloop.bash | |
parent | c505e73a13d8e2083b53c5c1af1f937b46665abd (diff) |
shell scripts: fix shellcheck warnings
Diffstat (limited to 'tests/stress_tests/extractloop.bash')
-rwxr-xr-x | tests/stress_tests/extractloop.bash | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/tests/stress_tests/extractloop.bash b/tests/stress_tests/extractloop.bash index cdd0c25..1f78a5e 100755 --- a/tests/stress_tests/extractloop.bash +++ b/tests/stress_tests/extractloop.bash @@ -28,17 +28,17 @@ source ../fuse-unmount.bash # Setup dirs ../dl-linux-tarball.bash -cd $TMPDIR +cd "$TMPDIR" EXTRACTLOOP_TMPDIR=$TMPDIR/extractloop_tmpdir -mkdir -p $EXTRACTLOOP_TMPDIR -CRYPT=$(mktemp -d $EXTRACTLOOP_TMPDIR/XXX) +mkdir -p "$EXTRACTLOOP_TMPDIR" +CRYPT=$(mktemp -d "$EXTRACTLOOP_TMPDIR/XXX") CSV=$CRYPT.csv MNT=$CRYPT.mnt -mkdir $MNT +mkdir "$MNT" -function check_md5sums { +check_md5sums() { if command -v md5sum > /dev/null ; then - md5sum --status -c $1 + md5sum --status -c "$1" else # MacOS / darwin which do not have the md5sum utility # installed by default @@ -52,50 +52,50 @@ FS="" if [ $# -eq 1 ] && [ "$1" == "-encfs" ]; then FS=encfs echo "Testing EncFS" - encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null + encfs --extpass="echo test" --standard "$CRYPT" "$MNT" > /dev/null elif [ $# -eq 1 ] && [ "$1" == "-loopback" ]; then FS=loopback echo "Testing go-fuse loopback" rm -f /tmp/loopback*.memprof - loopback -memprofile=/tmp/loopback $MNT $CRYPT & + loopback -memprofile=/tmp/loopback "$MNT" "$CRYPT" & FSPID=$(jobs -p) disown else FS=gocryptfs echo "Testing gocryptfs" - gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT - gocryptfs -q -extpass="echo test" -nosyslog -fg $CRYPT $MNT & + gocryptfs -q -init -extpass="echo test" -scryptn=10 "$CRYPT" + gocryptfs -q -extpass="echo test" -nosyslog -fg "$CRYPT" "$MNT" & FSPID=$(jobs -p) disown - #gocryptfs -q -extpass="echo test" -nosyslog -memprofile /tmp/extractloop-mem $CRYPT $MNT + #gocryptfs -q -extpass="echo test" -nosyslog -memprofile /tmp/extractloop-mem "$CRYPT" "$MNT" fi echo "Test dir: $CRYPT" # Sleep to make sure the FS is already mounted on MNT sleep 1 -cd $MNT +cd "$MNT" -ln -v -sTf $CSV /tmp/extractloop.csv 2> /dev/null || true # fails on MacOS, ignore +ln -v -sTf "$CSV" /tmp/extractloop.csv 2> /dev/null || true # fails on MacOS, ignore # Cleanup trap # Note: gocryptfs may have already umounted itself because bash relays SIGINT # Just ignore unmount errors. trap cleanup_exit EXIT -function cleanup_exit { +cleanup_exit() { if [[ $FS == loopback ]]; then # SIGUSR1 causes loopback to write the memory profile to disk kill -USR1 $FSPID fi cd / - rm -Rf $CRYPT - fuse-unmount -z $MNT || true - rmdir $MNT + rm -Rf "$CRYPT" + fuse-unmount -z "$MNT" || true + rmdir "$MNT" } -function loop { +loop() { ID=$1 - mkdir $ID - cd $ID + mkdir "$ID" + cd "$ID" echo "[looper $ID] Starting" @@ -107,20 +107,20 @@ function loop { tar xf /tmp/linux-3.0.tar.gz --exclude linux-3.0/arch/microblaze/boot/dts/system.dts # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Exclude the one symlink in the tarball - causes problems on MacOS: "Can't set permissions to 0755" - check_md5sums $MD5 + check_md5sums "$MD5" rm -R linux-3.0 t2=$SECONDS delta=$((t2-t1)) if [[ $FSPID -gt 0 && -d /proc ]]; then RSS=$(grep VmRSS /proc/$FSPID/status | tr -s ' ' | cut -f2 -d ' ') - echo "$N,$SECONDS,$RSS,$delta" >> $CSV + echo "$N,$SECONDS,$RSS,$delta" >> "$CSV" fi echo "[looper $ID] Iteration $N done, $delta seconds, RSS $RSS kiB" - let N=$N+1 + N=$((N+1)) done } -function memprof { +memprof() { while true; do kill -USR1 $FSPID sleep 60 |