-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile-test.am
161 lines (135 loc) · 4.41 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
RUN_WITH_DBUS = ${top_srcdir}/test/run-with-dbus --session --system
GTESTER = ${TESTS_ENVIRONMENT} ${RUN_WITH_DBUS} gtester
########################################################################
TEST_PROGS += gjs-tests
gjs_tests_CFLAGS = \
-include $(top_srcdir)/test/test.h \
$(AM_CFLAGS) \
$(GJSTESTS_CFLAGS) \
$(gjs_directory_defines) \
-I$(top_srcdir)/test
## -rdynamic makes backtraces work
gjs_tests_LDFLAGS = -rdynamic
gjs_tests_LDADD = \
libgjs.la \
$(GJSTESTS_LIBS)
gjs_tests_SOURCES = \
test/gjs-tests.c \
test/test.h \
$(gjstest_files_with_tests)
nodist_gjs_tests_SOURCES = \
gjstest.c \
gjstest.h
## make-tests always updates the ".stamp" files, but only modifies the
## actual gjstest.[hc] if they change. make-tests creates both
## .h.stamp and .c.stamp but if we listed both, make would run
## make-tests twice.
gjstest.h.stamp : scripts/make-tests $(gjstest_files_with_tests)
$(TESTS_ENVIRONMENT) $(top_srcdir)/scripts/make-tests . $(gjstest_files_with_tests)
gjstest.h gjstest.c : gjstest.h.stamp
@true
TEST_PROGS += gjs-unit
gjs_unit_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(gjs_directory_defines)\
$(GJS_CFLAGS)
gjs_unit_LDADD = \
libgjs.la \
$(GJS_LIBS)
## -rdynamic makes backtraces work
## we -export-dynamic so we can dlopen ourselves and use gobject-introspection
gjs_unit_LDFLAGS=-export-dynamic -rdynamic
gjs_unit_SOURCES = \
test/gjs-unit.c
BUILT_SOURCES += $(nodist_gjs_tests_SOURCES)
CLEANFILES += \
$(nodist_gjs_tests_SOURCES) \
gjstest.c.stamp \
gjstest.h.stamp
EXTRA_DIST += \
scripts/make-tests
########################################################################
TESTS_ENVIRONMENT = \
TOP_SRCDIR=$(top_srcdir) \
DBUS_SESSION_BUS_ADDRESS='' \
XDG_DATA_HOME=test_user_data \
GJS_DEBUG_OUTPUT=test_user_data/logs/gjs.log \
BUILDDIR=. \
GJS_USE_UNINSTALLED_FILES=1 \
LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(FIREFOX_JS_LIBDIR)" \
G_FILENAME_ENCODING=latin1 # ensure filenames are not utf8
test: $(gjsnative_LTLIBRARIES) ${TEST_PROGS}
@test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} ${TEST_PROGS_OPTIONS}
check: test
gdb-check gdb-test: $(gjsnative_LTLIBRARIES) ${TEST_PROGS}
failed=; for prog in ${TEST_PROGS}; do \
${TESTS_ENVIRONMENT} libtool --mode=execute gdb --args $$prog; \
done
valgrind-check valgrind-test: $(gjsnative_LTLIBRARIES) ${TEST_PROGS}
@test -z "${TEST_PROGS}" || { \
failed=; for prog in ${TEST_PROGS}; do \
${TESTS_ENVIRONMENT} G_SLICE=always-malloc \
$(LIBTOOL) --mode=execute valgrind \
--log-file=valgrind.$$prog.log \
--error-exitcode=1 \
--trace-children=yes \
--tool=memcheck \
--leak-check=full \
--suppressions=$(top_srcdir)/test/gjs.supp \
$$VALGRIND_ARGS \
$$prog \
&& $(GREP) -q 'definitely lost: 0 bytes in 0 blocks' valgrind.$$prog.log \
|| failed="$$failed $$prog"; \
done; \
test -z "$$failed" || { \
echo "valgrind failed for:$$failed"; exit 1; \
}; \
}
CLEANFILES += \
$(TEST_PROGS:%=valgrind.%.log) \
uninstalled-test-bus.conf \
uninstalled-system-test-bus.conf
clean-local:
-rm -rf test_user_data
EXTRA_DIST += \
test/js/modules/alwaysThrows.js \
test/js/modules/foobar.js \
test/js/modules/mutualImport/a.js \
test/js/modules/mutualImport/b.js \
test/js/modules/subA/.secret.js \
test/js/modules/subA/.hidden/hidden.js \
test/js/modules/subA/foo \
test/js/modules/subA/subB/__init__.js \
test/js/modules/subA/subB/foobar.js \
test/js/modules/subA/subB/baz.js \
test/js/testself.js \
test/js/testEverythingBasic.js \
test/js/testEverythingEncapsulated.js \
test/js/testGI.js \
test/js/testImporter.js \
test/js/testLang.js \
test/js/testLocale.js \
test/js/testMainloop.js \
test/js/testSignals.js \
test/js/testTweener.js \
test/run-with-dbus \
test/test-bus.conf
########################################################################
if ENABLE_COVERAGE
lcov:
test -d lcov || mkdir lcov
$(LCOV) --compat-libtool --directory . --capture -o lcov/lcov.info
$(GENHTML) --legend -o lcov lcov/lcov.info
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