aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-11-17 17:57:20 +0100
committerKarel Kočí <cynerd@email.cz>2016-11-17 17:57:20 +0100
commit33fcbdeef12b2831cff2dc6eee7c5b48e34d0851 (patch)
tree36fde3beca7695ab55e46910443ec25e64d55ea9
parentad2a23815a49245117cadbfcb6a59dfd6fc95483 (diff)
downloadgeml-master.tar.gz
geml-master.tar.bz2
geml-master.zip
Add tests target and some fixesHEADmaster
For now only cppcheck is implemented.
-rw-r--r--Makefile5
-rwxr-xr-xconfigure4
-rw-r--r--src/args_parser.c2
-rw-r--r--src/utils.c1
-rw-r--r--tests/tests.mk16
5 files changed, 27 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 780c5d4..a0d7c21 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,8 @@ help:
@echo " docs - Build html documentation"
@echo " serve-docs - Start html server with documentation on localhost:8000"
@echo " clean-docs - Removes generated documentation"
+ @echo " tests - Executes all tests"
+ @echo " help-test - Prints help for all implemented tests"
@echo "Some enviroment variables to be defined:"
@echo " Q - Define emty to show executed commands"
@@ -80,6 +82,9 @@ distclean:: clean clean-docs
@echo " CLEAN configuration"
$(Q)$(RM) $(O)/.config
+# Include test targets
+include tests/tests.mk
+
## Building targets ##
ifeq (,$(filter clean distclean help docs serve-docs clean-docs \
,$(MAKECMDGOALS))) # Ignore build targets if goal is not building
diff --git a/configure b/configure
index 6f8044b..61d988c 100755
--- a/configure
+++ b/configure
@@ -17,6 +17,8 @@ LFLAGS:::T:F
INSTALL:install::T:F
GZIP:gzip::T:F
DOT:dot::T:F
+CPPCHECK:cppcheck::T:F
+VALGRIND:valgrind::T:F
MKDOCS:mkdocs::T:F"
############################################################################
# TODO add options to fine tune installation directories
@@ -45,6 +47,8 @@ print_help() {
echo " INSTALL Copy files and set attributes."
echo " GZIP Compress file."
echo " DOT Directed graphs drawing program."
+ echo " CPPCHECK Tool for static code analysis."
+ echo " VALGRIND Suite for debugging and profiling programs."
echo " MKDOCS Project documentation generator."
echo
echo "GEML version $GEML_VERSION"
diff --git a/src/args_parser.c b/src/args_parser.c
index be55e43..0de5ca2 100644
--- a/src/args_parser.c
+++ b/src/args_parser.c
@@ -26,7 +26,7 @@
#include "io.h"
const char *help_text =
- "Usage: geml [OPTIONS]... INPUT_FILE\n"
+ "Usage: geml [OPTION]... INPUT_FILE\n"
" General extendable macro language processing tool.\n"
"\n"
"Options:\n"
diff --git a/src/utils.c b/src/utils.c
index c545961..c52ed2f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -62,6 +62,7 @@ void print_message(const char *file, const int line, enum Verbosity level, const
va_list args;
va_start(args, msg);
vfprintf(stderr, msg, args);
+ va_end(args);
fputs("\n", stderr);
}
diff --git a/tests/tests.mk b/tests/tests.mk
new file mode 100644
index 0000000..33bc1e4
--- /dev/null
+++ b/tests/tests.mk
@@ -0,0 +1,16 @@
+# vim:ts=4:sw=4:noexpandtab
+
+.PHONY: help-test
+help-test::
+ @echo "General extendable macro language make test targets:"
+ @echo " tests - Executes all tests"
+ @echo " help-test - Prits help for all implemented tests"
+ @echo " cppcheck - Executes cppcheck on all compilled sources"
+
+.PHONY: tests
+tests: cppcheck
+
+.PHONY:
+cppcheck: $(CSRC)
+ @echo " CPPCHECK"
+ $(Q)$(CPPCHECK) --enable=all --std=c11 --error-exitcode=1 $(CSRC)