/ db / test /
/db/test/Makefile
1 # Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com>/
2 #
3 # This file is part of GombeMI.
4 #
5 # GombeMI is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with GombeMI. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # Regression tests
19 #
20 # Karl O. Pinc <kop@meme.com>
21 #
22 # This just to test db operation, not creation etc.
23
24 include ../defaults.mk
25 include test.mk
26 include gentargets.mk
27
28
29 # Trickery so we don't have to make load_file executable.
30 # (And don't use source (.) because posix won't let it take args.)
31 export RUN_TEST = sh <run_test.sh run_test.sh "$(PSQL_ARGS_MINIMAL)"
32
33 all: test
34
35 .PHONY: test
36 test:
37 @export e=0; \
38 for f in $(TESTS) ; do \
39 $(RUN_TEST) test_$$(basename $$f) || e=1 ; \
40 done; \
41 $(MAKE) -s -f run_test.mkf reset 4>&2 || e=1 ; \
42 exit $$e
43
44 .PHONY: reset
45 reset:
46 @$(MAKE) -s -f run_test.mkf reset 4>&2
47
48 .PHONY: $(load_targets) $(test_targets) $(save_targets) $(show_targets) \
49 $(trans_test_targets) $(trans_save_targets) $(trans_show_targets)
50
51 $(load_targets) $(test_targets) $(save_targets) $(show_targets) \
52 $(trans_test_targets) $(trans_save_targets) $(trans_show_targets):
53 @$(RUN_TEST) "$@"
54
55 .PHONY: test_%
56 test_%:
57 @if [ ! -e sql/$(patsubst test_%,%,$@) ] ; then \
58 printf '$(patsubst test_%,%,$@): No such test\n' >&2 ; \
59 exit 1 ; \
60 fi