tests: simplify and improve "make check"
[platform/upstream/libsoup.git] / tests / Makefile.am
1 INCLUDES =              \
2         -I$(top_srcdir) \
3         -DSRCDIR=\""$(abs_srcdir)"\" \
4         -DBUILDDIR=\""$(builddir)"\" \
5         $(SOUP_MAINTAINER_FLAGS) \
6         $(XML_CFLAGS)   \
7         $(GLIB_CFLAGS)
8
9 LIBS =                  \
10         $(top_builddir)/libsoup/libsoup-2.4.la \
11         $(LIBGNUTLS_LIBS) \
12         $(GLIB_LIBS)
13
14 tests =                 \
15         cache-test      \
16         chunk-test      \
17         coding-test     \
18         connection-test \
19         context-test    \
20         continue-test   \
21         cookies-test    \
22         date            \
23         header-parsing  \
24         misc-test       \
25         multipart-test  \
26         ntlm-test       \
27         redirect-test   \
28         requester-test  \
29         resource-test   \
30         session-test    \
31         sniffing-test   \
32         socket-test     \
33         ssl-test        \
34         streaming-test  \
35         timeout-test    \
36         tld-test        \
37         uri-parsing
38
39 if HAVE_APACHE
40 tests += auth-test proxy-test pull-api range-test
41 endif
42 if HAVE_CURL
43 tests += forms-test server-auth-test
44 endif
45 if HAVE_XMLRPC_PHP
46 tests += xmlrpc-test xmlrpc-server-test
47 endif
48
49 noinst_PROGRAMS =               \
50         $(tests)                \
51         dns                     \
52         get                     \
53         ntlm-test-helper        \
54         simple-httpd            \
55         simple-proxy
56
57 noinst_DATA = soup-tests.gresource
58
59 noinst_LTLIBRARIES = libtest.la
60
61 libtest_la_SOURCES =    \
62         test-utils.c    \
63         test-utils.h
64
65 LDADD = libtest.la
66
67 if HAVE_APACHE
68 if HAVE_APACHE_2_2
69 httpd_conf_in = httpd.conf.22.in
70 else
71 httpd_conf_in = httpd.conf.24.in
72 endif
73 httpd.conf: $(httpd_conf_in)
74         $(AM_V_GEN) sed -e 's,[@]srcdir@,$(srcdir),' \
75             -e 's,[@]builddir@,$(builddir),' \
76             -e 's,[@]APACHE_MODULE_DIR@,$(APACHE_MODULE_DIR),' \
77             -e 's,[@]APACHE_PHP_MODULE_DIR@,$(APACHE_PHP_MODULE_DIR),' \
78             -e 's,[@]APACHE_PHP_MODULE@,$(APACHE_PHP_MODULE),' \
79             -e 's,[@]IF_HAVE_PHP@,$(IF_HAVE_PHP),' \
80             -e 's,[@]APACHE_SSL_MODULE_DIR@,$(APACHE_SSL_MODULE_DIR),' \
81             $< > $@ || rm -f $@
82
83 BUILT_SOURCES = httpd.conf
84 endif
85
86 soup-tests.gresource: soup-tests.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/soup-tests.gresource.xml)
87         $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)  $<
88
89 TESTS = $(sort $(tests))
90
91 RESOURCES =                     \
92         resources/atom.xml      \
93         resources/home.gif      \
94         resources/html_binary.html \
95         resources/mbox          \
96         resources/mbox.gz       \
97         resources/mbox.raw      \
98         resources/mbox.zlib     \
99         resources/ps_binary.ps  \
100         resources/rss20.xml     \
101         resources/test.html     \
102         resources/text_binary.txt
103
104 EXTRA_DIST =                     \
105         htdigest                 \
106         htpasswd                 \
107         httpd.conf.22.in         \
108         httpd.conf.24.in         \
109         index.txt                \
110         libsoup.supp             \
111         soup-tests.gresource.xml \
112         test-cert.pem            \
113         test-key.pem             \
114         xmlrpc-server.php        \
115         $(RESOURCES)
116
117 DISTCLEANFILES = soup-tests.gresource httpd.conf
118
119 check-local: check-TESTS kill-httpd
120 if MISSING_REGRESSION_TEST_PACKAGES
121         @echo ""
122         @echo "NOTE: some tests were not run due to missing packages:" $(MISSING_REGRESSION_TEST_PACKAGES)
123         @echo ""
124 endif
125
126 kill-httpd:
127         @if [ -f httpd.pid ]; then \
128                 $(APACHE_HTTPD) -d `pwd` -f httpd.conf -k stop; \
129         fi