mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
Add valgrind tests and fix memleaks
This commit is contained in:
@@ -1,12 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $# in
|
||||
0)
|
||||
source_dir="."
|
||||
;;
|
||||
1)
|
||||
source_dir=$1
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 [source_dir]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=0
|
||||
find .. -name "*.c" -o -name "*.h" | while read f; do
|
||||
find "$source_dir" -name "*.c" -o -name "*.h" | while read f; do
|
||||
case $f in
|
||||
../*/CMakeFiles/*)
|
||||
${source_dir}/*/CMakeFiles/*)
|
||||
;;
|
||||
${source_dir}/CMakeFiles/*)
|
||||
;;
|
||||
*)
|
||||
INDENT_PROFILE=../.indent.pro indent -st $f | diff -u $f -
|
||||
INDENT_PROFILE="${source_dir}/.indent.pro" indent -st "$f" | diff -u "$f" -
|
||||
ret=$((ret+$?))
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -5,8 +5,20 @@ from __future__ import print_function
|
||||
import json
|
||||
import subprocess
|
||||
import shlex
|
||||
import sys
|
||||
import os
|
||||
|
||||
with open("compile_commands.json", "r") as f:
|
||||
if len(sys.argv) == 1:
|
||||
build_dir = "."
|
||||
elif len(sys.argv) == 2:
|
||||
build_dir = sys.argv[1]
|
||||
else:
|
||||
print("usage: %s [build_dir]"%sys.argv[0])
|
||||
exit(1)
|
||||
|
||||
compile_commands = os.path.join(build_dir, "compile_commands.json")
|
||||
|
||||
with open(compile_commands, "r") as f:
|
||||
tunits = json.load(f)
|
||||
|
||||
result = 0
|
||||
|
||||
20
tests/valgrind.sh
Executable file
20
tests/valgrind.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
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"
|
||||
|
||||
$cmd "${binary_dir}/mfshell" -c "help; whoami"
|
||||
Reference in New Issue
Block a user