Codebase list realmd / 013e0a7
Fix FTBFS with glib 2.62 (patch from upstream) Closes: #940159 Laurent Bigonville 4 years ago
2 changed file(s) with 253 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From 5ae42c176e7bb550fc6cf10f29e75f58c733ae4f Mon Sep 17 00:00:00 2001
1 From: Sumit Bose <sbose@redhat.com>
2 Date: Fri, 2 Aug 2019 12:10:43 +0200
3 Subject: [PATCH] Remove support for deprecated gtester format
4
5 Support for the already deprecated gtester format was remove from recent
6 versions of glib2 but the test still call the tab-gtester conversion
7 tool.
8
9 This patch removes tab-gtester and the tab format is used directly.
10
11 Related to https://gitlab.freedesktop.org/realmd/realmd/issues/21
12 ---
13 Makefile.am | 3 +-
14 build/tap-gtester | 204 ----------------------------------------------
15 2 files changed, 1 insertion(+), 206 deletions(-)
16 delete mode 100755 build/tap-gtester
17
18 diff --git a/Makefile.am b/Makefile.am
19 index 27e3494..4ffd5b4 100644
20 --- a/Makefile.am
21 +++ b/Makefile.am
22 @@ -161,7 +161,7 @@ endif
23 #
24
25 LOG_DRIVER = $(top_srcdir)/build/tap-driver
26 -LOG_COMPILER = $(top_srcdir)/build/tap-gtester
27 +LOG_COMPILER = sh -c '"$$0" "$$@" --tap'
28
29 VALGRIND_ARGS = --trace-children=no --quiet --error-exitcode=33 \
30 --suppressions=valgrind-suppressions --gen-suppressions=all \
31 @@ -183,7 +183,6 @@ recheck-memory: valgrind-suppressions
32
33 EXTRA_DIST += \
34 $(LOG_DRIVER) \
35 - $(LOG_COMPILER) \
36 $(VALGRIND_SUPPRESSIONS) \
37 $(NULL)
38
39 diff --git a/build/tap-gtester b/build/tap-gtester
40 deleted file mode 100755
41 index bbda266..0000000
42 --- a/build/tap-gtester
43 +++ /dev/null
44 @@ -1,204 +0,0 @@
45 -#!/usr/bin/python3
46 -# This can also be run with Python 2.
47 -
48 -# Copyright (C) 2014 Red Hat, Inc.
49 -#
50 -# Cockpit is free software; you can redistribute it and/or modify it
51 -# under the terms of the GNU Lesser General Public License as published by
52 -# the Free Software Foundation; either version 2.1 of the License, or
53 -# (at your option) any later version.
54 -#
55 -# Cockpit is distributed in the hope that it will be useful, but
56 -# WITHOUT ANY WARRANTY; without even the implied warranty of
57 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58 -# Lesser General Public License for more details.
59 -#
60 -# You should have received a copy of the GNU Lesser General Public License
61 -# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
62 -
63 -#
64 -# This is a test output compiler which produces TAP from GTest output
65 -# if GTest output is detected.
66 -#
67 -# Versions of glib later than 2.38.x output TAP natively when tests are
68 -# run with the --tap option. However we can't depend on such a recent
69 -# version of glib for our purposes.
70 -#
71 -# This implements the Test Anything Protocol (ie: TAP)
72 -# https://metacpan.org/pod/release/PETDANCE/Test-Harness-2.64/lib/Test/Harness/TAP.pod
73 -#
74 -
75 -import argparse
76 -import os
77 -import select
78 -import signal
79 -import subprocess
80 -import sys
81 -
82 -# Yes, it's dumb, but strsignal is not exposed in python
83 -# In addition signal numbers varify heavily from arch to arch
84 -def strsignal(sig):
85 - for name in dir(signal):
86 - if name.startswith("SIG") and sig == getattr(signal, name):
87 - return name
88 - return str(sig)
89 -
90 -
91 -class NullCompiler:
92 - def __init__(self, command):
93 - self.command = command
94 -
95 - def input(self, line):
96 - sys.stdout.write(line)
97 -
98 - def process(self, proc):
99 - while True:
100 - line = proc.stdout.readline()
101 - if not line:
102 - break
103 - self.input(line)
104 - proc.wait()
105 - return proc.returncode
106 -
107 - def run(self, proc, line=None):
108 - if line:
109 - self.input(line)
110 - return self.process(proc)
111 -
112 -
113 -class GTestCompiler(NullCompiler):
114 - def __init__(self, filename):
115 - NullCompiler.__init__(self, filename)
116 - self.test_num = 0
117 - self.test_name = None
118 - self.test_remaining = []
119 -
120 - def input(self, line):
121 - line = line.strip()
122 - if line.startswith("GTest: "):
123 - (cmd, unused, data) = line[7:].partition(": ")
124 - cmd = cmd.strip()
125 - data = data.strip()
126 - if cmd == "run":
127 - self.test_name = data
128 - assert self.test_name in self.test_remaining, "%s %s" % (self.test_name, repr(self.test_remaining))
129 - self.test_remaining.remove(self.test_name)
130 - self.test_num += 1
131 - elif cmd == "result":
132 - if self.test_name:
133 - if data == "OK":
134 - print("ok %d %s" % (self.test_num, self.test_name))
135 - if data == "FAIL":
136 - print("not ok %d %s" % (self.test_num, self.test_name))
137 - self.test_name = None
138 - elif cmd == "skipping":
139 - if "/subprocess" not in data:
140 - print("ok %d # skip -- %s" % (self.test_num, data))
141 - self.test_name = None
142 - elif data:
143 - print("# %s: %s" % (cmd, data))
144 - else:
145 - print("# %s" % cmd)
146 - elif line.startswith("(MSG: "):
147 - print("# %s" % line[6:-1])
148 - elif line:
149 - print("# %s" % line)
150 - sys.stdout.flush()
151 -
152 - def run(self, proc, output=""):
153 - # Complete retrieval of the list of tests
154 - output += proc.stdout.read()
155 - proc.wait()
156 - if proc.returncode:
157 - sys.stderr.write("tap-gtester: listing GTest tests failed: %d\n" % proc.returncode)
158 - return proc.returncode
159 - self.test_remaining = []
160 - for line in output.split("\n"):
161 - if line.startswith("/"):
162 - self.test_remaining.append(line.strip())
163 - if not self.test_remaining:
164 - print("Bail out! No tests found in GTest: %s" % self.command[0])
165 - return 0
166 -
167 - print("1..%d" % len(self.test_remaining))
168 -
169 - # First try to run all the tests in a batch
170 - proc = subprocess.Popen(self.command + ["--verbose" ], close_fds=True,
171 - stdout=subprocess.PIPE, universal_newlines=True)
172 - result = self.process(proc)
173 - if result == 0:
174 - return 0
175 -
176 - if result < 0:
177 - sys.stderr.write("%s terminated with %s\n" % (self.command[0], strsignal(-result)))
178 -
179 - # Now pick up any stragglers due to failures
180 - while True:
181 - # Assume that the last test failed
182 - if self.test_name:
183 - print("not ok %d %s" % (self.test_num, self.test_name))
184 - self.test_name = None
185 -
186 - # Run any tests which didn't get run
187 - if not self.test_remaining:
188 - break
189 -
190 - proc = subprocess.Popen(self.command + ["--verbose", "-p", self.test_remaining[0]],
191 - close_fds=True, stdout=subprocess.PIPE,
192 - universal_newlines=True)
193 - result = self.process(proc)
194 -
195 - # The various exit codes and signals we continue for
196 - if result not in [ 0, 1, -4, -5, -6, -7, -8, -11, 33 ]:
197 - break
198 -
199 - return result
200 -
201 -def main(argv):
202 - parser = argparse.ArgumentParser(description='Automake TAP compiler',
203 - usage="tap-gtester [--format FORMAT] command ...")
204 - parser.add_argument('--format', metavar='FORMAT', choices=[ "auto", "gtest", "tap" ],
205 - default="auto", help='The input format to compile')
206 - parser.add_argument('--verbose', action='store_true',
207 - default=True, help='Verbose mode (ignored)')
208 - parser.add_argument('command', nargs=argparse.REMAINDER, help="A test command to run")
209 - args = parser.parse_args(argv[1:])
210 -
211 - output = None
212 - format = args.format
213 - cmd = args.command
214 - if not cmd:
215 - sys.stderr.write("tap-gtester: specify a command to run\n")
216 - return 2
217 - if cmd[0] == '--':
218 - cmd.pop(0)
219 -
220 - proc = None
221 -
222 - os.environ['HARNESS_ACTIVE'] = '1'
223 -
224 - if format in ["auto", "gtest"]:
225 - list_cmd = cmd + ["-l", "--verbose"]
226 - proc = subprocess.Popen(list_cmd, close_fds=True, stdout=subprocess.PIPE,
227 - universal_newlines=True)
228 - output = proc.stdout.readline()
229 - # Smell whether we're dealing with GTest list output from first line
230 - if "random seed" in output or "GTest" in output or output.startswith("/"):
231 - format = "gtest"
232 - else:
233 - format = "tap"
234 - else:
235 - proc = subprocess.Popen(cmd, close_fds=True, stdout=subprocess.PIPE,
236 - universal_newlines=True)
237 -
238 - if format == "gtest":
239 - compiler = GTestCompiler(cmd)
240 - elif format == "tap":
241 - compiler = NullCompiler(cmd)
242 - else:
243 - assert False, "not reached"
244 -
245 - return compiler.run(proc, output)
246 -
247 -if __name__ == "__main__":
248 - sys.exit(main(sys.argv))
249 --
250 2.22.0
251
11 02_cross.patch
22 tests-use-python3.patch
33 tests-ignore-order.patch
4 remove-support-for-deprecated-gtester-format.patch