forked from linuxmint/cjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-test.am
111 lines (91 loc) · 3.47 KB
/
Makefile-test.am
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
EXTRA_DIST += \
test/run-with-dbus \
test/test-bus.conf
RUN_WITH_DBUS = ${top_srcdir}/test/run-with-dbus --session --system
GTESTER = ${TESTS_ENVIRONMENT} ${RUN_WITH_DBUS} gtester
CLEANFILES += uninstalled-system-test-bus.conf uninstalled-test-bus.conf
clean-local: test-user-data-clean
test-user-data-clean:
-rm -fr $(builddir)/test_user_data
########################################################################
TEST_PROGS += gjs-tests
gjs_tests_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DGJS_COMPILATION \
$(GJSTESTS_CFLAGS) \
$(gjs_directory_defines) \
-I$(top_srcdir)/test
mock_js_resources_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test/mock-js-resources.gresource.xml)
mock-js-resources.h: $(srcdir)/test/mock-js-resources.gresource.xml $(modules_resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) --generate --c-name mock_js_resources $<
mock-js-resources.c: $(srcdir)/test/mock-js-resources.gresource.xml $(modules_resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) --generate --c-name mock_js_resources $<
EXTRA_DIST += $(mock_js_resources_files) $(srcdir)/test/mock-js-resources.gresource.xml \
$(srcdir)/test/gjs-test-coverage/loadedJSFromResource.js
## -rdynamic makes backtraces work
gjs_tests_LDFLAGS = -rdynamic
gjs_tests_LDADD = \
libcjs.la \
$(GJSTESTS_LIBS)
gjs_tests_SOURCES = \
test/gjs-tests.cpp \
test/gjs-tests-add-funcs.h \
test/gjs-test-coverage.cpp \
mock-js-resources.c
check-local: gjs-tests
@test -z "${TEST_PROGS}" || ${GTESTER} -k --verbose ${TEST_PROGS} ${TEST_PROGS_OPTIONS}
# GJS_PATH is empty here since we want to force the use of our own
# resources
TESTS_ENVIRONMENT = \
TOP_SRCDIR=$(abs_top_srcdir) \
DBUS_SESSION_BUS_ADDRESS='' \
XDG_DATA_HOME=test_user_data \
GJS_DEBUG_OUTPUT=test_user_data/logs/cjs.log \
BUILDDIR=. \
GJS_USE_UNINSTALLED_FILES=1 \
GJS_TEST_TIMEOUT=420 \
GJS_PATH= \
GI_TYPELIB_PATH=$(builddir):$(GI_TYPELIB_PATH) \
LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(FIREFOX_JS_LIBDIR)" \
G_FILENAME_ENCODING=latin1 # ensure filenames are not utf8
if ENABLE_COVERAGE
# These paths are resource paths but they have resource://
# stripped out, for ease of parsing in the test runner
coverage_paths = \
/org/gnome/gjs/modules/cairo.js \
/org/gnome/gjs/modules/coverage.js \
/org/gnome/gjs/modules/format.js \
/org/gnome/gjs/modules/gettext.js \
/org/gnome/gjs/modules/jsUnit.js \
/org/gnome/gjs/modules/lang.js \
/org/gnome/gjs/modules/mainloop.js \
/org/gnome/gjs/modules/signals.js
empty :=
space := $(empty) $(empty)
colon := :
coverage_env := $(subst $(space),$(colon),$(coverage_paths))
TESTS_ENVIRONMENT += \
GJS_UNIT_COVERAGE_OUTPUT=lcov \
GJS_UNIT_COVERAGE_PATHS=$(coverage_env)
endif
########################################################################
if ENABLE_COVERAGE
lcov:
test -d lcov || mkdir lcov
$(LCOV) --compat-libtool --directory . --capture -o lcov/lcov_tmp.info
$(LCOV) --extract lcov/lcov_tmp.info "$(PWD)/*" -o lcov/lcov.info
rm -f lcov/lcov_tmp.info
$(GENHTML) --legend -o lcov lcov/lcov.info lcov/coverage.lcov
lcov-clean:
find . -name '*.gcda' -delete
rm -rf lcov
lcov-realclean: lcov-clean
find . -name '*.gcno' -delete
clean-local: lcov-realclean
.PHONY: lcov lcov-clean lcov-realclean
else
lcov:
@echo >&1 "*** ERROR: 'configure --enable-coverage' required"
@exit 1
.PHONY: lcov
endif