summaryrefslogtreecommitdiff
path: root/tests/Makefile.am
blob: 9bbb966363691cace85e8fe52f47f5bee75c0f7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
noinst_PROGRAMS = \
	test-gabble-presence \
	test-base64 \
	test-handles

python_tests = \
	test-basic-connect

python_tests_pythonfiles = $(python_tests:=.py)
python_tests_shfiles = $(python_tests:=.sh)

test_gabble_presence_LDADD = \
    $(top_builddir)/src/libgabble-convenience.la \
    $(top_builddir)/lib/telepathy-glib/libtelepathy-glib.la

test_base64_LDADD = \
    $(top_builddir)/src/libgabble-convenience.la \
    $(top_builddir)/lib/telepathy-glib/libtelepathy-glib.la

test_handles_LDADD = \
    $(top_builddir)/src/libgabble-convenience.la \
    $(top_builddir)/lib/telepathy-glib/libtelepathy-glib.la

AM_CFLAGS = $(ERROR_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@ @LOUDMOUTH_CFLAGS@ \
    @COVERAGE_CFLAGS@ \
    -I $(top_srcdir)/lib -I $(top_builddir)/lib \
    -I $(top_srcdir)/src -I $(top_builddir)/src
AM_LDFLAGS = @DBUS_LIBS@ @GLIB_LIBS@ @LOUDMOUTH_LIBS@

TESTS = $(noinst_PROGRAMS)
EXTRA_TESTS = $(python_tests_shfiles)

check-extra: $(service_files)
	chmod +x run-with-tmp-session-bus.sh $(python_tests_shfiles) \
		$(python_tests_pythonfiles)
	$(MAKE) check TESTS="$(EXTRA_TESTS)"

%.conf: %.conf.in
	@sed -e "s|\@abs_top_builddir\@|@abs_top_builddir@|" $< > $@

%.service: %.service.in
	@sed -e "s|\@abs_top_builddir\@|@abs_top_builddir@|" $< > $@

# D-Bus service file for testing
service_in_files = org.freedesktop.Telepathy.ConnectionManager.gabble.service.in
service_files = $(service_in_files:.service.in=.service)

# D-Bus config file for testing
conf_in_files = run-with-tmp-session-bus.conf.in
conf_files = $(conf_in_files:.conf.in=.conf)

BUILT_SOURCES = $(service_files) $(conf_files)

EXTRA_DIST = $(service_in_files) $(conf_in_files)

CLEANFILES = $(BUILT_SOURCES)

check_c_sources = *.c
check_whitespace_sources = \
    $(check_c_sources) \
    $(python_tests_shfiles) \
    $(python_tests_pythonfiles)

check-local::
	@echo "Checking whitespace-related trivia..."
	@if grep -n ' $$' $(check_whitespace_sources); \
	then \
		echo "^^^ The above files contain unwanted trailing spaces"; \
		exit 1; \
	fi
	@if grep -n '	' $(check_whitespace_sources); \
	then \
		echo "^^^ The above files contain tabs"; \
		exit 1; \
	fi
	@echo "Checking for GError mistakes..."
	@if grep -n '^ *GError *\*[a-zA-Z_][a-zA-Z0-9_]* *;' \
		$(check_c_sources); \
	then \
		echo "^^^ The above files contain uninitialized GError*s -"; \
		echo "    they should be initialized to NULL"; \
		exit 1; \
	fi