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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
From e22e17704988b606e24e76160495626552d0845f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 21 Sep 2023 15:20:55 +0100
Subject: [PATCH] ruby: Get rid of old Test::Unit compatibility
See this commit in hivex:
https://github.com/libguestfs/hivex/commit/6dbbc474d3df5cdfd21ed5e692b3a58136fffc42
(cherry picked from commit ecf361d7237d38b2418ddecb1b70e3b722509c12)
---
ruby/Makefile.am | 3 +--
ruby/t/tc_010_load.rb | 3 ++-
ruby/t/tc_020_create.rb | 3 ++-
ruby/t/tc_030_create_flags.rb | 3 ++-
ruby/t/tc_040_create_multiple.rb | 3 ++-
ruby/t/tc_050_handle_properties.rb | 3 ++-
ruby/t/tc_060_explicit_close.rb | 3 ++-
ruby/t/tc_070_optargs.rb | 3 ++-
ruby/t/tc_090_retvalues.rb | 3 ++-
ruby/t/tc_100_launch.rb | 3 ++-
ruby/t/tc_410_close_event.rb | 3 ++-
ruby/t/tc_420_log_messages.rb | 3 ++-
ruby/t/tc_800_rhbz507346.rb | 3 ++-
ruby/t/tc_810_rhbz664558c6.rb | 3 ++-
ruby/t/tc_820_rhbz1046509.rb | 3 ++-
ruby/t/test_helper.rb | 33 ------------------------------
16 files changed, 29 insertions(+), 49 deletions(-)
delete mode 100644 ruby/t/test_helper.rb
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index c26513a7..867b05b1 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -40,8 +40,7 @@ EXTRA_DIST = \
lib/guestfs.rb \
run-bindtests \
run-ruby-tests \
- t/tc_*.rb \
- t/test_helper.rb
+ t/tc_*.rb
CLEANFILES += \
lib/*~ \
diff --git a/ruby/t/tc_010_load.rb b/ruby/t/tc_010_load.rb
index 40ddccd8..e7ec482e 100644
--- a/ruby/t/tc_010_load.rb
+++ b/ruby/t/tc_010_load.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test010Load < Minitest::Test
def test_010_load
diff --git a/ruby/t/tc_020_create.rb b/ruby/t/tc_020_create.rb
index c3f5307e..26bb2ecf 100644
--- a/ruby/t/tc_020_create.rb
+++ b/ruby/t/tc_020_create.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test020Create < Minitest::Test
def test_020_create
diff --git a/ruby/t/tc_030_create_flags.rb b/ruby/t/tc_030_create_flags.rb
index 4949d2a8..8006d962 100644
--- a/ruby/t/tc_030_create_flags.rb
+++ b/ruby/t/tc_030_create_flags.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test030CreateFlags < Minitest::Test
def test_030_create_flags
diff --git a/ruby/t/tc_040_create_multiple.rb b/ruby/t/tc_040_create_multiple.rb
index 623ccc6e..32b2b094 100644
--- a/ruby/t/tc_040_create_multiple.rb
+++ b/ruby/t/tc_040_create_multiple.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test040CreateMultiple < Minitest::Test
def test_040_create_multiple
diff --git a/ruby/t/tc_050_handle_properties.rb b/ruby/t/tc_050_handle_properties.rb
index b22c51fd..d37b1d03 100644
--- a/ruby/t/tc_050_handle_properties.rb
+++ b/ruby/t/tc_050_handle_properties.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test050HandleProperties < Minitest::Test
def test_050_handle_properties
diff --git a/ruby/t/tc_060_explicit_close.rb b/ruby/t/tc_060_explicit_close.rb
index 20afd0de..8d103616 100644
--- a/ruby/t/tc_060_explicit_close.rb
+++ b/ruby/t/tc_060_explicit_close.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test060ExplicitClose < Minitest::Test
def test_060_explicit_close
diff --git a/ruby/t/tc_070_optargs.rb b/ruby/t/tc_070_optargs.rb
index a2360b2f..c2298131 100644
--- a/ruby/t/tc_070_optargs.rb
+++ b/ruby/t/tc_070_optargs.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test070Optargs < Minitest::Test
def test_070_optargs
diff --git a/ruby/t/tc_090_retvalues.rb b/ruby/t/tc_090_retvalues.rb
index c9a84276..d7927465 100644
--- a/ruby/t/tc_090_retvalues.rb
+++ b/ruby/t/tc_090_retvalues.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test090RetValues < Minitest::Test
def test_090_retvalues
diff --git a/ruby/t/tc_100_launch.rb b/ruby/t/tc_100_launch.rb
index 096cbd62..c4da234e 100644
--- a/ruby/t/tc_100_launch.rb
+++ b/ruby/t/tc_100_launch.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test100Launch < Minitest::Test
def test_100_launch
diff --git a/ruby/t/tc_410_close_event.rb b/ruby/t/tc_410_close_event.rb
index 9a4e0558..84cc11ab 100644
--- a/ruby/t/tc_410_close_event.rb
+++ b/ruby/t/tc_410_close_event.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test410CloseEvent < Minitest::Test
def test_410_close_event
diff --git a/ruby/t/tc_420_log_messages.rb b/ruby/t/tc_420_log_messages.rb
index a113c62e..fd3049a0 100644
--- a/ruby/t/tc_420_log_messages.rb
+++ b/ruby/t/tc_420_log_messages.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test420LogMessages < Minitest::Test
def test_420_log_messages
diff --git a/ruby/t/tc_800_rhbz507346.rb b/ruby/t/tc_800_rhbz507346.rb
index 06767352..54f7734f 100644
--- a/ruby/t/tc_800_rhbz507346.rb
+++ b/ruby/t/tc_800_rhbz507346.rb
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test800RHBZ507346 < Minitest::Test
def test_800_rhbz507346
diff --git a/ruby/t/tc_810_rhbz664558c6.rb b/ruby/t/tc_810_rhbz664558c6.rb
index 1504c070..5ffa2265 100644
--- a/ruby/t/tc_810_rhbz664558c6.rb
+++ b/ruby/t/tc_810_rhbz664558c6.rb
@@ -19,7 +19,8 @@
# the interpreter to segfault. See:
# https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test810RHBZ664558C6 < Minitest::Test
def test_810_rhbz_664558c6
diff --git a/ruby/t/tc_820_rhbz1046509.rb b/ruby/t/tc_820_rhbz1046509.rb
index 0595293d..b2a6d80b 100644
--- a/ruby/t/tc_820_rhbz1046509.rb
+++ b/ruby/t/tc_820_rhbz1046509.rb
@@ -18,7 +18,8 @@
# Test that we don't break the old ::create module function while
# fixing https://bugzilla.redhat.com/show_bug.cgi?id=1046509
-require File::join(File::dirname(__FILE__), 'test_helper')
+require 'minitest/autorun'
+require 'guestfs'
class Test820RHBZ1046509 < Minitest::Test
def _handleok(g)
diff --git a/ruby/t/test_helper.rb b/ruby/t/test_helper.rb
deleted file mode 100644
index 54f857ce..00000000
--- a/ruby/t/test_helper.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# libguestfs Ruby bindings -*- ruby -*-
-# Copyright (C) 2009-2023 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-begin
- require 'minitest/autorun'
-rescue LoadError
- require 'test/unit'
- MiniTest = Test
- module Test
- Assertions = Unit::Assertions
- module Assertions
- alias refute_nil assert_not_nil
- end
- end
-end
-
-$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
-$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
-require 'guestfs'
|