1############################################################################ 2# x509 certificates: 3TEST_DIR := @abs_top_srcdir@/tests 4SUMMARY := $(TEST_DIR)/summarise-tests.py 5CERT_DIR := $(TEST_DIR)/certs 6CA_KEY := $(CERT_DIR)/ca-0-key.pem 7CA_CERT := $(CERT_DIR)/ca-0-cert.pem 8SS_KEY := $(CERT_DIR)/ss-key.pem 9SS_CERT := $(CERT_DIR)/ss-cert.pem 10REV_KEY := $(CERT_DIR)/rev-key.pem 11REV_CERT := $(CERT_DIR)/rev-cert.pem 12EXP_KEY := $(CERT_DIR)/exp-key.pem 13EXP_CERT := $(CERT_DIR)/exp-cert.pem 14NEW_KEY := $(CERT_DIR)/new-key.pem 15NEW_CERT := $(CERT_DIR)/new-cert.pem 16TLS_KEY := $(CERT_DIR)/tls-key.pem 17TLS_CERT := $(CERT_DIR)/tls-cert.pem 18WILD_KEY := $(CERT_DIR)/wild-key.pem 19WILD_CERT:= $(CERT_DIR)/wild-cert.pem 20BADWILD_KEY := $(CERT_DIR)/badwild-key.pem 21BADWILD_CERT := $(CERT_DIR)/badwild-cert.pem 22CA_DIR := $(CERT_DIR)/cas 23CRL_DIR := $(CERT_DIR)/crl 24UNKNOWN_KEY := $(CERT_DIR)/unknown-key.pem 25UNKNOWN_CERT := $(CERT_DIR)/unknown-cert.pem 26INCLUDES := -I$(top_builddir)/wocky 27TLSDEFS := -DTLS_CA_KEY_FILE='"$(CA_KEY)"' \ 28 -DTLS_CA_CRT_FILE='"$(CA_CERT)"' \ 29 -DTLS_SS_KEY_FILE='"$(SS_KEY)"' \ 30 -DTLS_SS_CRT_FILE='"$(SS_CERT)"' \ 31 -DTLS_EXP_KEY_FILE='"$(EXP_KEY)"' \ 32 -DTLS_EXP_CRT_FILE='"$(EXP_CERT)"' \ 33 -DTLS_NEW_KEY_FILE='"$(NEW_KEY)"' \ 34 -DTLS_NEW_CRT_FILE='"$(NEW_CERT)"' \ 35 -DTLS_REV_KEY_FILE='"$(REV_KEY)"' \ 36 -DTLS_REV_CRT_FILE='"$(REV_CERT)"' \ 37 -DTLS_UNKNOWN_KEY_FILE='"$(UNKNOWN_KEY)"' \ 38 -DTLS_UNKNOWN_CRT_FILE='"$(UNKNOWN_CERT)"' \ 39 -DTLS_SERVER_KEY_FILE='"$(TLS_KEY)"' \ 40 -DTLS_SERVER_CRT_FILE='"$(TLS_CERT)"'\ 41 -DTLS_WILD_KEY_FILE='"$(WILD_KEY)"' \ 42 -DTLS_WILD_CRT_FILE='"$(WILD_CERT)"' \ 43 -DTLS_BADWILD_CRT_FILE='"$(BADWILD_CERT)"' \ 44 -DTLS_BADWILD_KEY_FILE='"$(BADWILD_KEY)"' \ 45 -DTLS_CRL_DIR='"$(CRL_DIR)"' \ 46 -DTLS_CA_DIR='"$(CA_DIR)"' 47############################################################################ 48TEST_PROGS = \ 49 wocky-bare-contact-test \ 50 wocky-caps-hash-test \ 51 wocky-connector-test \ 52 wocky-contact-factory-test \ 53 wocky-data-form-test \ 54 wocky-jid-validation-test \ 55 wocky-loopback-test \ 56 wocky-node-tree-test \ 57 wocky-pep-service-test \ 58 wocky-ping-test \ 59 wocky-porter-test \ 60 wocky-pubsub-node-test \ 61 wocky-pubsub-service-test \ 62 wocky-resource-contact-test \ 63 wocky-roster-test \ 64 wocky-sasl-utils-test \ 65 wocky-scram-sha1-test \ 66 wocky-session-test \ 67 wocky-stanza-test \ 68 wocky-tls-test \ 69 wocky-utils-test \ 70 wocky-xmpp-connection-test \ 71 wocky-xmpp-node-test \ 72 wocky-xmpp-reader-test \ 73 wocky-xmpp-readwrite-test \ 74 wocky-http-proxy-test \ 75 $(NULL) 76 77noinst_PROGRAMS = 78 79if HAVE_LIBSASL2 80 TEST_PROGS += wocky-test-sasl-auth 81 noinst_PROGRAMS += wocky-dummy-xmpp-server 82endif 83 84wocky_bare_contact_test_SOURCES = \ 85 wocky-test-helper.c wocky-test-helper.h \ 86 wocky-test-stream.c wocky-test-stream.h \ 87 wocky-bare-contact-test.c 88 89wocky_caps_hash_test_SOURCES = wocky-caps-hash-test.c \ 90 wocky-test-helper.c wocky-test-helper.h \ 91 wocky-test-stream.c wocky-test-stream.h 92 93EXTRA_wocky_connector_test_DEPENDENCIES = $(CA_DIR) certs 94wocky_connector_test_SOURCES = \ 95 wocky-connector-test.c \ 96 wocky-test-sasl-auth-server.c \ 97 wocky-test-sasl-auth-server.h \ 98 wocky-test-connector-server.c \ 99 wocky-test-connector-server.h \ 100 wocky-test-helper.c wocky-test-helper.h \ 101 wocky-test-stream.c wocky-test-stream.h \ 102 test-resolver.c test-resolver.h 103 104wocky_connector_test_LDADD = $(LDADD) @LIBSASL2_LIBS@ 105wocky_connector_test_CFLAGS = $(AM_CFLAGS) @LIBSASL2_CFLAGS@ $(TLSDEFS) 106 107wocky_contact_factory_test_SOURCES = \ 108 wocky-test-helper.c wocky-test-helper.h \ 109 wocky-test-stream.c wocky-test-stream.h \ 110 wocky-contact-factory-test.c 111 112wocky_data_form_test_SOURCES = \ 113 wocky-test-helper.c wocky-test-helper.h \ 114 wocky-test-stream.c wocky-test-stream.h \ 115 wocky-data-form-test.c 116 117wocky_dummy_xmpp_server_SOURCES = wocky-dummy-xmpp-server.c \ 118 wocky-test-connector-server.c wocky-test-connector-server.h \ 119 wocky-test-helper.c wocky-test-helper.h \ 120 wocky-test-stream.c wocky-test-stream.h \ 121 wocky-test-sasl-auth-server.c wocky-test-sasl-auth-server.h 122wocky_dummy_xmpp_server_LDADD = $(LDADD) @LIBSASL2_LIBS@ 123wocky_dummy_xmpp_server_CFLAGS = $(AM_CFLAGS) @LIBSASL2_CFLAGS@ $(TLSDEFS) 124 125wocky_http_proxy_test_SOURCES = wocky-http-proxy-test.c \ 126 wocky-test-helper.c wocky-test-helper.h \ 127 wocky-test-stream.c wocky-test-stream.h 128 129wocky_jid_validation_test_SOURCES = \ 130 wocky-jid-validation-test.c \ 131 wocky-test-helper.c wocky-test-helper.h \ 132 wocky-test-stream.c wocky-test-stream.h 133 134wocky_loopback_test_SOURCES = \ 135 wocky-test-helper.c wocky-test-helper.h \ 136 wocky-test-stream.c wocky-test-stream.h \ 137 wocky-loopback-test.c 138 139wocky_node_tree_test_SOURCES = \ 140 wocky-test-helper.c wocky-test-helper.h \ 141 wocky-test-stream.c wocky-test-stream.h \ 142 wocky-node-tree-test.c 143 144wocky_pep_service_test_SOURCES = \ 145 wocky-test-helper.c wocky-test-helper.h \ 146 wocky-test-stream.c wocky-test-stream.h \ 147 wocky-pep-service-test.c 148 149wocky_ping_test_SOURCES = \ 150 wocky-ping-test.c \ 151 wocky-test-helper.c wocky-test-helper.h \ 152 wocky-test-stream.c wocky-test-stream.h 153 154wocky_porter_test_SOURCES = \ 155 wocky-porter-test.c \ 156 wocky-test-helper.c wocky-test-helper.h \ 157 wocky-test-stream.c wocky-test-stream.h 158 159wocky_pubsub_node_test_SOURCES = \ 160 wocky-test-helper.c wocky-test-helper.h \ 161 wocky-test-stream.c wocky-test-stream.h \ 162 wocky-pubsub-test-helpers.c wocky-pubsub-test-helpers.h \ 163 wocky-pubsub-node-test.c 164 165wocky_pubsub_service_test_SOURCES = \ 166 wocky-test-helper.c wocky-test-helper.h \ 167 wocky-test-stream.c wocky-test-stream.h \ 168 wocky-pubsub-test-helpers.c wocky-pubsub-test-helpers.h \ 169 wocky-pubsub-service-test.c 170 171wocky_resource_contact_test_SOURCES = \ 172 wocky-test-helper.c wocky-test-helper.h \ 173 wocky-test-stream.c wocky-test-stream.h \ 174 wocky-resource-contact-test.c 175 176wocky_roster_test_SOURCES = \ 177 wocky-roster-test.c \ 178 wocky-test-helper.c wocky-test-helper.h \ 179 wocky-test-stream.c wocky-test-stream.h 180 181wocky_sasl_utils_test_SOURCES = wocky-sasl-utils-test.c 182 183wocky_scram_sha1_test_SOURCES = wocky-scram-sha1-test.c \ 184 wocky-test-helper.c wocky-test-helper.h \ 185 wocky-test-stream.c wocky-test-stream.h 186 187wocky_session_test_SOURCES = \ 188 wocky-test-helper.c wocky-test-helper.h \ 189 wocky-test-stream.c wocky-test-stream.h \ 190 wocky-session-test.c 191 192wocky_stanza_test_SOURCES = \ 193 wocky-test-helper.c wocky-test-helper.h \ 194 wocky-test-stream.c wocky-test-stream.h \ 195 wocky-stanza-test.c 196 197wocky_test_sasl_auth_SOURCES = \ 198 wocky-test-helper.c wocky-test-helper.h \ 199 wocky-test-sasl-auth.c \ 200 wocky-test-sasl-handler.c \ 201 wocky-test-sasl-handler.h \ 202 wocky-test-sasl-auth-server.c \ 203 wocky-test-sasl-auth-server.h \ 204 wocky-test-stream.c \ 205 wocky-test-stream.h 206wocky_test_sasl_auth_LDADD = $(LDADD) @LIBSASL2_LIBS@ 207wocky_test_sasl_auth_CFLAGS = $(AM_CFLAGS) @LIBSASL2_CFLAGS@ 208 209wocky_tls_test_SOURCES = \ 210 wocky-tls-test.c \ 211 wocky-test-helper.c wocky-test-helper.h \ 212 wocky-test-stream.c wocky-test-stream.h 213wocky_tls_test_CFLAGS = $(AM_CFLAGS) $(TLSDEFS) 214 215wocky_utils_test_SOURCES = wocky-utils-test.c 216 217wocky_xmpp_connection_test_SOURCES = \ 218 wocky-xmpp-connection-test.c \ 219 wocky-test-helper.c wocky-test-helper.h \ 220 wocky-test-stream.c wocky-test-stream.h 221 222wocky_xmpp_node_test_SOURCES = \ 223 wocky-test-helper.c wocky-test-helper.h \ 224 wocky-test-stream.c wocky-test-stream.h \ 225 wocky-xmpp-node-test.c 226 227wocky_xmpp_reader_test_SOURCES = \ 228 wocky-test-helper.c wocky-test-helper.h \ 229 wocky-test-stream.c wocky-test-stream.h \ 230 wocky-xmpp-reader-test.c 231 232wocky_xmpp_readwrite_test_SOURCES = \ 233 wocky-test-stream.c wocky-test-stream.h \ 234 wocky-test-helper.c wocky-test-helper.h \ 235 wocky-xmpp-readwrite-test.c 236 237AM_CFLAGS = $(ERROR_CFLAGS) $(GCOV_CFLAGS) @GLIB_CFLAGS@ \ 238 @LIBXML2_CFLAGS@ @TLS_CFLAGS@ @WOCKY_CFLAGS@ 239 240AM_LDFLAGS = $(GCOV_LIBS) @GLIB_LIBS@ @LIBXML2_LIBS@ @TLS_LIBS@ 241LDADD = $(top_builddir)/wocky/libwocky.la 242 243check_PROGRAMS = $(TEST_PROGS) 244 245check_c_sources = $(notdir $(wildcard $(srcdir)/*.c) $(wildcard $(srcdir)/*.h)) 246 247noinst_PROGRAMS += $(TEST_PROGS) 248 249test-report: test-report.xml 250 gtester-report $(top_builddir)/tests/$@.xml > \ 251 $(top_builddir)/tests/$@.html 252 253test-report.xml: ${TEST_PROGS} test 254 255test: ${TEST_PROGS} 256 gtester -o test-report.xml -k --verbose ${TEST_PROGS} 257 @if [ -x $(which python) ] ; then \ 258 $(SUMMARY) $@-report.xml ; \ 259 else \ 260 echo "No python available, not summarizing test results" ; \ 261 fi 262 263test-%: wocky-%-test 264 gtester -o $@-report.xml -k --verbose $< 265 @if [ -x $(which python) ] ; then \ 266 $(SUMMARY) $@-report.xml ; \ 267 else \ 268 echo "No python available, not summarizing test results" ; \ 269 fi 270 271.PHONY: test test-report 272 273include $(top_srcdir)/tools/check-coding-style.mk 274check-local: test check-coding-style 275 276############################################################################ 277 278SUPPRESSIONS = \ 279 threadlocal.supp \ 280 gabble.supp \ 281 tp-glib.supp 282 283CLEANFILES = test-report.xml \ 284 sasl-test.db 285 286# valgrind any given test by running make test.valgrind 287%.valgrind: % 288 G_SLICE=always-malloc \ 289 G_DEBUG=gc-friendly \ 290 valgrind -q \ 291 $(foreach s,$(SUPPRESSIONS),--suppressions=$(srcdir)/$(s)) \ 292 --tool=memcheck --leak-check=full --trace-children=yes \ 293 --leak-resolution=high --num-callers=20 \ 294 ./$* $(TEST_ARGS) 2>&1 | tee "valgrind.$*.log" 295 @if grep "==" "valgrind.$*.log" > /dev/null 2>&1; then \ 296 exit 1; \ 297 fi 298 299valgrind: $(TEST_PROGS) 300 @echo "Valgrinding tests ..." 301 @failed=0; \ 302 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TEST_PROGS)); do \ 303 $(MAKE) $$t.valgrind; \ 304 if test "$$?" -ne 0; then \ 305 echo "Valgrind error for test $$t"; \ 306 failed=`expr $$failed + 1`; \ 307 whicht="$$whicht $$t"; \ 308 fi; \ 309 done; \ 310 if test "$$failed" -ne 0; then \ 311 echo "$$failed tests had leaks or errors under valgrind:"; \ 312 echo "$$whicht"; \ 313 false; \ 314 fi 315 316EXTRA_DIST = $(SUPPRESSIONS) \ 317 README \ 318 connector-test-plan.txt \ 319 summarise-tests.py \ 320 wocky-dummy-xmpp-server.c \ 321 $(wildcard $(srcdir)/certs/*.cfg) \ 322 $(wildcard $(srcdir)/certs/*.pem) \ 323 $(wildcard $(srcdir)/certs/cas/*.pem) \ 324 $(wildcard $(srcdir)/certs/cas/*.0) 325 326