summaryrefslogtreecommitdiff
path: root/tests/daemon
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-02-24 14:04:18 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-02-24 14:04:18 +0100
commitc8808247d13af4a326e69e9c81f8dbf9a62af610 (patch)
tree7fe13322fc0dc64894c448ebc393c0a9a73c726a /tests/daemon
parentcac9269b115502071175436828c698d7cb4ddc5c (diff)
downloadwolfbones-c8808247d13af4a326e69e9c81f8dbf9a62af610.tar.gz
wolfbones-c8808247d13af4a326e69e9c81f8dbf9a62af610.tar.bz2
better testing: added TEST_ variables in makefiles, added TEST_<feature> macros in test_*.c for easier testing of stub functions
Diffstat (limited to 'tests/daemon')
-rw-r--r--tests/daemon/GNUmakefile13
-rw-r--r--tests/daemon/README13
-rw-r--r--tests/daemon/testd.c2
3 files changed, 20 insertions, 8 deletions
diff --git a/tests/daemon/GNUmakefile b/tests/daemon/GNUmakefile
index 1c88a31..c2f9e91 100644
--- a/tests/daemon/GNUmakefile
+++ b/tests/daemon/GNUmakefile
@@ -7,17 +7,13 @@ INCLUDE_LIBS = \
INCLUDE_DIRS = -I$(TOPDIR)/include/wolf -I.
-BINS = \
+TEST_BINS = \
testd$(EXE)
-OBJS = \
- testd_cmdline.o
-
-include $(TOPDIR)/makefiles/sub.mk
# ABa: currently a special rule for cmdline.c as gengetopt is not
# completly fixed yet
-testd.d : testd_cmdline.h
testd_cmdline.h : testd.ggo
gengetopt --file-name testd_cmdline --include-getopt --conf-parser -i $<
testd_cmdline.c : testd.ggo
@@ -26,14 +22,15 @@ testd_cmdline.c : testd.ggo
testd_cmdline.o : testd_cmdline.c testd_cmdline.h
$(CC) -c -o $@ $<
-testd: $(TOPDIR)/src/libwolf.a
+testd: $(TOPDIR)/src/libwolf.a testd_cmdline.o
-local_all: testd_cmdline.h
+local_all:
local_clean:
+ -@rm -f testd_cmdline.o
local_distclean:
- -@rm testd_cmdline.c testd_cmdline.h
+ -@rm -f testd_cmdline.c testd_cmdline.h
local_test:
@fakeroot ./testd -d -c ./testd.conf && \
diff --git a/tests/daemon/README b/tests/daemon/README
new file mode 100644
index 0000000..c706f38
--- /dev/null
+++ b/tests/daemon/README
@@ -0,0 +1,13 @@
+This example serves as a template for writting your own daemons.
+
+command line parser
+-------------------
+
+This test needs 'gengetopt' to parse the command line arguments of the daemon.
+
+Get it from http://www.gnu.org/software/gengetopt/gengetopt.html (many
+distributions package a far too old version!) when you encounter problems.
+
+This by no means implies that you are forced to use gengetopt together with
+WolfBones, you can as well write your own parser, use getopt, getopt_long,
+use popt or something different.
diff --git a/tests/daemon/testd.c b/tests/daemon/testd.c
index 0a9c45d..47dad8e 100644
--- a/tests/daemon/testd.c
+++ b/tests/daemon/testd.c
@@ -8,7 +8,9 @@
#include "daemon/daemon.h" /* Unix daemonizing code */
#include "daemon/signals.h" /* signal suspension */
+#ifndef MAKE_DEPENDENCIES
#include "testd_cmdline.h" /* for command line and option parsing (gengetopt) */
+#endif
#define DEFAULT_CONFIG_FILE "/etc/" CMDLINE_PARSER_PACKAGE ".conf"