Skip to contentSkip to conversation

glib-2.0: fix handling of skipped tests

PATCH In review Ross Burton 2 participants 5 messages Jan 30, 2014 – Feb 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 glib-2.0: fix handling of skipped tests

Backport a patch from upstream to fix skipped tests, essential for gdk-pixbuf to pass without enabling all loaders.

---
 .../glib-2.0/glib-2.0/gtest-skip-fixes.patch       |  197 ++++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb      |    1 +
 2 files changed, 198 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/gtest-skip-fixes.patch
meta/recipes-core/glib-2.0/glib-2.0/gtest-skip-fixes.patch new file +197 -0
new file mode 100644
index 0000000..3dba0ee
@@ -0,0 +1,197 @@
+Fix the handling of skipped tests so that it follows what automake does.
+
+Upstream-Status: Backport [https://bugzilla.gnome.org/show_bug.cgi?id=720263]
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/glib/gtestutils.c b/glib/gtestutils.c
+index bc7bbcf..feaafa3 100644
+--- a/glib/gtestutils.c
++++ b/glib/gtestutils.c
+@@ -607,9 +607,10 @@ static gchar      *test_run_name = "";
+ static GSList    **test_filename_free_list;
+ static guint       test_run_forks = 0;
+ static guint       test_run_count = 0;
++static guint       test_skipped_count = 0;
+ static GTestResult test_run_success = G_TEST_RUN_FAILURE;
+ static gchar      *test_run_msg = NULL;
+-static guint       test_skip_count = 0;
++static guint       test_startup_skip_count = 0;
+ static GTimer     *test_user_timer = NULL;
+ static double      test_user_stamp = 0;
+ static GSList     *test_paths = NULL;
+@@ -765,6 +766,8 @@ g_test_log (GTestLogType lbit,
+             g_print ("Bail out!\n");
+           abort();
+         }
++      if (largs[0] == G_TEST_RUN_SKIPPED)
++        test_skipped_count++;
+       break;
+     case G_TEST_LOG_MIN_RESULT:
+       if (test_tap_log)
+@@ -869,11 +872,11 @@ parse_args (gint    *argc_p,
+         {
+           gchar *equal = argv[i] + 16;
+           if (*equal == '=')
+-            test_skip_count = g_ascii_strtoull (equal + 1, NULL, 0);
++            test_startup_skip_count = g_ascii_strtoull (equal + 1, NULL, 0);
+           else if (i + 1 < argc)
+             {
+               argv[i++] = NULL;
+-              test_skip_count = g_ascii_strtoull (argv[i], NULL, 0);
++              test_startup_skip_count = g_ascii_strtoull (argv[i], NULL, 0);
+             }
+           argv[i] = NULL;
+         }
+@@ -1516,14 +1519,21 @@ g_test_get_root (void)
+  * g_test_run_suite() or g_test_run() may only be called once
+  * in a program.
+  *
+- * Returns: 0 on success
++ * Returns: 0 on success, 1 on failure (assuming it returns at all),
++ *   77 if all tests were skipped with g_test_skip().
+  *
+  * Since: 2.16
+  */
+ int
+ g_test_run (void)
+ {
+-  return g_test_run_suite (g_test_get_root());
++  if (g_test_run_suite (g_test_get_root()) != 0)
++    return 1;
++
++  if (test_run_count > 0 && test_run_count == test_skipped_count)
++    return 77;
++  else
++    return 0;
+ }
+ 
+ /**
+@@ -2063,7 +2073,7 @@ test_case_run (GTestCase *tc)
+         }
+     }
+ 
+-  if (++test_run_count <= test_skip_count)
++  if (++test_run_count <= test_startup_skip_count)
+     g_test_log (G_TEST_LOG_SKIP_CASE, test_run_name, NULL, 0, NULL);
+   else if (test_run_list)
+     {
+@@ -2117,7 +2127,8 @@ test_case_run (GTestCase *tc)
+   g_free (test_uri_base);
+   test_uri_base = old_base;
+ 
+-  return success == G_TEST_RUN_SUCCESS;
++  return (success == G_TEST_RUN_SUCCESS ||
++          success == G_TEST_RUN_SKIPPED);
+ }
+ 
+ static int
+diff --git a/glib/tests/testing.c b/glib/tests/testing.c
+index 20c2e79..1025f12 100644
+--- a/glib/tests/testing.c
++++ b/glib/tests/testing.c
+@@ -575,10 +575,93 @@ test_nonfatal (void)
+   g_test_trap_assert_stdout ("*The End*");
+ }
+ 
++static void
++test_skip (void)
++{
++  g_test_skip ("Skipped should count as passed, not failed");
++}
++
++static void
++test_pass (void)
++{
++}
++
++static const char *argv0;
++
++static void
++test_skip_all (void)
++{
++  GPtrArray *argv;
++  GError *error = NULL;
++  int status;
++
++  argv = g_ptr_array_new ();
++  g_ptr_array_add (argv, (char *) argv0);
++  g_ptr_array_add (argv, "--GTestSubprocess");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip");
++  g_ptr_array_add (argv, NULL);
++
++  g_spawn_sync (NULL, (char **) argv->pdata, NULL,
++                G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
++                NULL, NULL, NULL, NULL, &status,
++                &error);
++  g_assert_no_error (error);
++
++  g_spawn_check_exit_status (status, &error);
++  g_assert_error (error, G_SPAWN_EXIT_ERROR, 77);
++  g_clear_error (&error);
++
++  g_ptr_array_set_size (argv, 0);
++  g_ptr_array_add (argv, (char *) argv0);
++  g_ptr_array_add (argv, "--GTestSubprocess");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip-all/subprocess/skip1");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip-all/subprocess/skip2");
++  g_ptr_array_add (argv, NULL);
++
++  g_spawn_sync (NULL, (char **) argv->pdata, NULL,
++                G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
++                NULL, NULL, NULL, NULL, &status,
++                &error);
++  g_assert_no_error (error);
++
++  g_spawn_check_exit_status (status, &error);
++  g_assert_error (error, G_SPAWN_EXIT_ERROR, 77);
++  g_clear_error (&error);
++
++  g_ptr_array_set_size (argv, 0);
++  g_ptr_array_add (argv, (char *) argv0);
++  g_ptr_array_add (argv, "--GTestSubprocess");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip-all/subprocess/pass");
++  g_ptr_array_add (argv, "-p");
++  g_ptr_array_add (argv, "/misc/skip-all/subprocess/skip1");
++  g_ptr_array_add (argv, NULL);
++
++  g_spawn_sync (NULL, (char **) argv->pdata, NULL,
++                G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
++                NULL, NULL, NULL, NULL, &status,
++                &error);
++  g_assert_no_error (error);
++
++  g_spawn_check_exit_status (status, &error);
++  g_assert_no_error (error);
++
++  g_ptr_array_unref (argv);
++}
++
+ int
+ main (int   argc,
+       char *argv[])
+ {
++  argv0 = argv[0];
++
+   g_test_init (&argc, &argv, NULL);
+ 
+   g_test_add_func ("/random-generator/rand-1", test_rand1);
+@@ -633,5 +716,11 @@ main (int   argc,
+ 
+   g_test_add_func ("/misc/nonfatal", test_nonfatal);
+ 
++  g_test_add_func ("/misc/skip", test_skip);
++  g_test_add_func ("/misc/skip-all", test_skip_all);
++  g_test_add_func ("/misc/skip-all/subprocess/skip1", test_skip);
++  g_test_add_func ("/misc/skip-all/subprocess/skip2", test_skip);
++  g_test_add_func ("/misc/skip-all/subprocess/pass", test_pass);
++
+   return g_test_run();
+ }
meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb +1 -0
index 9745a9e..161f7da 100644
@@ -13,6 +13,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://0001-gio-Fix-Werror-format-string-errors-from-mismatched-.patch \
            file://ptest-dbus.patch \
            file://ptest-paths.patch \
+           file://gtest-skip-fixes.patch \
           "
 
 SRC_URI_append_class-native = " file://glib-gettextize-dir.patch"
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 gnome-desktop-testing: upgrade to current git master

no-introspection.patch has been merged upstream.

Update license checksum as copyright dates have been updated.

---
 .../files/no-introspection.patch                    |   19 -------------------
 ...sting_2013.1.bb => gnome-desktop-testing_git.bb} |   12 +++++++-----
 2 files changed, 7 insertions(+), 24 deletions(-)
 delete mode 100644 meta/recipes-support/gnome-desktop-testing/files/no-introspection.patch
 rename meta/recipes-support/gnome-desktop-testing/{gnome-desktop-testing_2013.1.bb => gnome-desktop-testing_git.bb} (60%)
meta/recipes-support/gnome-desktop-testing/files/no-introspection.patch deleted +0 -19
deleted file mode 100644
index 67b64f2..0000000
@@ -1,19 +0,0 @@
-Introspection is a hard requirement to build gnome-desktop-testing upstream, but
-it isn't needed anymore.
-
-Upstream-Status: Submitted
-Signed-off-by: Ross Burton <[email protected]>
-
-diff --git a/configure.ac b/configure.ac
-index 7460c69..6249caf 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -27,8 +27,6 @@ AC_SUBST(WARN_CFLAGS)
- LT_PREREQ([2.2.4])
- LT_INIT([disable-static])
- 
--GOBJECT_INTROSPECTION_REQUIRE([1.34.0])
--
- PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0 >= 2.34.0])
- GIO_UNIX_CFLAGS="$GIO_UNIX_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36"
- 
meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_git.bb renamed from meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2013.1.bb +7 -5
similarity index 60%
rename from meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2013.1.bb
rename to meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_git.bb
index 36e13b1..be43d98 100644
@@ -2,13 +2,15 @@ SUMMARY = "Test runner for GNOME-style installed tests"
 HOMEPAGE = "https://wiki.gnome.org/GnomeGoals/InstalledTests"
 LICENSE = "LGPLv2+"
 
-SRC_URI = "${GNOME_MIRROR}/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
-           file://no-introspection.patch"
-SRC_URI[md5sum] = "c6824f7bfac95bf0fcf6ed0c255979c1"
-SRC_URI[sha256sum] = "632e7224de8614a8e4b7cdf87fc32551531efa9290fba0da4dae56234c584b7b"
+SRCREV = "fbec635575013b22ed5aa853e725448057ac54bc"
+PV = "2013.1+git${SRCPV}"
+
+SRC_URI = "gitsm://git.gnome.org/${PN}"
+
+S = "${WORKDIR}/git"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
-                    file://src/gnome-desktop-testing-runner.c;endline=19;md5=ab86a2e00ab9cbb94f008d785004b181"
+                    file://src/gnome-desktop-testing-runner.c;endline=19;md5=67311a600b83fd0068dfc7e5b84ffb3f"
 
 DEPENDS = "glib-2.0"
 
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 2/3] gnome-desktop-testing: upgrade to current git master

Quoted 48 lines · Ross Burton

no-introspection.patch has been merged upstream.

Update license checksum as copyright dates have been updated.

---
 .../files/no-introspection.patch                    |   19 -------------------
 ...sting_2013.1.bb => gnome-desktop-testing_git.bb} |   12 +++++++-----
 2 files changed, 7 insertions(+), 24 deletions(-)
 delete mode 100644 meta/recipes-support/gnome-desktop-testing/files/no-introspection.patch
 rename meta/recipes-support/gnome-desktop-testing/{gnome-desktop-testing_2013.1.bb => gnome-desktop-testing_git.bb} (60%)
meta/recipes-support/gnome-desktop-testing/files/no-introspection.patch deleted +0 -19
deleted file mode 100644
index 67b64f2..0000000
@@ -1,19 +0,0 @@
-Introspection is a hard requirement to build gnome-desktop-testing upstream, but
-it isn't needed anymore.
-
-Upstream-Status: Submitted
-Signed-off-by: Ross Burton <[email protected]>
-
-diff --git a/configure.ac b/configure.ac
-index 7460c69..6249caf 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -27,8 +27,6 @@ AC_SUBST(WARN_CFLAGS)
- LT_PREREQ([2.2.4])
- LT_INIT([disable-static])
- 
--GOBJECT_INTROSPECTION_REQUIRE([1.34.0])
--
- PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0 >= 2.34.0])
- GIO_UNIX_CFLAGS="$GIO_UNIX_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36"
- 
meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_git.bb renamed from meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2013.1.bb +0 -0
similarity index 60%
rename from meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2013.1.bb
rename to meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_git.bb
index 36e13b1..be43d98 100644
@@ -2,13 +2,15 @@ SUMMARY = "Test runner for GNOME-style installed tests"
 HOMEPAGE = "https://wiki.gnome.org/GnomeGoals/InstalledTests"
 LICENSE = "LGPLv2+"
 

meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_git.bb SUMMARY = "Test runner for GNOME-style installed tests" · line 10

Quoted 10 lines
meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_git.bb renamed from meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2013.1.bb +6 -4
-SRC_URI = "${GNOME_MIRROR}/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
-           file://no-introspection.patch"
-SRC_URI[md5sum] = "c6824f7bfac95bf0fcf6ed0c255979c1"
-SRC_URI[sha256sum] = "632e7224de8614a8e4b7cdf87fc32551531efa9290fba0da4dae56234c584b7b"
+SRCREV = "fbec635575013b22ed5aa853e725448057ac54bc"
+PV = "2013.1+git${SRCPV}"
+
+SRC_URI = "gitsm://git.gnome.org/${PN}"
+
+S = "${WORKDIR}/git"

Its rather sad to need the gitsm fetcher. That fetcher isn't mirror safe so I'm not sure we can use it.

Regardless, this blows up on multilib builds due to PN instead of BPN.

Cheers,

Richard

#3 lore raw

Re: [PATCH 2/3] gnome-desktop-testing: upgrade to current git master

Quoted 2 lines · Richard Purdie

Its rather sad to need the gitsm fetcher. That fetcher isn't mirror safe so I'm not sure we can use it.

I've been meaning to ask Colin about tar all releases, so I'll do that now.

Ross

#4 lore raw

PATCH 3/3 gdk-pixbuf: enable ptest

In reply to Ross Burton
---
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/run-ptest |    3 +
 .../gdk-pixbuf/gdk-pixbuf/tests-check.patch        |  465 ++++++++++++++++++++
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.30.3.bb |   17 +-
 3 files changed, 483 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/run-ptest
 create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch
meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/run-ptest new file +3 -0
new file mode 100644
index 0000000..8f90723
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+gnome-desktop-testing-runner gdk-pixbuf
meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch new file +465 -0

466 lines not on this page · raw message

meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.30.3.bb +15 -2
index 187af46..85a7b43 100644
@@ -16,12 +16,14 @@ MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"
 SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \
            file://hardcoded_libtool.patch \
            file://extending-libinstall-dependencies.patch \
+           file://run-ptest \
+           file://tests-check.patch \
            "
 
 SRC_URI[md5sum] = "81161cc895eb43afd9ae7354b87e2261"
 SRC_URI[sha256sum] = "c229c53f59573eab9410b53690a4b9db770312c80a4d84ecd6295aa894574494"
 
-inherit autotools pkgconfig gettext pixbufcache
+inherit autotools pkgconfig gettext pixbufcache ptest
 
 LIBV = "2.10.0"
 
@@ -42,6 +44,7 @@ PACKAGECONFIG[x11] = "--with-x11,--without-x11,virtual/libx11"
 
 EXTRA_OECONF = "\
   --disable-introspection \
+  ${@base_contains('DISTRO_FEATURES', 'ptest', '--enable-installed-tests', '--disable-installed-tests', d)} \
 "
 
 PACKAGES =+ "${PN}-xlib"
@@ -64,6 +67,11 @@ FILES_${PN}-dbg += " \
 	${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders/.debug/* \
 "
 
+FILES_${PN}-ptest += "${libdir}/gdk-pixbuf/installed-tests \
+                      ${datadir}/installed-tests/gdk-pixbuf"
+
+RDEPENDS_${PN}-ptest += "gnome-desktop-testing"
+
 PACKAGES_DYNAMIC += "^gdk-pixbuf-loader-.*"
 PACKAGES_DYNAMIC_class-native = ""
 
@@ -72,7 +80,12 @@ python populate_packages_prepend () {
 
     loaders_root = d.expand('${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders')
 
-    d.setVar('PIXBUF_PACKAGES', ' '.join(do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s')))
+    packages = ' '.join(do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s'))
+    d.setVar('PIXBUF_PACKAGES', packages)
+
+    # The test suite exercises all the loaders, so ensure they are all
+    # dependencies of the ptest package.
+    d.appendVar("RDEPENDS_gdk-pixbuf-ptest", " " + packages)
 }
 
 do_install_append_class-native() {
Signature · 1 line
1.7.10.4