File: testfilemonitor-Skip-if-we-are-avoiding-flaky-tests.patch

package info (click to toggle)
glib2.0 2.84.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 66,112 kB
  • sloc: ansic: 538,924; python: 9,661; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (117 lines) | stat: -rw-r--r-- 3,103 bytes parent folder | download | duplicates (5)
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
From: Simon McVittie <smcv@debian.org>
Date: Tue, 25 Feb 2020 10:45:07 +0000
Subject: testfilemonitor: Skip if we are avoiding flaky tests

See https://gitlab.gnome.org/GNOME/glib/issues/1634

Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: no
---
 gio/tests/testfilemonitor.c | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/gio/tests/testfilemonitor.c b/gio/tests/testfilemonitor.c
index 018e49f..e83d8ff 100644
--- a/gio/tests/testfilemonitor.c
+++ b/gio/tests/testfilemonitor.c
@@ -32,6 +32,12 @@ setup (Fixture       *fixture,
   gchar *path = NULL;
   GError *local_error = NULL;
 
+  if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+    {
+      g_test_skip ("https://gitlab.gnome.org/GNOME/glib/issues/1634");
+      return;
+    }
+
   path = g_dir_make_tmp ("gio-test-testfilemonitor_XXXXXX", &local_error);
   g_assert_no_error (local_error);
 
@@ -48,7 +54,9 @@ teardown (Fixture       *fixture,
 {
   GError *local_error = NULL;
 
-  g_file_delete (fixture->tmp_dir, NULL, &local_error);
+  if (fixture->tmp_dir != NULL)
+    g_file_delete (fixture->tmp_dir, NULL, &local_error);
+
   g_assert_no_error (local_error);
   g_clear_object (&fixture->tmp_dir);
 }
@@ -379,6 +387,10 @@ test_atomic_replace (Fixture       *fixture,
   if (skip_win32 ())
     return;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+    return;
+
   data.step = 0;
   data.events = NULL;
 
@@ -487,6 +499,10 @@ test_file_changes (Fixture       *fixture,
   if (skip_win32 ())
     return;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+    return;
+
   data.step = 0;
   data.events = NULL;
 
@@ -607,6 +623,10 @@ test_dir_monitor (Fixture       *fixture,
   if (skip_win32 ())
     return;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+    return;
+
   data.step = 0;
   data.events = NULL;
 
@@ -707,6 +727,10 @@ test_dir_non_existent (Fixture       *fixture,
   if (skip_win32 ())
     return;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+    return;
+
   data.step = 0;
   data.events = NULL;
 
@@ -819,6 +843,10 @@ test_cross_dir_moves (Fixture       *fixture,
   if (skip_win32 ())
     return;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+    return;
+
   data[0].step = 0;
   data[0].events = NULL;
 
@@ -988,6 +1016,10 @@ test_file_hard_links (Fixture       *fixture,
   GError *error = NULL;
   TestData data;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+    return;
+
   g_test_bug ("https://bugzilla.gnome.org/show_bug.cgi?id=755721");
 
   if (skip_win32 ())
@@ -1047,6 +1079,10 @@ test_finalize_in_callback (Fixture       *fixture,
   GFile *file = NULL;
   guint i;
 
+  /* respect g_test_skip() during setup() */
+  if (g_test_failed ())
+     return;
+
   g_test_summary ("Test that finalization of a GFileMonitor in one of its "
                   "callbacks doesn’t cause a deadlock.");
   g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/1941");