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