Commit 4d8d202b authored by yoogx's avatar yoogx
Browse files

* Add templates to run cppcheck, valgrind and gcov

        For issue #19
parent 47f1455b
EXTRA_DIST=$(srcdir)/x86-rtems-boot.img \
$(srcdir)/gumstix-uboot.bin \
$(srcdir)/xpath
EXTRA_DIST=$(srcdir)/x86-rtems-boot.img $(srcdir)/gumstix-uboot.bin \
$(srcdir)/template_sonar-project.properties \
$(srcdir)/template_lcov_gen.sh \
$(srcdir)/template_prof_gen.sh $(srcdir)/xpath
CLEANFILES = *~
......@@ -13,5 +14,3 @@ install-data-local:
uninstall-local:
rm -rf $(DESTDIR)$(utilssrc)
#!/bin/sh
for i in "$@"
do
case $i in
--output-dir-name=*)
OUTPUT_DIR="${i#*=}" #ONLY NAME OF DIR
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
if [ -z "$OUTPUT_DIR" ]; then
OUTPUT_DIR=./gcov_output
else
OUTPUT_DIR=./$OUTPUT_DIR
fi
if (! test -d $OUTPUT_DIR )
then
echo "Missing path: $OUTPUT_DIR. Creating directory..."
mkdir $OUTPUT_DIR
fi
lcov -c -i -d $PWD -o .coverage.base
lcov -c -d $PWD -o .coverage.run
lcov -d $PWD -a .coverage.base -a .coverage.run -o .coverage.total
genhtml --no-branch-coverage -o $OUTPUT_DIR .coverage.total
rm -f .coverage.base .coverage.run .coverage.total
#!/bin/sh
EXEC_FILE_PATH=./@PROGRAM_NAME@
for i in "$@"
do
case $i in
--output-dir-name=*)
OUTPUT_DIR="${i#*=}" #ONLY NAME OF DIR
shift # past argument=value
;;
--check=*)
CHECK_OPTION="${i#*=}" #call:callgrind or cache:cachegrind
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
if [ -z "$OUTPUT_DIR" ]; then
OUTPUT_DIR=./prof_output
else
OUTPUT_DIR=./$OUTPUT_DIR
fi
if (! test -d $OUTPUT_DIR )
then
echo "Missing path: $OUTPUT_DIR. Creating directory..."
mkdir $OUTPUT_DIR
fi
if [ "$CHECK_OPTION" = "cache" ]; then
valgrind --tool=cachegrind --log-file=valgrind_callgrind.log --cachegrind-out-file=$OUTPUT_DIR/cachegrind.out $EXEC_FILE_PATH
cg_annotate --show=Dr,Dw $OUTPUT_DIR/cachegrind.out > $OUTPUT_DIR/cachegrind_an.txt
#To tell callgrind_annotate to dump out the xxx.c file and to annotate each line with the number of instrustions it took:
#$ callgrind_annotate {callgrind.out path}/callgrind.out {xxx.c path}/xxx.c
elif [ "$CHECK_OPTION" = "call" ]; then
valgrind --dsymutil=yes --tool=callgrind --log-file=valgrind_callgrind.log --callgrind-out-file=$OUTPUT_DIR/callgrind.out $EXEC_FILE_PATH
callgrind_annotate $OUTPUT_DIR/callgrind.out > $OUTPUT_DIR/callgrind_an.txt
elif [ "$CHECK_OPTION" = "massif" ]; then
valgrind --tool=massif --stacks=yes --log-file=valgrind_callgrind.log --massif-out-file=$OUTPUT_DIR/massif.out $EXEC_FILE_PATH
ms_print $OUTPUT_DIR/massif.out > $OUTPUT_DIR/massif_an.txt
elif [ "$CHECK_OPTION" = "mem" ]; then
valgrind --tool=memcheck --leak-check=full --log-file=valgrind_memcheck.log $EXEC_FILE_PATH
valgrind --tool=memcheck --leak-check=full --xml=yes --xml-file=valgrind_memcheck.xml $EXEC_FILE_PATH
#valgrind --tool=memcheck --leak-check=full --log-file=valgrind_memcheck.log $EXEC_FILE_PATH 2> $OUTPUT_DIR/memcheck_an.txt
#valgrind --tool=memcheck --leak-check=full $EXEC_FILE_PATH 2> $OUTPUT_DIR/memcheck_an.txt
else
echo "Unknown option"
fi
sonar.projectKey=@PROJECT_KEY@
sonar.projectName=@PROJECT_NAME@
sonar.projectVersion=1.0
sonar.projectBaseDir=@MASTER_PROJECT_DIR@
#SCM plugin
sonar.scm.disabled=true
#sonarc++ plugin
#sonar.cfamily.build-wrapper-output=bwoutput
#sonarCXX plugin
sonar.cxx.cFilesPatterns=*.c,*.h
sonar.cxx.compiler.parser=GCC
sonar.cxx.compiler.charset=UTF-8
sonar.cxx.compiler.regex=^(.*):([0-9]+):[0-9]+: warning: (.*)\\[(.*)\\]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment