Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / protocol-plugin / lib / cpluff / test / Makefile.am
1 ## Process this file with automake to produce Makefile.in.
2
3 # Copyright 2007 Johannes Lehtinen
4 # This Makefile is free software; Johannes Lehtinen gives unlimited
5 # permission to copy, distribute and modify it.
6
7 # This can be defined to a debugging wrapper program such as Valgrind.
8 TEST_WRAPPER =
9
10 # This can be defined to a subset of test cases to be performed
11 SELECTED_TESTS = all
12
13 DIST_SUBDIRS = plugins-source
14
15 EXTRA_DIST = tests.txt
16
17 CPPFLAGS = @CPPFLAGS@
18 CPPFLAGS += -DCP_HOST="\"$(host)\""
19
20 LIBS = @LIBS_OTHER@ @LIBS@
21
22 check_PROGRAMS = testsuite
23
24 testsuite_SOURCES = psymbolusage.c extcfg.c pdependencies.c pcallbacks.c pscanning.c pinstallation.c ploading.c loggers.c collections.c initdestroy.c fatalerror.c cpinfo.c testmain.c test.h
25 testsuite_LDFLAGS = -dlopen self
26
27 tmpinstalldir = $(CURDIR)/tmp/install
28
29 check-local: install-plugins
30         @numf=0; numt=0; \
31         run_test () { \
32                 local test="$$1"; \
33                 if test -x "$(srcdir)/test-$$test"; then \
34                         srcdir='$(srcdir)' TEST_WRAPPER='$(TEST_WRAPPER)' "$(srcdir)/test-$$test"; \
35                         rc=$$?; \
36                 else \
37                         eval srcdir='$(srcdir)' libtool --mode=execute $(TEST_WRAPPER) ./testsuite "\$$test"; \
38                         rc=$$?; \
39                 fi; \
40                 case $$rc in \
41                         77) \
42                                 echo "SKIPPED: $$test"; \
43                                 ;; \
44                         0) \
45                                 echo "OK: $$test"; \
46                                 numt=$$(($$numt + 1)); \
47                                 ;; \
48                         *) \
49                                 echo "FAIL: $$test"; \
50                                 numt=$$(($$numt + 1)); \
51                                 numf=$$(($$numf + 1)); \
52                                 ;; \
53                 esac; \
54         }; \
55         echo; \
56         echo '===================================================================='; \
57         echo 'C-Pluff Test Suite'; \
58         echo '===================================================================='; \
59         if test '$(SELECTED_TESTS)' = all; then \
60                 while read test; do \
61                         run_test "$$test"; \
62                 done < '$(srcdir)/tests.txt'; \
63         else \
64                 for test in $(SELECTED_TESTS); do \
65                         run_test "$$test"; \
66                 done; \
67         fi; \
68         echo '===================================================================='; \
69         if test $$numf -gt 0; then \
70                 echo "FAILED: $$numf/$$numt"; \
71         else \
72                 echo 'ALL OK!'; \
73         fi; \
74         echo '===================================================================='; \
75         echo; \
76         test $$numf -eq 0
77
78 clean-local:
79         rm -rf tmp
80         test ! -f plugins-source/Makefile || (cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) clean)
81
82 dist-hook:
83         $(MKDIR_P) '$(distdir)'
84         cp -p '$(srcdir)'/test-* '$(distdir)'
85         $(MKDIR_P) '$(distdir)/expected'
86         cp -p '$(srcdir)'/expected/*.txt '$(distdir)'/expected
87         $(MKDIR_P) '$(distdir)'/plugins
88         cd '$(srcdir)'/plugins && \
89                 for d in *; do \
90                         ( mkdir '$(distdir)'/plugins/"$$d" && \
91                                 cp -p "$$d/plugin.xml" '$(distdir)'/plugins/"$$d" ) \
92                         || exit 1; \
93                 done
94         $(MKDIR_P) '$(distdir)'/pcollections
95         cd '$(srcdir)'/pcollections && \
96                 for d in */*; do \
97                         ( $(MKDIR_P) '$(distdir)'/pcollections/"$$d" && \
98                                 cp -p "$$d/plugin.xml" '$(distdir)'/pcollections/"$$d" ) \
99                         || exit 1; \
100                 done
101
102 install-plugins: build-plugins install-libcpluff
103         cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install
104
105 build-plugins:
106         cd plugins-source && $(MAKE)
107
108 install-libcpluff:
109         cd ../libcpluff && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install
110
111 .PHONY: build-plugins install-plugins install-libcpluff