* configure.in: Add test/name-test/Makefile to the generated
[platform/upstream/dbus.git] / test / Makefile.am
1
2 if HAVE_GLIB
3     GLIB_SUBDIR=glib
4 endif
5 if HAVE_PYTHON
6     PYTHON_SUBDIR=python
7 endif
8 if HAVE_QTESTLIB
9     QT_SUBDIR=qt
10 endif
11
12 SUBDIRS=name-test $(GLIB_SUBDIR) $(PYTHON_SUBDIR) $(QT_SUBDIR)
13 DIST_SUBDIRS=glib python qt name-test
14
15 INCLUDES=-I$(top_srcdir) $(DBUS_TEST_CFLAGS) 
16
17
18 if DBUS_BUILD_TESTS
19 ## break-loader removed for now
20 TEST_BINARIES=test-service test-names test-shell-service shell-test spawn-test test-segfault test-exit test-sleep-forever
21
22 #enable stand alone make check test
23 TESTS=shell-test
24 else
25 TEST_BINARIES=
26 TESTS=
27 endif
28
29 if DBUS_GCOV_ENABLED
30 GCOV_BINARIES=decode-gcov
31 else
32 GCOV_BINARIES=
33 endif
34
35 noinst_PROGRAMS= $(TEST_BINARIES) $(GCOV_BINARIES)
36
37 test_service_SOURCES=                           \
38         test-service.c                          \
39         test-utils.c                            \
40         test-utils.h
41
42 test_names_SOURCES=                             \
43         test-names.c                            \
44         test-utils.c                            \
45         test-utils.h
46
47 ##break_loader_SOURCES=                         \
48 ##      break-loader.c
49
50 test_shell_service_SOURCES =                    \
51         test-shell-service.c                    \
52         test-utils.c                            \
53         test-utils.h
54
55 shell_test_SOURCES=                             \
56         shell-test.c
57
58 spawn_test_SOURCES=                             \
59         spawn-test.c
60
61 test_exit_SOURCES =                             \
62         test-exit.c
63
64 test_segfault_SOURCES =                         \
65         test-segfault.c
66
67 test_sleep_forever_SOURCES =                    \
68         test-sleep-forever.c
69
70 decode_gcov_SOURCES=                            \
71         decode-gcov.c
72
73 TEST_LIBS=$(DBUS_TEST_LIBS) $(top_builddir)/dbus/libdbus-convenience.la
74
75 test_service_LDADD=$(TEST_LIBS)
76 test_names_LDADD=$(TEST_LIBS)
77 ## break_loader_LDADD= $(TEST_LIBS)
78 test_shell_service_LDADD=$(TEST_LIBS)
79 shell_test_LDADD=$(TEST_LIBS)
80 spawn_test_LDADD=$(TEST_LIBS)
81 decode_gcov_LDADD=$(TEST_LIBS)
82
83 EXTRA_DIST=
84
85 ## keep these in creation order, i.e. uppermost dirs first 
86 TESTDIRS=                                       \
87         data                                    \
88         data/valid-messages                     \
89         data/invalid-messages                   \
90         data/incomplete-messages                \
91         data/auth                               \
92         data/sha-1                              \
93         data/valid-config-files                 \
94         data/valid-config-files/basic.d         \
95         data/valid-config-files/system.d        \
96         data/valid-service-files                \
97         data/invalid-config-files               \
98         data/equiv-config-files                 \
99         data/equiv-config-files/basic           \
100         data/equiv-config-files/basic/basic.d   \
101         data/equiv-config-files/entities        \
102         data/equiv-config-files/entities/basic.d
103
104
105 FIND_TESTS=find -name "*.message" -o -name "*.message-raw" -o -name "*.auth-script" -o -name "*.sha1" -o -name "*.txt" -o -name "*.conf" -o -name "*.service"
106
107 dist-hook:
108         for D in $(TESTDIRS); do                                                \
109                 test -d $(distdir)/$$D || mkdir $(distdir)/$$D || exit 1 ;      \
110         done ;                                                                  \
111         FILES=`(cd $(srcdir) && $(FIND_TESTS) -o -name "*.in" -a -not -name Makefile.in)` ;                                     \
112         for F in $$FILES; do                                                    \
113                 echo '-- Disting file '$$F ;                                    \
114                 cp -f $(srcdir)/$$F $(distdir)/$$F || exit 1 ;                          \
115         done
116
117 ## copy tests to builddir so that generated tests and static tests 
118 ## are all in one place.
119 all-local:
120         for D in $(TESTDIRS); do                                                                \
121                 test -d $(top_builddir)/test/$$D || mkdir $(top_builddir)/test/$$D || exit 1 ;  \
122         done ;                                                                                  \
123         if ! (test $(srcdir) = . || test $(srcdir) -ef .) ; then                                                                \
124                 FILES=`(cd $(srcdir) && $(FIND_TESTS))` ;                                       \
125                 for F in $$FILES; do                                                            \
126                         SRC=$(srcdir)/$$F ;                                                     \
127                         DEST=$(top_builddir)/test/$$F ;                                         \
128                         echo '-- Copying test file '$$F ;                                       \
129                         cp $$SRC $$DEST || exit 1 ;                                             \
130                         chmod u+w $$DEST || exit 1 ;                                            \
131                 done ;                                                                          \
132         else                                                                                    \
133                 echo '-- No need to copy test data as srcdir = builddir' ;                      \
134         fi ;                                                                                    \
135         echo '-- Copying' $(top_builddir)/bus/*.conf 'to test directory' ;                      \
136         cp $(top_builddir)/bus/*.conf $(top_builddir)/test/data/valid-config-files || exit 1 ;  \
137         chmod u+w $(top_builddir)/test/data/valid-config-files/*.conf || exit 1
138
139 ## this doesn't clean generated test data files when srcdir=builddir
140 clean-local:
141         if test $(srcdir) != . ; then                                   \
142                 FILES=`(cd $(top_builddir)/test && $(FIND_TESTS))` ;    \
143                 for F in $$FILES; do                                    \
144                         DEST=$(top_builddir)/test/$$F ;                 \
145                         echo '-- Deleting test file '$$F ;              \
146                         rm $$DEST || exit 1 ;                           \
147                 done ;                                                  \
148                 REVERSEDIRS= ;                                          \
149                 for D in $(TESTDIRS); do                                \
150                         REVERSEDIRS="$$D $$REVERSEDIRS" ;               \
151                 done ;                                                  \
152                 for D in $$REVERSEDIRS; do                              \
153                         rmdir $(top_builddir)/test/$$D || exit 1 ;      \
154                 done ;                                                  \
155         fi