705d215cded4ef384d61f0815cf4b583fbc34bc9
[debian/amanda] / installcheck / Makefile.am
1 # Note that this architecture assumes a full install -- not just server
2 # or just client.  Neither is sufficiently test-able on its own.
3
4 include $(top_srcdir)/config/automake/vars.am
5 include $(top_srcdir)/config/automake/scripts.am
6
7 # Add your tests here.
8
9 common_tests = \
10         Amanda_Archive \
11         Amanda_Config \
12         Amanda_Debug \
13         Amanda_MainLoop \
14         Amanda_Types \
15         Amanda_Util \
16         amarchiver
17
18 server_tests = \
19         Amanda_Changer \
20         Amanda_Changer_compat \
21         Amanda_Changer_disk \
22         Amanda_Changer_single \
23         Amanda_Cmdline \
24         Amanda_DB_Catalog \
25         Amanda_Device \
26         Amanda_Logfile \
27         Amanda_Tapelist \
28         Amanda_Process \
29         Amanda_Xfer \
30         bigint \
31         amgetconf \
32         amtapetype
33
34 full_tests = \
35         amdevcheck \
36         amcheckdump \
37         amdump \
38         amservice \
39         amstatus \
40         pp-scripts
41
42 restore_tests = \
43         amfetchdump
44
45 # tests requiring neither client nor server
46 tests = $(common_tests)
47
48 # tests requiring server
49 if WANT_SERVER
50 tests += $(server_tests)
51 endif
52
53 # tests requiring a client and a server (any tests that run amdump)
54 if WANT_SERVER
55 if WANT_CLIENT
56 tests += $(full_tests)
57 endif
58 endif
59
60 # tests requiring a client and a server AND restore facilities (any tests that run amdump)
61 if WANT_SERVER
62 if WANT_CLIENT
63 if WANT_RESTORE
64 tests += $(restore_tests)
65 endif
66 endif
67 endif
68
69 # Add any common files (that should not be run as tests, and that do not
70 # require configure-variable substitution) here:
71 test_utils = Installcheck/Config.pm Installcheck/Run.pm
72 EXTRA_DIST += $(test_utils)
73
74 CHECK_PERL_FLAGS=-I$(top_srcdir)/installcheck
75
76 SCRIPTS_PERL = $(tests)
77
78 # we don't need to syntax check the test scripts..
79 CHECK_PERL =
80
81 .PHONY: clobber_my_config_is_ok
82 clobber_my_config_is_ok:
83         @if test "$(CONFIG_CLOBBER_MY_CONFIG)" != "OK" -a \
84                  "$(CLOBBER_MY_CONFIG)" != "OK"; then \
85                 echo ""; \
86                 echo "'make installcheck' is a dangerous tool.  It will overwrite your"; \
87                 echo "amanda-client.conf and amandates, and (if it triggers an as-yet undetected"; \
88                 echo "bug) may do other unexpected things.  You are strongly encouraged"; \
89                 echo "  - not to run installchecks on a production install"; \
90                 echo "  - not to run installchecks as root"; \
91                 echo "See http://wiki.zmanda.com/index.php/Testing for instructions on setting up a"; \
92                 echo "test environment in which potential damage is limited by your filesystem's"; \
93                 echo "permissions.  To actually run the installchecks, invoke make as follows:"; \
94                 echo "  $(MAKE) CLOBBER_MY_CONFIG=OK installcheck"; \
95                 exit 1; \
96         fi
97
98 installcheck-local: clobber_my_config_is_ok $(SCRIPTS_PERL)
99         @$(mkdir_p) $(AMANDA_TMPDIR)
100         @if test -f "$(CONFIG_DIR)/amanda-client.conf" -a ! -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
101             cp "$(CONFIG_DIR)/amanda-client.conf" "$(CONFIG_DIR)/amanda-client.conf.install-backup"; \
102         fi 
103         $(PERL) -I$(srcdir) -I. -e 'use Test::Harness qw(&runtests); runtests(@ARGV);' $(tests)
104         rm -rf "$(CONFIG_DIR)/TESTCONF"
105         @if test -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
106             mv -f "$(CONFIG_DIR)/amanda-client.conf.install-backup" "$(CONFIG_DIR)/amanda-client.conf"; \
107         fi
108         rm -rf "$(AMANDA_TMPDIR)/TESTCONF/amandates"
109         rm -rf "$(AMANDA_TMPDIR)/TESTCONF/gnutar_listdir"