Home | History | Annotate | Download | only in test
      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_service_LDFLAGS=@R_DYNAMIC_LDFLAG@
     66 test_names_LDADD=$(TEST_LIBS)
     67 test_names_LDFLAGS=@R_DYNAMIC_LDFLAG@
     68 ## break_loader_LDADD= $(TEST_LIBS)
     69 ## break_loader_LDFLAGS=@R_DYNAMIC_LDFLAG@
     70 test_shell_service_LDADD=$(TEST_LIBS)
     71 test_shell_service_LDFLAGS=@R_DYNAMIC_LDFLAG@
     72 shell_test_LDADD=$(TEST_LIBS)
     73 shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
     74 spawn_test_LDADD=$(TEST_LIBS)
     75 spawn_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
     76 decode_gcov_LDADD=$(TEST_LIBS)
     77 decode_gcov_LDFLAGS=@R_DYNAMIC_LDFLAG@
     78 
     79 EXTRA_DIST=
     80 
     81 ## keep these in creation order, i.e. uppermost dirs first 
     82 TESTDIRS=					\
     83 	data					\
     84 	data/valid-messages			\
     85 	data/invalid-messages			\
     86 	data/incomplete-messages		\
     87 	data/auth				\
     88 	data/sha-1				\
     89 	data/valid-config-files			\
     90 	data/valid-config-files/basic.d		\
     91 	data/valid-config-files/system.d	\
     92 	data/valid-service-files		\
     93 	data/invalid-config-files		\
     94 	data/equiv-config-files			\
     95 	data/equiv-config-files/basic		\
     96 	data/equiv-config-files/basic/basic.d	\
     97 	data/equiv-config-files/entities	\
     98 	data/equiv-config-files/entities/basic.d
     99 
    100 
    101 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"
    102 
    103 dist-hook:
    104 	for D in $(TESTDIRS); do						\
    105 		test -d $(distdir)/$$D || mkdir $(distdir)/$$D || exit 1 ;	\
    106 	done ;									\
    107 	FILES=`(cd $(srcdir) && $(FIND_TESTS) -o -name "*.in" -a -not -name Makefile.in)` ;					\
    108         for F in $$FILES; do							\
    109                 echo '-- Disting file '$$F ;					\
    110 		cp -f $(srcdir)/$$F $(distdir)/$$F || exit 1 ;				\
    111 	done
    112 
    113 ## copy tests to builddir so that generated tests and static tests 
    114 ## are all in one place.
    115 all-local:
    116 	for D in $(TESTDIRS); do								\
    117 		test -d $(top_builddir)/test/$$D || mkdir $(top_builddir)/test/$$D || exit 1 ;	\
    118 	done ;											\
    119 	if ! (test $(srcdir) = . || test $(srcdir) -ef .) ; then								\
    120 		FILES=`(cd $(srcdir) && $(FIND_TESTS))` ;					\
    121 	        for F in $$FILES; do								\
    122 			SRC=$(srcdir)/$$F ;							\
    123 			DEST=$(top_builddir)/test/$$F ;						\
    124 	                echo '-- Copying test file '$$F ;					\
    125 			cp $$SRC $$DEST || exit 1 ;						\
    126 			chmod u+w $$DEST || exit 1 ;						\
    127 		done ;										\
    128 	else											\
    129 		echo '-- No need to copy test data as srcdir = builddir' ;			\
    130 	fi ;											\
    131 	echo '-- Copying' $(top_builddir)/bus/*.conf 'to test directory' ;			\
    132 	cp $(top_builddir)/bus/*.conf $(top_builddir)/test/data/valid-config-files || exit 1 ;  \
    133 	chmod u+w $(top_builddir)/test/data/valid-config-files/*.conf || exit 1
    134 
    135 ## this doesn't clean generated test data files when srcdir=builddir
    136 clean-local:
    137 	if test $(srcdir) != . ; then					\
    138 		FILES=`(cd $(top_builddir)/test && $(FIND_TESTS))` ;	\
    139 	        for F in $$FILES; do					\
    140 			DEST=$(top_builddir)/test/$$F ;			\
    141 	                echo '-- Deleting test file '$$F ;		\
    142 			rm $$DEST || exit 1 ;				\
    143 		done ;							\
    144 		REVERSEDIRS= ;						\
    145 		for D in $(TESTDIRS); do				\
    146 			REVERSEDIRS="$$D $$REVERSEDIRS" ;		\
    147 		done ;							\
    148 		for D in $$REVERSEDIRS; do				\
    149 			rmdir $(top_builddir)/test/$$D || exit 1 ;	\
    150 		done ;							\
    151 	fi
    152