summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-10-15 11:00:46 +0200
committerMichal Schmidt <mschmidt@redhat.com>2014-10-23 17:38:02 +0200
commit32a4456cc252689f51f383d150d34ed636bfec4d (patch)
tree47c40bf53cf1b5d78464f1b70e0b5beb3f0de73c /Makefile.am
parent5ba43716f345e205eba33156c0171fb657f4451f (diff)
test: generate tests for OrderedHashmap from Hashmap tests
test-hashmap-ordered.c is generated from test-hashmap-plain.c simply by substituting "ordered_hashmap" for "hashmap" etc. In the cases where tests rely on the order of entries, a distinction between plain and ordered hashmaps is made using the ORDERED macro, which is defined only for test-hashmap-ordered.c.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am21
1 files changed, 20 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 3b0ba0ae36..4d93304cb6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1569,8 +1569,27 @@ test_namespace_SOURCES = \
test_namespace_LDADD = \
libsystemd-core.la
+CLEANFILES += \
+ src/test/test-hashmap-ordered.c
+
+BUILT_SOURCES += \
+ src/test/test-hashmap-ordered.c
+
+src/test/test-hashmap-ordered.c: src/test/test-hashmap-plain.c
+ $(AM_V_at)$(MKDIR_P) $(dir $@)
+ $(AM_V_GEN)$(AWK) 'BEGIN { print "/* GENERATED FILE */\n#define ORDERED" } \
+ { if (!match($$0, "^#include")) \
+ gsub(/hashmap/, "ordered_hashmap"); \
+ gsub(/HASHMAP/, "ORDERED_HASHMAP"); \
+ gsub(/Hashmap/, "OrderedHashmap"); \
+ print }' <$< >$@
+
+nodist_test_hashmap_SOURCES = \
+ src/test/test-hashmap-ordered.c
+
test_hashmap_SOURCES = \
- src/test/test-hashmap.c
+ src/test/test-hashmap.c \
+ src/test/test-hashmap-plain.c
test_hashmap_LDADD = \
libsystemd-core.la