config: Add test utility for configuration system
When compiled with CONFIG_TEST, the config code will include a little
main() function to read configuration from stdin, and print parsed
config to stdout.
This allows the configuration system to be easily used with a testuite
or fuzzer.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/Makefile.am b/Makefile.am
index d7272a6..a06e29d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,8 @@
sbin_PROGRAMS = console-server
bin_PROGRAMS = console-client
+check_PROGRAMS = config-test
+
AM_CFLAGS = -Wall -Wextra -Werror
EXTRA_DIST = openbmc-console.conf.sample
@@ -22,3 +24,7 @@
console-client.c \
console-server.h \
util.c
+
+config_test_CPPFLAGS = -DCONFIG_TEST -DSYSCONFDIR=\"\"
+config_test_SOURCES = \
+ config.c