mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
add valgrind test for mediafire-fuse and fix memleaks
This commit is contained in:
46
tests/valgrind_fuse.sh
Executable file
46
tests/valgrind_fuse.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
case $# in
|
||||
0)
|
||||
source_dir="."
|
||||
binary_dir="."
|
||||
;;
|
||||
2)
|
||||
source_dir=$1
|
||||
binary_dir=$2
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 [source_dir] [binary_dir]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
cmd="valgrind --suppressions="${source_dir}/valgrind.supp" --fullpath-after="$source_dir" --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 --quiet"
|
||||
|
||||
if [ ! -f "./.mediafire-tools.conf" -a ! -f "~/.mediafire-tools.conf" ]; then
|
||||
echo "no configuration file found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ `mount -t fuse.mediafire-fuse | wc -l` -ne 0 ]; then
|
||||
echo "a fuse fs is already mounted" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$cmd "${binary_dir}/mediafire-fuse" -s -f -d /mnt &
|
||||
fusepid="$!"
|
||||
|
||||
# once the file system is found to be mounted, print the tree and unmount
|
||||
while sleep 1; do
|
||||
if [ `mount -t fuse.mediafire-fuse | wc -l` -ne 0 ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
tree /mnt
|
||||
|
||||
fusermount -u /mnt
|
||||
|
||||
wait "$fusepid"
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
case $# in
|
||||
0)
|
||||
source_dir="."
|
||||
Reference in New Issue
Block a user