diff options
-rw-r--r-- | meta/recipes-core/glib-2.0/glib-2.0/gtest-skip-fixes.patch | 197 | ||||
-rw-r--r-- | meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb | 1 |
2 files changed, 198 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/gtest-skip-fixes.patch b/meta/recipes-core/glib-2.0/glib-2.0/gtest-skip-fixes.patch new file mode 100644 index 0000000000..3dba0ee31b --- /dev/null +++ b/meta/recipes-core/glib-2.0/glib-2.0/gtest-skip-fixes.patch | |||
@@ -0,0 +1,197 @@ | |||
1 | Fix the handling of skipped tests so that it follows what automake does. | ||
2 | |||
3 | Upstream-Status: Backport [https://bugzilla.gnome.org/show_bug.cgi?id=720263] | ||
4 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
5 | |||
6 | diff --git a/glib/gtestutils.c b/glib/gtestutils.c | ||
7 | index bc7bbcf..feaafa3 100644 | ||
8 | --- a/glib/gtestutils.c | ||
9 | +++ b/glib/gtestutils.c | ||
10 | @@ -607,9 +607,10 @@ static gchar *test_run_name = ""; | ||
11 | static GSList **test_filename_free_list; | ||
12 | static guint test_run_forks = 0; | ||
13 | static guint test_run_count = 0; | ||
14 | +static guint test_skipped_count = 0; | ||
15 | static GTestResult test_run_success = G_TEST_RUN_FAILURE; | ||
16 | static gchar *test_run_msg = NULL; | ||
17 | -static guint test_skip_count = 0; | ||
18 | +static guint test_startup_skip_count = 0; | ||
19 | static GTimer *test_user_timer = NULL; | ||
20 | static double test_user_stamp = 0; | ||
21 | static GSList *test_paths = NULL; | ||
22 | @@ -765,6 +766,8 @@ g_test_log (GTestLogType lbit, | ||
23 | g_print ("Bail out!\n"); | ||
24 | abort(); | ||
25 | } | ||
26 | + if (largs[0] == G_TEST_RUN_SKIPPED) | ||
27 | + test_skipped_count++; | ||
28 | break; | ||
29 | case G_TEST_LOG_MIN_RESULT: | ||
30 | if (test_tap_log) | ||
31 | @@ -869,11 +872,11 @@ parse_args (gint *argc_p, | ||
32 | { | ||
33 | gchar *equal = argv[i] + 16; | ||
34 | if (*equal == '=') | ||
35 | - test_skip_count = g_ascii_strtoull (equal + 1, NULL, 0); | ||
36 | + test_startup_skip_count = g_ascii_strtoull (equal + 1, NULL, 0); | ||
37 | else if (i + 1 < argc) | ||
38 | { | ||
39 | argv[i++] = NULL; | ||
40 | - test_skip_count = g_ascii_strtoull (argv[i], NULL, 0); | ||
41 | + test_startup_skip_count = g_ascii_strtoull (argv[i], NULL, 0); | ||
42 | } | ||
43 | argv[i] = NULL; | ||
44 | } | ||
45 | @@ -1516,14 +1519,21 @@ g_test_get_root (void) | ||
46 | * g_test_run_suite() or g_test_run() may only be called once | ||
47 | * in a program. | ||
48 | * | ||
49 | - * Returns: 0 on success | ||
50 | + * Returns: 0 on success, 1 on failure (assuming it returns at all), | ||
51 | + * 77 if all tests were skipped with g_test_skip(). | ||
52 | * | ||
53 | * Since: 2.16 | ||
54 | */ | ||
55 | int | ||
56 | g_test_run (void) | ||
57 | { | ||
58 | - return g_test_run_suite (g_test_get_root()); | ||
59 | + if (g_test_run_suite (g_test_get_root()) != 0) | ||
60 | + return 1; | ||
61 | + | ||
62 | + if (test_run_count > 0 && test_run_count == test_skipped_count) | ||
63 | + return 77; | ||
64 | + else | ||
65 | + return 0; | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | @@ -2063,7 +2073,7 @@ test_case_run (GTestCase *tc) | ||
70 | } | ||
71 | } | ||
72 | |||
73 | - if (++test_run_count <= test_skip_count) | ||
74 | + if (++test_run_count <= test_startup_skip_count) | ||
75 | g_test_log (G_TEST_LOG_SKIP_CASE, test_run_name, NULL, 0, NULL); | ||
76 | else if (test_run_list) | ||
77 | { | ||
78 | @@ -2117,7 +2127,8 @@ test_case_run (GTestCase *tc) | ||
79 | g_free (test_uri_base); | ||
80 | test_uri_base = old_base; | ||
81 | |||
82 | - return success == G_TEST_RUN_SUCCESS; | ||
83 | + return (success == G_TEST_RUN_SUCCESS || | ||
84 | + success == G_TEST_RUN_SKIPPED); | ||
85 | } | ||
86 | |||
87 | static int | ||
88 | diff --git a/glib/tests/testing.c b/glib/tests/testing.c | ||
89 | index 20c2e79..1025f12 100644 | ||
90 | --- a/glib/tests/testing.c | ||
91 | +++ b/glib/tests/testing.c | ||
92 | @@ -575,10 +575,93 @@ test_nonfatal (void) | ||
93 | g_test_trap_assert_stdout ("*The End*"); | ||
94 | } | ||
95 | |||
96 | +static void | ||
97 | +test_skip (void) | ||
98 | +{ | ||
99 | + g_test_skip ("Skipped should count as passed, not failed"); | ||
100 | +} | ||
101 | + | ||
102 | +static void | ||
103 | +test_pass (void) | ||
104 | +{ | ||
105 | +} | ||
106 | + | ||
107 | +static const char *argv0; | ||
108 | + | ||
109 | +static void | ||
110 | +test_skip_all (void) | ||
111 | +{ | ||
112 | + GPtrArray *argv; | ||
113 | + GError *error = NULL; | ||
114 | + int status; | ||
115 | + | ||
116 | + argv = g_ptr_array_new (); | ||
117 | + g_ptr_array_add (argv, (char *) argv0); | ||
118 | + g_ptr_array_add (argv, "--GTestSubprocess"); | ||
119 | + g_ptr_array_add (argv, "-p"); | ||
120 | + g_ptr_array_add (argv, "/misc/skip"); | ||
121 | + g_ptr_array_add (argv, NULL); | ||
122 | + | ||
123 | + g_spawn_sync (NULL, (char **) argv->pdata, NULL, | ||
124 | + G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, | ||
125 | + NULL, NULL, NULL, NULL, &status, | ||
126 | + &error); | ||
127 | + g_assert_no_error (error); | ||
128 | + | ||
129 | + g_spawn_check_exit_status (status, &error); | ||
130 | + g_assert_error (error, G_SPAWN_EXIT_ERROR, 77); | ||
131 | + g_clear_error (&error); | ||
132 | + | ||
133 | + g_ptr_array_set_size (argv, 0); | ||
134 | + g_ptr_array_add (argv, (char *) argv0); | ||
135 | + g_ptr_array_add (argv, "--GTestSubprocess"); | ||
136 | + g_ptr_array_add (argv, "-p"); | ||
137 | + g_ptr_array_add (argv, "/misc/skip"); | ||
138 | + g_ptr_array_add (argv, "-p"); | ||
139 | + g_ptr_array_add (argv, "/misc/skip-all/subprocess/skip1"); | ||
140 | + g_ptr_array_add (argv, "-p"); | ||
141 | + g_ptr_array_add (argv, "/misc/skip-all/subprocess/skip2"); | ||
142 | + g_ptr_array_add (argv, NULL); | ||
143 | + | ||
144 | + g_spawn_sync (NULL, (char **) argv->pdata, NULL, | ||
145 | + G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, | ||
146 | + NULL, NULL, NULL, NULL, &status, | ||
147 | + &error); | ||
148 | + g_assert_no_error (error); | ||
149 | + | ||
150 | + g_spawn_check_exit_status (status, &error); | ||
151 | + g_assert_error (error, G_SPAWN_EXIT_ERROR, 77); | ||
152 | + g_clear_error (&error); | ||
153 | + | ||
154 | + g_ptr_array_set_size (argv, 0); | ||
155 | + g_ptr_array_add (argv, (char *) argv0); | ||
156 | + g_ptr_array_add (argv, "--GTestSubprocess"); | ||
157 | + g_ptr_array_add (argv, "-p"); | ||
158 | + g_ptr_array_add (argv, "/misc/skip"); | ||
159 | + g_ptr_array_add (argv, "-p"); | ||
160 | + g_ptr_array_add (argv, "/misc/skip-all/subprocess/pass"); | ||
161 | + g_ptr_array_add (argv, "-p"); | ||
162 | + g_ptr_array_add (argv, "/misc/skip-all/subprocess/skip1"); | ||
163 | + g_ptr_array_add (argv, NULL); | ||
164 | + | ||
165 | + g_spawn_sync (NULL, (char **) argv->pdata, NULL, | ||
166 | + G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, | ||
167 | + NULL, NULL, NULL, NULL, &status, | ||
168 | + &error); | ||
169 | + g_assert_no_error (error); | ||
170 | + | ||
171 | + g_spawn_check_exit_status (status, &error); | ||
172 | + g_assert_no_error (error); | ||
173 | + | ||
174 | + g_ptr_array_unref (argv); | ||
175 | +} | ||
176 | + | ||
177 | int | ||
178 | main (int argc, | ||
179 | char *argv[]) | ||
180 | { | ||
181 | + argv0 = argv[0]; | ||
182 | + | ||
183 | g_test_init (&argc, &argv, NULL); | ||
184 | |||
185 | g_test_add_func ("/random-generator/rand-1", test_rand1); | ||
186 | @@ -633,5 +716,11 @@ main (int argc, | ||
187 | |||
188 | g_test_add_func ("/misc/nonfatal", test_nonfatal); | ||
189 | |||
190 | + g_test_add_func ("/misc/skip", test_skip); | ||
191 | + g_test_add_func ("/misc/skip-all", test_skip_all); | ||
192 | + g_test_add_func ("/misc/skip-all/subprocess/skip1", test_skip); | ||
193 | + g_test_add_func ("/misc/skip-all/subprocess/skip2", test_skip); | ||
194 | + g_test_add_func ("/misc/skip-all/subprocess/pass", test_pass); | ||
195 | + | ||
196 | return g_test_run(); | ||
197 | } | ||
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb index 9745a9e4af..161f7da358 100644 --- a/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb +++ b/meta/recipes-core/glib-2.0/glib-2.0_2.38.2.bb | |||
@@ -13,6 +13,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ | |||
13 | file://0001-gio-Fix-Werror-format-string-errors-from-mismatched-.patch \ | 13 | file://0001-gio-Fix-Werror-format-string-errors-from-mismatched-.patch \ |
14 | file://ptest-dbus.patch \ | 14 | file://ptest-dbus.patch \ |
15 | file://ptest-paths.patch \ | 15 | file://ptest-paths.patch \ |
16 | file://gtest-skip-fixes.patch \ | ||
16 | " | 17 | " |
17 | 18 | ||
18 | SRC_URI_append_class-native = " file://glib-gettextize-dir.patch" | 19 | SRC_URI_append_class-native = " file://glib-gettextize-dir.patch" |