a3d14a221d5cfa5b73c4e0190cbd2d372dfefae6
[debian/amanda] / installcheck / Makefile.am
1 include $(top_srcdir)/config/automake/vars.am
2 include $(top_srcdir)/config/automake/scripts.am
3 all_tests =
4
5 common_tests = \
6         Amanda_Archive \
7         Amanda_Config \
8         Amanda_ClientService \
9         Amanda_Debug \
10         Amanda_Feature \
11         Amanda_IPC_Binary \
12         Amanda_IPC_LineProtocol \
13         Amanda_MainLoop \
14         Amanda_Header \
15         Amanda_Util \
16         Amanda_Xfer \
17         amarchiver
18 all_tests += $(common_tests)
19
20 client_tests = \
21         noop \
22         amgtar \
23         ampgsql \
24         amraw
25 all_tests += $(client_tests)
26
27 server_tests = \
28         Amanda_Changer \
29         Amanda_Changer_compat \
30         Amanda_Changer_disk \
31         Amanda_Changer_multi \
32         Amanda_Changer_null \
33         Amanda_Changer_rait \
34         Amanda_Changer_robot \
35         Amanda_Changer_single \
36         Amanda_Cmdline \
37         Amanda_Curinfo \
38         Amanda_Disklist \
39         Amanda_DB_Catalog \
40         Amanda_Device \
41         Amanda_Holding \
42         Amanda_Logfile \
43         Amanda_Process \
44         Amanda_Recovery_Clerk \
45         Amanda_Recovery_Planner \
46         Amanda_Recovery_Scan \
47         Amanda_Report \
48         Amanda_Tapelist \
49         Amanda_Taper_Scan \
50         Amanda_Taper_Scan_traditional \
51         Amanda_Taper_Scribe \
52         bigint \
53         taper \
54         amcheck-device \
55         amgetconf \
56         amtape \
57         amlabel \
58         amtapetype
59 all_tests += $(server_tests)
60
61 full_tests = \
62         =setupcache \
63         amcheck \
64         amdump \
65         amdevcheck \
66         amcheckdump \
67         amrmtape \
68         amservice \
69         amstatus \
70         amreport \
71         amadmin \
72         amvault \
73         pp-scripts
74 all_tests += $(full_tests)
75
76 restore_tests = \
77         amfetchdump \
78         amidxtaped \
79         amrestore
80 all_tests += $(restore_tests)
81
82 restore_tests_no_check_userid = \
83         amrecover
84 all_tests += $(restore_tests_no_check_userid)
85
86 ndmp_tests = \
87         Amanda_Changer_ndmp \
88         Amanda_NDMP
89 all_tests += $(ndmp_tests)
90
91 mock_tests = \
92         mock_mtx
93 all_tests += $(mock_tests)
94
95 # mock scripts
96 mocks = \
97         mock/mail \
98         mock/mtx \
99         mock/lpr
100
101 # data for test scripts
102 test_data = \
103         data/aws-bundle.crt
104 EXTRA_DIST += $(test_data)
105
106 tests =
107
108 # tests requiring neither client nor server
109 tests += $(common_tests)
110 tests += $(mock_tests)
111
112 # tests requiring server
113 if WANT_SERVER
114 tests += $(server_tests)
115 endif
116
117 # tests requiring client
118 if WANT_CLIENT
119 tests += $(client_tests)
120 endif
121
122 # tests requiring a client and a server AND restore facilities (any tests that run amdump)
123 if WANT_SERVER
124 if WANT_CLIENT
125 # tests requiring a client and a server (any tests that run amdump)
126 tests += $(full_tests)
127
128 # tests requiring a client, a server, *and* restore code
129 if WANT_RESTORE
130 tests += $(restore_tests)
131
132 # and tests requiring all that *and* requiring CHECK_USERID is not set
133 if !CHECK_USERID
134 tests += $(restore_tests_no_check_userid)
135 endif
136 endif
137 endif
138 endif
139
140 # tests that need a server with NDMP support
141 if WANT_NDMP
142 if WANT_SERVER
143 tests += $(ndmp_tests)
144 endif
145 endif
146
147 # Add any common files (that should not be run as tests, and that do not
148 # require configure-variable substitution) here:
149 test_utils = \
150         Installcheck.pm \
151         Installcheck/Config.pm \
152         Installcheck/ClientService.pm \
153         Installcheck/Mock.pm \
154         Installcheck/Run.pm \
155         Installcheck/Dumpcache.pm \
156         Installcheck/Application.pm \
157         Installcheck/Changer.pm
158 EXTRA_DIST += $(test_utils)
159
160 # and finally some development utilities
161 noinst_SCRIPTS = \
162         run-ndmp
163
164 CHECK_PERL_FLAGS=-I$(top_srcdir)/installcheck
165
166 SCRIPTS_PERL = $(tests) $(mocks) $(noinst_SCRIPTS)
167 SCRIPTS_EXTRA_DIST = $(all_tests)
168
169 .PHONY: clobber_my_config_is_ok
170 clobber_my_config_is_ok:
171         @if test "$(CONFIG_CLOBBER_MY_CONFIG)" != "OK" -a \
172                  "$(CLOBBER_MY_CONFIG)" != "OK"; then \
173                 echo ""; \
174                 echo "'make installcheck' is a dangerous tool.  It will overwrite your"; \
175                 echo "amanda-client.conf and amandates, and (if it triggers an as-yet undetected"; \
176                 echo "bug) may do other unexpected things.  You are strongly encouraged"; \
177                 echo "  - not to run installchecks on a production install"; \
178                 echo "  - not to run installchecks as root"; \
179                 echo "See http://wiki.zmanda.com/index.php/Testing for instructions on setting up a"; \
180                 echo "test environment in which potential damage is limited by your filesystem's"; \
181                 echo "permissions.  To actually run the installchecks, invoke make as follows:"; \
182                 echo "  $(MAKE) CLOBBER_MY_CONFIG=OK installcheck"; \
183                 exit 1; \
184         fi
185
186 installcheck-local: clobber_my_config_is_ok $(SCRIPTS_PERL)
187         rm -rf "$(AMANDA_TMPDIR)/installchecks"
188         $(mkdir_p) "$(AMANDA_TMPDIR)/installchecks"
189         @if test -f "$(CONFIG_DIR)/amanda-client.conf" -a ! -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
190             cp "$(CONFIG_DIR)/amanda-client.conf" "$(CONFIG_DIR)/amanda-client.conf.install-backup"; \
191         fi 
192         $(PERL) -I$(srcdir) -I. -e 'use Test::Harness qw(&runtests); runtests(sort @ARGV);' $(tests)
193         rm -rf "$(CONFIG_DIR)/TESTCONF"
194         @if test -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
195             mv -f "$(CONFIG_DIR)/amanda-client.conf.install-backup" "$(CONFIG_DIR)/amanda-client.conf"; \
196         fi
197         rm -rf "$(AMANDA_TMPDIR)/installchecks"