aboutsummaryrefslogtreecommitdiff
path: root/lib/cpluff/test/Makefile.am
blob: 3c05d2f9fc9e6945828d8db92521f46f95c94032 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
## Process this file with automake to produce Makefile.in.

# Copyright 2007 Johannes Lehtinen
# This Makefile is free software; Johannes Lehtinen gives unlimited
# permission to copy, distribute and modify it.

# This can be defined to a debugging wrapper program such as Valgrind.
TEST_WRAPPER =

# This can be defined to a subset of test cases to be performed
SELECTED_TESTS = all

DIST_SUBDIRS = plugins-source

EXTRA_DIST = tests.txt

CPPFLAGS = @CPPFLAGS@
CPPFLAGS += -DCP_HOST="\"$(host)\""

LIBS = @LIBS_OTHER@ @LIBS@

check_PROGRAMS = testsuite

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
testsuite_LDFLAGS = -dlopen self

tmpinstalldir = $(CURDIR)/tmp/install

check-local: install-plugins
	@numf=0; numt=0; \
	run_test () { \
		local test="$$1"; \
		if test -x "$(srcdir)/test-$$test"; then \
			srcdir='$(srcdir)' TEST_WRAPPER='$(TEST_WRAPPER)' "$(srcdir)/test-$$test"; \
			rc=$$?; \
		else \
			eval srcdir='$(srcdir)' libtool --mode=execute $(TEST_WRAPPER) ./testsuite "\$$test"; \
			rc=$$?; \
		fi; \
		case $$rc in \
			77) \
				echo "SKIPPED: $$test"; \
				;; \
			0) \
				echo "OK: $$test"; \
				numt=$$(($$numt + 1)); \
				;; \
			*) \
				echo "FAIL: $$test"; \
				numt=$$(($$numt + 1)); \
				numf=$$(($$numf + 1)); \
				;; \
		esac; \
	}; \
	echo; \
	echo '===================================================================='; \
	echo 'C-Pluff Test Suite'; \
	echo '===================================================================='; \
	if test '$(SELECTED_TESTS)' = all; then \
		while read test; do \
			run_test "$$test"; \
		done < '$(srcdir)/tests.txt'; \
	else \
		for test in $(SELECTED_TESTS); do \
			run_test "$$test"; \
		done; \
	fi; \
	echo '===================================================================='; \
	if test $$numf -gt 0; then \
		echo "FAILED: $$numf/$$numt"; \
	else \
		echo 'ALL OK!'; \
	fi; \
	echo '===================================================================='; \
	echo; \
	test $$numf -eq 0

clean-local:
	rm -rf tmp
	test ! -f plugins-source/Makefile || (cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) clean)

dist-hook:
	$(MKDIR_P) '$(distdir)'
	cp -p '$(srcdir)'/test-* '$(distdir)'
	$(MKDIR_P) '$(distdir)/expected'
	cp -p '$(srcdir)'/expected/*.txt '$(distdir)'/expected
	$(MKDIR_P) '$(distdir)'/plugins
	cd '$(srcdir)'/plugins && \
		for d in *; do \
			( mkdir '$(distdir)'/plugins/"$$d" && \
				cp -p "$$d/plugin.xml" '$(distdir)'/plugins/"$$d" ) \
			|| exit 1; \
		done
	$(MKDIR_P) '$(distdir)'/pcollections
	cd '$(srcdir)'/pcollections && \
		for d in */*; do \
			( $(MKDIR_P) '$(distdir)'/pcollections/"$$d" && \
				cp -p "$$d/plugin.xml" '$(distdir)'/pcollections/"$$d" ) \
			|| exit 1; \
		done

install-plugins: build-plugins install-libcpluff
	cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install

build-plugins:
	cd plugins-source && $(MAKE)

install-libcpluff:
	cd ../libcpluff && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install

.PHONY: build-plugins install-plugins install-libcpluff