diff options
author | Colin Walters <walters@verbum.org> | 2013-05-03 09:38:59 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-05-03 17:18:03 -0400 |
commit | cba235ffff664c58ac5a7456c6374d98c5917875 (patch) | |
tree | 532930f0f3e936023b5ab1fca007573cea5378a8 | |
parent | 07cd942c6f055c1efb3280e2c2ce495c85e2a77d (diff) | |
download | gtk+-wip/installed-tests.tar.gz |
Add --enable-installed-tests, use it for reftestswip/installed-tests
See https://live.gnome.org/GnomeGoals/InstalledTests
https://bugzilla.gnome.org/show_bug.cgi?id=699601
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | tests/reftests/Makefile.am | 34 | ||||
-rw-r--r-- | tests/reftests/gtk-reftest.c | 27 |
3 files changed, 53 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index d15fdbd1de..a77b735bf9 100644 --- a/configure.ac +++ b/configure.ac @@ -255,6 +255,12 @@ AC_ARG_ENABLE(rebuilds, [AS_HELP_STRING([--disable-rebuilds], [disable all source autogeneration rules])],, [enable_rebuilds=yes]) +AC_ARG_ENABLE(installed_tests, + AS_HELP_STRING([--enable-installed-tests], + [Install test programs (default: no)]),, + [enable_installed_tests=no]) +AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes) + AC_ARG_ENABLE(gtk2-dependency, [AS_HELP_STRING([--enable-gtk2-dependency], diff --git a/tests/reftests/Makefile.am b/tests/reftests/Makefile.am index 3d8b3b61e3..897a877344 100644 --- a/tests/reftests/Makefile.am +++ b/tests/reftests/Makefile.am @@ -1,15 +1,19 @@ include $(top_srcdir)/Makefile.decl +NULL = TEST_PROGS += gtk-reftest check_PROGRAMS = $(TEST_PROGS) +insttestdir=$(pkglibexecdir)/installed-tests + gtk_reftest_CFLAGS = \ -I$(top_srcdir) \ -I$(top_builddir)/gdk \ -I$(top_srcdir)/gdk \ -DGDK_DISABLE_DEPRECATED \ -DGTK_DISABLE_DEPRECATED \ + -DINSTTESTDIR=\""$(insttestdir)"\" \ $(GTK_DEBUG_FLAGS) \ $(GTK_DEP_CFLAGS) @@ -24,8 +28,11 @@ gtk_reftest_SOURCES = \ clean-local: rm -rf output/ || true -EXTRA_DIST += \ - align-expand.sh \ +EXTRA_DIST = align-expand.sh \ + border-image-repeat.sh \ + $(NULL) + +testdata = \ background-area.css \ background-area.ref.ui \ background-area.ui \ @@ -86,7 +93,6 @@ EXTRA_DIST += \ border-image-gradient.ui \ border-image-repeat.css \ border-image-repeat.ref.ui \ - border-image-repeat.sh \ border-image-repeat.ui \ border-image-url.css \ border-image-url.ref.ui \ @@ -109,8 +115,6 @@ EXTRA_DIST += \ box-shadow-spec-inset.css \ box-shadow-spec-inset.ref.ui \ box-shadow-spec-inset.ui \ - button-wrapping.ui \ - button-wrapping.ref.ui \ css-match-class.css \ css-match-class.ref.ui \ css-match-class.ui \ @@ -272,6 +276,24 @@ EXTRA_DIST += \ unresolvable.ref.ui \ unresolvable.ui \ window-default-size.ref.ui \ - window-default-size.ui + window-default-size.ui \ + $(NULL) + +if BUILDOPT_INSTALL_TESTS +reftestdir = $(insttestdir)/reftests +reftest_DATA = $(testdata) + +insttest_PROGRAMS = gtk-reftest + +reftest-%.test: %.ui Makefile + $(AM_V_GEN) (echo '[Test]' > $@.tmp; \ + echo 'Exec=/bin/sh -c "$(pkglibexecdir)/installed-tests/gtk-reftest -o $$(pwd) -d $(pkglibexecdir)/installed-tests/reftests $(notdir $<)"' >> $@.tmp; \ + echo 'Type=session' >> $@.tmp; \ + mv $@.tmp $@) + +testmetadir = $(datadir)/installed-tests/$(PACKAGE) +testuifiles = $(filter %.ui,$(filter-out %.ref.ui,$(testdata))) +testmeta_DATA = $(patsubst %.ui,reftest-%.test,$(testuifiles)) +endif -include $(top_srcdir)/git.mk diff --git a/tests/reftests/gtk-reftest.c b/tests/reftests/gtk-reftest.c index dfa19fdd7d..ff0bd45e70 100644 --- a/tests/reftests/gtk-reftest.c +++ b/tests/reftests/gtk-reftest.c @@ -33,10 +33,13 @@ typedef enum { #define GTK_STYLE_PROVIDER_PRIORITY_FORCE G_MAXUINT static char *arg_output_dir = NULL; +static char *arg_base_dir = NULL; static const GOptionEntry test_args[] = { { "output", 'o', 0, G_OPTION_ARG_FILENAME, &arg_output_dir, "Directory to save image files to", "DIR" }, + { "basedir", 'd', 0, G_OPTION_ARG_FILENAME, &arg_base_dir, + "Directory which contains tests", "DIR" }, { NULL } }; @@ -566,6 +569,9 @@ add_tests_for_files_in_directory (GFile *dir) int main (int argc, char **argv) { + const char *basedir; + GFile *dir; + /* I don't want to fight fuzzy scaling algorithms in GPUs, * so unles you explicitly set it to something else, we * will use Cairo's image surface. @@ -575,16 +581,21 @@ main (int argc, char **argv) if (!parse_command_line (&argc, &argv)) return 1; + if (arg_base_dir) + basedir = arg_base_dir; + else if (g_getenv ("srcdir")) + basedir = g_getenv ("srcdir"); + else + basedir = "."; + + /* We need to ensure the process' current working directory + * is the same as the reftest data, because we're using the + * "file" property of GtkImage as a relative path in builder files. + */ + chdir (basedir); + if (argc < 2) { - const char *basedir; - GFile *dir; - - if (g_getenv ("srcdir")) - basedir = g_getenv ("srcdir"); - else - basedir = "."; - dir = g_file_new_for_path (basedir); add_tests_for_files_in_directory (dir); |