summaryrefslogtreecommitdiff
diff options
authorPMR <pmr@pmr-lander>2017-02-23 09:41:35 +0000
committerPMR <pmr@pmr-lander>2017-02-23 09:41:35 +0000
commit6f9ef79166f72bdd7050ea6b7e8917721635f8c6 (patch)
tree524fca2e2df7a75dcaa4913c9a8b724e58ed94c0
parent6d190232a1ad63b0065d2de0483547d0675d2d45 (diff)
parentb53fb0ac87dd52f2157416dcf92230347604eece (diff)
Merge #317948 from ~pierre-equoy/plainbox-provider-checkbox:1660386-fix-dest-dir
-rwxr-xr-xbin/storage_test29
1 files changed, 27 insertions, 2 deletions
diff --git a/bin/storage_test b/bin/storage_test
index 40cc3f2c..1aed0dab 100755
--- a/bin/storage_test
+++ b/bin/storage_test
@@ -59,6 +59,7 @@ find_largest_partition() {
} # find_largest_partition()
disk=/dev/$1
+scripted_mount=0
if [ -b $disk ]
then
@@ -93,10 +94,13 @@ then
find_largest_partition
if [ -n "$largest_part" ]
then
- dest=/tmp/drive/$partition
+ dest=`mktemp -dq --tmpdir drive.XXX`
echo "Mounting $largest_part into $dest..."
- mkdir -p $dest
mount $largest_part $dest
+ if [[ $? == 0 ]]
+ then
+ scripted_mount=1
+ fi
else
echo "$disk has no partition. Please format this drive and re-launch the test."
exit 1
@@ -115,12 +119,33 @@ then
if [ $size_int -gt 10 ]
then
run_bonnie $disk
+ if [[ $scripted_mount == 1 ]]
+ then
+ echo "$largest_part was mounted by this script. Unmounting it now..."
+ umount $largest_part
+ echo "Removing temporary mount directory $dest..."
+ rm -rf $dest
+ fi
else
echo "$disk is too small to be used for testing."
+ if [[ $scripted_mount == 1 ]]
+ then
+ echo "$largest_part was mounted by this script. Unmounting it now..."
+ umount $largest_part
+ echo "Removing temporary mount directory $dest..."
+ rm -rf $dest
+ fi
exit 1
fi
else
run_bonnie $disk
+ if [[ $scripted_mount == 1 ]]
+ then
+ echo "$largest_part was mounted by this script. Unmounting it now..."
+ umount $largest_part
+ echo "Removing temporary mount directory $dest..."
+ rm -rf $dest
+ fi
fi
else
echo "$disk doesn't report a size."