From fbe7e96cee460e26a0ff6a9c293c155a78bfdfde Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" 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'