bug 8215: (followup) make sure C4::CourseReserves doesn't export anything
[koha.git] / t / Makefile
1
2 SHELL = /bin/sh
3 NOOP = $(SHELL) -c true
4 NOECHO = @
5 ECHO = echo
6 MKDIR = /bin/mkdir
7 CP = cp
8 SED = /bin/sed
9 CHMOD = chmod
10 RM = /bin/rm
11
12 # some of these are pretty questionable.
13 PERL = /usr/bin/perl
14 # TEST_FILES = *.t
15 TEST_FILES = database_dependent.pl
16 TEST_CLASS =
17 RUN_EXPENSIVE_TESTS = 0
18 PROVE = /usr/bin/prove
19 PROVE_FLAGS = -v
20 PERL5LIB = ..
21 KOHA_CONF_DIR = ../etc
22 CONF_FILE_TEMPLATE = $(KOHA_CONF_DIR)/koha-conf.xml 
23 TEST_CONF_FILE = run/etc/koha-conf.xml
24 MKPATH = $(PERL) "-MExtUtils::Command" -e mkpath
25
26 TEST_REWRITE_SCRIPT = rewrite-config-test.PL
27 REAL_REWRITE_SCRIPT = ../rewrite-config.PL
28
29 ZEBRA_CONF_DIR = run/etc/zebradb
30 ZEBRA_CONF_FILES = $(ZEBRA_CONF_DIR)/etc/passwd $(ZEBRA_CONF_DIR)/zebra-biblios.cfg $(ZEBRA_CONF_DIR)/zebra-authorities.cfg $(ZEBRA_CONF_DIR)/zebra-authorities-dom.cfg $(ZEBRA_CONF_DIR)/explain-authorities.xml $(ZEBRA_CONF_DIR)/explain-biblios.xml $(ZEBRA_CONF_DIR)/retrieval-info-auth-grs1.xml $(ZEBRA_CONF_DIR)/retrieval-info-auth-dom.xml $(ZEBRA_CONF_DIR)/ccl.properties $(ZEBRA_CONF_DIR)/cql.properties $(ZEBRA_CONF_DIR)/pqf.properties
31
32 SCRIPTS = koha-zebra-ctl.sh koha-pazpar2-ctl.sh koha-index-daemon-ctl.sh
33 SRC_SCRIPT_DIR = ../misc/bin
34 TEST_SCRIPT_DIR = run/bin
35
36 SMOLDER_SERVER = 72.232.235.42:8000
37 SMOLDER_REPORT_FILENAME = kohatests.txt
38 SMOLDER_REPORT_TARBALL = kohatests.tar.gz
39 SMOLDER_PROJECT_NAME = Koha
40 SMOLDER_SMOKE_SIGNAL = ./smolder_smoke_signal
41
42 all ::
43         $(NOECHO) $(ECHO) RUNNING THIS MAKEFILE MAY CAUSE LOSS OF DATA
44         $(NOECHO) $(ECHO) 
45         $(NOECHO) $(ECHO) This makefile is completely beta.
46         $(NOECHO) $(ECHO) Please read it first and edit the variables at the top.
47         $(NOECHO) $(ECHO) Then, you can run \'make test\'
48
49 config_file :: $(CONF_FILE_TEMPLATE) test_run_dirs
50         $(CP) $(CONF_FILE_TEMPLATE)  $(TEST_CONF_FILE)
51         $(PERL) $(TEST_REWRITE_SCRIPT) --file $(TEST_CONF_FILE)
52         $(PERL) $(REAL_REWRITE_SCRIPT)  $(TEST_CONF_FILE)
53
54 zebra_conf_files :: test_run_dirs $(ZEBRA_CONF_FILES)
55
56
57 $(ZEBRA_CONF_FILES) ::
58         $(PERL) $(TEST_REWRITE_SCRIPT) --file $@
59         $(PERL) $(REAL_REWRITE_SCRIPT)  $@
60
61 $(SCRIPTS) ::
62         $(SED) s/--user=\$$USER.\$$GROUP// $(SRC_SCRIPT_DIR)/$@ > $(TEST_SCRIPT_DIR)/$@
63         $(PERL) $(TEST_REWRITE_SCRIPT) --file $(TEST_SCRIPT_DIR)/$@
64         $(PERL) $(REAL_REWRITE_SCRIPT)  $(TEST_SCRIPT_DIR)/$@
65         $(CHMOD) 755 $(TEST_SCRIPT_DIR)/$@
66
67 test :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS)
68         KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) TEST_CLASS=$(TEST_CLASS) RUN_EXPENSIVE_TESTS=$(RUN_EXPENSIVE_TESTS) \
69                 $(PROVE) $(PROVE_FLAGS) $(TEST_FILES) 
70
71 test-single :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS)
72         KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) RUN_EXPENSIVE_TESTS=1 SINGLE_TEST=1 \
73                 $(PROVE) $(PROVE_FLAGS) -Ilib $(TEST_FILES)
74
75 fulltest :: RUN_EXPENSIVE_TESTS = 1
76 fulltest :: test
77
78 test_run_dirs ::
79         $(MKPATH) run/etc
80         $(CP) -a ../etc/zebradb run/etc
81         $(MKPATH) run/etc/zebradb/etc
82         $(MKPATH) run/var/lib/zebradb/biblios/key
83         $(MKPATH) run/var/lib/zebradb/biblios/register
84         $(MKPATH) run/var/lib/zebradb/biblios/shadow
85         $(MKPATH) run/var/lib/zebradb/biblios/tmp
86         $(MKPATH) run/var/lib/zebradb/authorities/key
87         $(MKPATH) run/var/lib/zebradb/authorities/register
88         $(MKPATH) run/var/lib/zebradb/authorities/shadow
89         $(MKPATH) run/var/lib/zebradb/authorities/tmp
90         $(MKPATH) run/var/lock/zebradb/biblios
91         $(MKPATH) run/var/lock/zebradb/authorities
92         $(MKPATH) run/var/run/zebradb
93         $(MKPATH) run/var/log/zebradb
94         $(MKPATH) run/bin
95
96 submit_report :: $(SMOLDER_REPORT_TARBALL)
97         $(SMOLDER_SMOKE_SIGNAL) --server $(SMOLDER_SERVER) --file $(SMOLDER_REPORT_TARBALL) --project $(SMOLDER_PROJECT_NAME) --anonymous
98 #       $(RM) $(SMOLDER_REPORT_TARBALL)
99
100 submit :: submit_report
101
102 $(SMOLDER_REPORT_TARBALL) :: $(SMOLDER_REPORT_FILENAME)
103         tar zcvf $(SMOLDER_REPORT_TARBALL) kohatests.txt
104         $(RM) $(SMOLDER_REPORT_FILENAME)
105
106 $(SMOLDER_REPORT_FILENAME) :: report
107
108 report :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS)
109         -KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) TEST_CLASS=$(TEST_CLASS) RUN_EXPENSIVE_TESTS=$(RUN_EXPENSIVE_TESTS) \
110                 $(PERL) $(TEST_FILES) > $(SMOLDER_REPORT_FILENAME)
111