Commit 838a7f34 authored by Philip Chimento's avatar Philip Chimento 🚮

build: Reorganize testing makefiles

These were a bit hard to navigate before, it was difficult to determine
where to look if you wanted to write a test for new functionality. Now
everything devoted to making "make check" work is in Makefile-test.am.
The file is delineated into sections and comments are added.

All the rules for converting some of the tests into installed tests, and
installing them in the right place, are in Makefile-insttest.am now.

https://bugzilla.gnome.org/show_bug.cgi?id=775205
parent 8cda645e
......@@ -4,185 +4,28 @@ EXTRA_DIST += \
installed-tests/js/jsunit.gresources.xml \
$(NULL)
installedtestmetadir = $(datadir)/installed-tests/gjs
installedtestmeta_DATA =
if BUILDOPT_INSTALL_TESTS
installedtestmeta_DATA += jsunit.test
endif
jsunit.test: installed-tests/jsunit.test.in Makefile
$(AM_V_GEN)$(MKDIR_P) $(@D) && \
$(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir), < $< > $@.tmp && mv $@.tmp $@
MAINTAINERCLEANFILES += jsunit.test
MAINTAINERCLEANFILES += jsunit.test testSystemExit.test
gjsinsttestdir = $(pkglibexecdir)/installed-tests
gjsinsttest_PROGRAMS =
if BUILDOPT_INSTALL_TESTS
gjsinsttest_PROGRAMS += jsunit
endif
check_PROGRAMS += jsunit
TEST_INTROSPECTION_GIRS =
jsunit_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(GJS_CFLAGS) \
-DPKGLIBDIR=\"$(pkglibdir)\" \
-DINSTTESTDIR=\"$(gjsinsttestdir)\" \
-I$(top_srcdir)
jsunit_LDADD = $(GJS_LIBS) libgjs.la
jsunit_LDFLAGS = -rpath $(pkglibdir)
jsunit_SOURCES = \
installed-tests/gjs-unit.cpp \
jsunit-resources.c \
jsunit-resources.h
jsunit_resources_files := $(shell glib-compile-resources --sourcedir=$(srcdir)/installed-tests/js --generate-dependencies $(srcdir)/installed-tests/js/jsunit.gresources.xml)
jsunit-resources.h: $(srcdir)/installed-tests/js/jsunit.gresources.xml $(jsunit_resources_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir)/installed-tests/js --sourcedir=$(builddir) --generate --c-name jsunit_resources $<
jsunit-resources.c: $(srcdir)/installed-tests/js/jsunit.gresources.xml $(jsunit_resources_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir)/installed-tests/js --sourcedir=$(builddir) --generate --c-name jsunit_resources $<
BUILT_SOURCES += jsunit-resources.h jsunit-resources.c
CLEANFILES += jsunit-resources.h jsunit-resources.c
EXTRA_DIST += $(jsunit_resources_files)
common_test_ldflags = -avoid-version
common_test_libadd = $(GJS_LIBS)
pkglib_LTLIBRARIES =
check_LTLIBRARIES =
if BUILDOPT_INSTALL_TESTS
pkglib_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
else
check_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
# This rpath /nowhere thing is the libtool upstream recommended way to
# force generation of shared libraries, which we need in order for the
# tests to work uninstalled.
common_test_ldflags += -rpath /nowhere
endif
nodist_libregress_la_SOURCES = \
installed-tests/regress.c \
installed-tests/regress.h \
$(NULL)
libregress_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS) $(GJS_GDBUS_CFLAGS)
libregress_la_LDFLAGS = $(common_test_ldflags) $(GJS_GDBUS_LIBS)
libregress_la_LIBADD = $(common_test_libadd)
libregress_scannerflags_includes = --include=Gio-2.0
if ENABLE_CAIRO
libregress_la_CPPFLAGS += $(GJS_CAIRO_CFLAGS)
libregress_la_LDFLAGS += $(GJS_CAIRO_LIBS)
libregress_scannerflags_includes += --include=cairo-1.0
else
libregress_la_CPPFLAGS += -D_GI_DISABLE_CAIRO
endif
nodist_libwarnlib_la_SOURCES = \
installed-tests/warnlib.c \
installed-tests/warnlib.h \
$(NULL)
libwarnlib_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
libwarnlib_la_LDFLAGS = $(common_test_ldflags)
libwarnlib_la_LIBADD = $(common_test_libadd)
nodist_libgimarshallingtests_la_SOURCES = \
installed-tests/gimarshallingtests.c \
installed-tests/gimarshallingtests.h \
$(NULL)
libgimarshallingtests_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
libgimarshallingtests_la_LDFLAGS = $(common_test_ldflags)
libgimarshallingtests_la_LIBADD = $(common_test_libadd)
Regress-1.0.gir: libregress.la
Regress_1_0_gir_LIBS = libregress.la
Regress_1_0_gir_FILES = $(nodist_libregress_la_SOURCES)
Regress_1_0_gir_SCANNERFLAGS = \
--warn-all --warn-error \
$(libregress_scannerflags_includes) \
$(WARN_SCANNERFLAGS) \
$(NULL)
if !ENABLE_CAIRO
Regress_1_0_gir_CFLAGS = -D_GI_DISABLE_CAIRO
endif
TEST_INTROSPECTION_GIRS += Regress-1.0.gir
WarnLib-1.0.gir: libwarnlib.la
WarnLib_1_0_gir_LIBS = libwarnlib.la
WarnLib_1_0_gir_INCLUDES = Gio-2.0
WarnLib_1_0_gir_FILES = $(nodist_libwarnlib_la_SOURCES)
WarnLib_1_0_gir_SCANNERFLAGS = \
--c-include="warnlib.h" \
--symbol-prefix=warnlib_ \
$(NULL)
TEST_INTROSPECTION_GIRS += WarnLib-1.0.gir
GIMarshallingTests-1.0.gir: libgimarshallingtests.la
GIMarshallingTests_1_0_gir_LIBS = libgimarshallingtests.la
GIMarshallingTests_1_0_gir_INCLUDES = Gio-2.0
GIMarshallingTests_1_0_gir_FILES = $(nodist_libgimarshallingtests_la_SOURCES)
GIMarshallingTests_1_0_gir_SCANNERFLAGS = \
--symbol-prefix=gi_marshalling_tests \
--warn-all --warn-error \
$(WARN_SCANNERFLAGS) \
$(NULL)
TEST_INTROSPECTION_GIRS += GIMarshallingTests-1.0.gir
installedtestmetadir = $(datadir)/installed-tests/gjs
jstestsdir = $(gjsinsttestdir)/js
jsscripttestsdir = $(gjsinsttestdir)/scripts
$(foreach gir,$(TEST_INTROSPECTION_GIRS),$(eval $(call introspection-scanner,$(gir))))
gjsinsttest_PROGRAMS =
gjsinsttest_DATA =
noinst_DATA =
if BUILDOPT_INSTALL_TESTS
gjsinsttest_DATA += $(TEST_INTROSPECTION_GIRS:.gir=.typelib)
else
noinst_DATA += $(TEST_INTROSPECTION_GIRS:.gir=.typelib)
endif
CLEANFILES += $(TEST_INTROSPECTION_GIRS) $(TEST_INTROSPECTION_GIRS:.gir=.typelib)
common_jstests_files = \
installed-tests/js/test0010basic.js \
installed-tests/js/test0020importer.js \
installed-tests/js/test0030basicBoxed.js \
installed-tests/js/test0040mainloop.js \
installed-tests/js/testself.js \
installed-tests/js/testByteArray.js \
installed-tests/js/testClass.js \
installed-tests/js/testCoverage.js \
installed-tests/js/testExceptions.js \
installed-tests/js/testEverythingBasic.js \
installed-tests/js/testEverythingEncapsulated.js \
installed-tests/js/testFormat.js \
installed-tests/js/testFundamental.js \
installed-tests/js/testGettext.js \
installed-tests/js/testGIMarshalling.js \
installed-tests/js/testGObjectClass.js \
installed-tests/js/testGObjectInterface.js \
installed-tests/js/testGTypeClass.js \
installed-tests/js/testImporter.js \
installed-tests/js/testInterface.js \
installed-tests/js/testJS1_8.js \
installed-tests/js/testLang.js \
installed-tests/js/testLocale.js \
installed-tests/js/testMainloop.js \
installed-tests/js/testMetaClass.js \
installed-tests/js/testNamespace.js \
installed-tests/js/testParamSpec.js \
installed-tests/js/testReflectObject.js \
installed-tests/js/testSignals.js \
installed-tests/js/testSystem.js \
installed-tests/js/testTweener.js \
installed-tests/js/testUnicode.js
EXTRA_DIST += \
$(common_jstests_files) \
installed-tests/js/testCairo.js \
installed-tests/js/testGtk.js \
installed-tests/js/testGDBus.js \
installed-tests/scripts/testSystemExit.js \
$(NULL)
installedtestmeta_DATA =
jstests_DATA =
jsscripttests_DATA =
pkglib_LTLIBRARIES =
if BUILDOPT_INSTALL_TESTS
jstestsdir = $(gjsinsttestdir)/js
jstests_DATA = $(common_jstests_files)
gjsinsttest_PROGRAMS += jsunit
gjsinsttest_DATA += $(TEST_INTROSPECTION_TYPELIBS)
installedtestmeta_DATA += jsunit.test testSystemExit.test
jstests_DATA += $(common_jstests_files)
jsscripttests_DATA += installed-tests/scripts/testSystemExit.js
pkglib_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
if ENABLE_CAIRO
jstests_DATA += installed-tests/js/testCairo.js
......@@ -196,6 +39,10 @@ if DBUS_TESTS
jstests_DATA += installed-tests/js/testGDBus.js
endif
jsunit.test: installed-tests/jsunit.test.in Makefile
$(AM_V_GEN)$(MKDIR_P) $(@D) && \
$(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir), < $< > $@.tmp && mv $@.tmp $@
%.test: installed-tests/scripts/%.js installed-tests/script.test.in Makefile
$(AM_V_GEN)$(MKDIR_P) $(@D) && \
$(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir), \
......@@ -203,9 +50,4 @@ endif
< $(srcdir)/installed-tests/script.test.in > $@.tmp && \
mv $@.tmp $@
jsscripttestsdir = $(gjsinsttestdir)/scripts
jsscripttests_DATA = installed-tests/scripts/testSystemExit.js
installedtestmeta_DATA += testSystemExit.test
endif
MAINTAINERCLEANFILES += testSystemExit.test
endif BUILDOPT_INSTALL_TESTS
......@@ -36,15 +36,7 @@ if !ENABLE_CAIRO
SKIPPED_TESTS += /js/Cairo
endif
########################################################################
check_PROGRAMS += gjs-tests
gjs_tests_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DGJS_COMPILATION \
$(GJSTESTS_CFLAGS) \
$(gjs_directory_defines) \
-I$(top_srcdir)/test
### TEST RESOURCES #####################################################
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)
......@@ -71,13 +63,47 @@ mock-cache-invalidation-before.gresource: $(mock_js_invalidation_before_resource
mock-cache-invalidation-after.gresource: $(mock_js_invalidation_after_resources_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(mock_js_invalidation_resources_dir)/after $(mock_js_invalidation_resources_dir)/after/mock-js-resource-cache-after.gresource.xml
jsunit_resources_files := $(shell glib-compile-resources --sourcedir=$(srcdir)/installed-tests/js --generate-dependencies $(srcdir)/installed-tests/js/jsunit.gresources.xml)
jsunit-resources.h: $(srcdir)/installed-tests/js/jsunit.gresources.xml $(jsunit_resources_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir)/installed-tests/js --sourcedir=$(builddir) --generate --c-name jsunit_resources $<
jsunit-resources.c: $(srcdir)/installed-tests/js/jsunit.gresources.xml $(jsunit_resources_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir)/installed-tests/js --sourcedir=$(builddir) --generate --c-name jsunit_resources $<
BUILT_SOURCES += mock-js-resources.c jsunit-resources.h jsunit-resources.c
EXTRA_DIST += \
$(mock_js_resources_files) \
$(mock_js_invalidation_resources_files) \
$(srcdir)/test/mock-js-resources.gresource.xml \
$(srcdir)/test/gjs-test-coverage/loadedJSFromResource.js \
$(jsunit_resources_files) \
$(NULL)
CLEANFILES += \
mock-cache-invalidation-before.gresource \
mock-cache-invalidation-after.gresource \
mock-js-resources.c \
jsunit-resources.c \
jsunit-resources.h \
$(NULL)
### TEST PROGRAMS ######################################################
# gjs-tests checks private APIs and is run only uninstalled, on "make check".
#
# jsunit checks public APIs using JS test scripts, and is run on "make check",
# as well as installed if --enable-installed-tests is given at configure time.
# See Makefile-insttest.am for the build rules installing the tests.
check_PROGRAMS += gjs-tests jsunit
gjs_tests_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DGJS_COMPILATION \
$(GJSTESTS_CFLAGS) \
$(gjs_directory_defines) \
-I$(top_srcdir)/test
gjs_tests_LDADD = \
libgjs.la \
$(GJSTESTS_LIBS)
......@@ -96,12 +122,158 @@ gjs_tests_DEPENDENCIES = \
mock-cache-invalidation-after.gresource \
$(NULL)
CLEANFILES += \
mock-cache-invalidation-before.gresource \
mock-cache-invalidation-after.gresource \
mock-js-resources.c \
jsunit_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(GJS_CFLAGS) \
-DPKGLIBDIR=\"$(pkglibdir)\" \
-DINSTTESTDIR=\"$(gjsinsttestdir)\" \
-I$(top_srcdir) \
$(NULL)
jsunit_LDADD = $(GJS_LIBS) libgjs.la
jsunit_LDFLAGS = -rpath $(pkglibdir)
jsunit_SOURCES = \
installed-tests/gjs-unit.cpp \
jsunit-resources.c \
jsunit-resources.h \
$(NULL)
### TEST GIRS ##########################################################
TEST_INTROSPECTION_GIRS =
common_test_ldflags = -avoid-version
common_test_libadd = $(GJS_LIBS)
if !BUILDOPT_INSTALL_TESTS
# This rpath /nowhere thing is the libtool upstream recommended way to
# force generation of shared libraries, which we need in order for the
# tests to work uninstalled.
common_test_ldflags += -rpath /nowhere
# In the installed tests case, these libraries are built for pkglibdir; sadly we
# can only have one destination at a time
check_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
endif
# These sources are installed as part of gobject-introspection, and symlinked
# into the build directory at configure time. They should not be distributed
# with GJS.
nodist_libregress_la_SOURCES = \
installed-tests/regress.c \
installed-tests/regress.h \
$(NULL)
libregress_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS) $(GJS_GDBUS_CFLAGS)
libregress_la_LDFLAGS = $(common_test_ldflags) $(GJS_GDBUS_LIBS)
libregress_la_LIBADD = $(common_test_libadd)
libregress_scannerflags_includes = --include=Gio-2.0
if ENABLE_CAIRO
libregress_la_CPPFLAGS += $(GJS_CAIRO_CFLAGS)
libregress_la_LDFLAGS += $(GJS_CAIRO_LIBS)
libregress_scannerflags_includes += --include=cairo-1.0
else
libregress_la_CPPFLAGS += -D_GI_DISABLE_CAIRO
endif
Regress-1.0.gir: libregress.la
Regress_1_0_gir_LIBS = libregress.la
Regress_1_0_gir_FILES = $(nodist_libregress_la_SOURCES)
Regress_1_0_gir_SCANNERFLAGS = \
--warn-all --warn-error \
$(libregress_scannerflags_includes) \
$(WARN_SCANNERFLAGS) \
$(NULL)
if !ENABLE_CAIRO
Regress_1_0_gir_CFLAGS = -D_GI_DISABLE_CAIRO
endif
TEST_INTROSPECTION_GIRS += Regress-1.0.gir
nodist_libwarnlib_la_SOURCES = \
installed-tests/warnlib.c \
installed-tests/warnlib.h \
$(NULL)
libwarnlib_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
libwarnlib_la_LDFLAGS = $(common_test_ldflags)
libwarnlib_la_LIBADD = $(common_test_libadd)
WarnLib-1.0.gir: libwarnlib.la
WarnLib_1_0_gir_LIBS = libwarnlib.la
WarnLib_1_0_gir_INCLUDES = Gio-2.0
WarnLib_1_0_gir_FILES = $(nodist_libwarnlib_la_SOURCES)
WarnLib_1_0_gir_SCANNERFLAGS = \
--c-include="warnlib.h" \
--symbol-prefix=warnlib_ \
$(NULL)
TEST_INTROSPECTION_GIRS += WarnLib-1.0.gir
nodist_libgimarshallingtests_la_SOURCES = \
installed-tests/gimarshallingtests.c \
installed-tests/gimarshallingtests.h \
$(NULL)
libgimarshallingtests_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
libgimarshallingtests_la_LDFLAGS = $(common_test_ldflags)
libgimarshallingtests_la_LIBADD = $(common_test_libadd)
GIMarshallingTests-1.0.gir: libgimarshallingtests.la
GIMarshallingTests_1_0_gir_LIBS = libgimarshallingtests.la
GIMarshallingTests_1_0_gir_INCLUDES = Gio-2.0
GIMarshallingTests_1_0_gir_FILES = $(nodist_libgimarshallingtests_la_SOURCES)
GIMarshallingTests_1_0_gir_SCANNERFLAGS = \
--symbol-prefix=gi_marshalling_tests \
--warn-all --warn-error \
$(WARN_SCANNERFLAGS) \
$(NULL)
TEST_INTROSPECTION_GIRS += GIMarshallingTests-1.0.gir
$(foreach gir,$(TEST_INTROSPECTION_GIRS),$(eval $(call introspection-scanner,$(gir))))
TEST_INTROSPECTION_TYPELIBS = $(TEST_INTROSPECTION_GIRS:.gir=.typelib)
noinst_DATA += $(TEST_INTROSPECTION_TYPELIBS)
CLEANFILES += $(TEST_INTROSPECTION_GIRS) $(TEST_INTROSPECTION_TYPELIBS)
### JAVASCRIPT TESTS ###################################################
common_jstests_files = \
installed-tests/js/test0010basic.js \
installed-tests/js/test0020importer.js \
installed-tests/js/test0030basicBoxed.js \
installed-tests/js/test0040mainloop.js \
installed-tests/js/testself.js \
installed-tests/js/testByteArray.js \
installed-tests/js/testClass.js \
installed-tests/js/testCoverage.js \
installed-tests/js/testExceptions.js \
installed-tests/js/testEverythingBasic.js \
installed-tests/js/testEverythingEncapsulated.js \
installed-tests/js/testFormat.js \
installed-tests/js/testFundamental.js \
installed-tests/js/testGettext.js \
installed-tests/js/testGIMarshalling.js \
installed-tests/js/testGObjectClass.js \
installed-tests/js/testGObjectInterface.js \
installed-tests/js/testGTypeClass.js \
installed-tests/js/testImporter.js \
installed-tests/js/testInterface.js \
installed-tests/js/testJS1_8.js \
installed-tests/js/testLang.js \
installed-tests/js/testLocale.js \
installed-tests/js/testMainloop.js \
installed-tests/js/testMetaClass.js \
installed-tests/js/testNamespace.js \
installed-tests/js/testParamSpec.js \
installed-tests/js/testReflectObject.js \
installed-tests/js/testSignals.js \
installed-tests/js/testSystem.js \
installed-tests/js/testTweener.js \
installed-tests/js/testUnicode.js \
$(NULL)
EXTRA_DIST += \
$(common_jstests_files) \
installed-tests/js/testCairo.js \
installed-tests/js/testGtk.js \
installed-tests/js/testGDBus.js \
installed-tests/scripts/testSystemExit.js \
$(NULL)
### TEST EXECUTION #####################################################
# GJS_PATH is empty here since we want to force the use of our own
# resources. G_FILENAME_ENCODING ensures filenames are not UTF-8.
AM_TESTS_ENVIRONMENT = \
......
......@@ -7,11 +7,13 @@ bin_PROGRAMS =
lib_LTLIBRARIES =
noinst_HEADERS =
noinst_LTLIBRARIES =
noinst_DATA =
dist_gjsjs_DATA =
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST =
check_PROGRAMS =
check_LTLIBRARIES =
TESTS = $(check_PROGRAMS)
INTROSPECTION_GIRS =
## ACLOCAL_AMFLAGS can be removed for Automake 1.13
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment