Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-ruby-libvirt for openSUSE:Factory checked in at 2022-09-17 20:10:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-ruby-libvirt (Old) and /work/SRC/openSUSE:Factory/.rubygem-ruby-libvirt.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-ruby-libvirt" Sat Sep 17 20:10:35 2022 rev:6 rq:1004130 version:0.8.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-ruby-libvirt/rubygem-ruby-libvirt.changes 2022-01-13 23:21:36.260053877 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-ruby-libvirt.new.2083/rubygem-ruby-libvirt.changes 2022-09-17 20:10:46.877233247 +0200 @@ -1,0 +2,13 @@ +Fri Sep 16 13:19:13 UTC 2022 - Dan ??erm??k <dcer...@suse.com> + +- New upstream release 0.8.0 + * Fix default values for node_cpu_stats and node_memory_stats + * Fix cpumap allocation for virDomainGetVcpus + * Enforce UTF8 for strings and exceptions + * Drop local have_const + * Use sensible default for libvirt_domain_qemu_agent_command + +- Drop 0001-Fix-include-of-st.h-to-ruby-st.h.patch, + https://gitlab.com/libvirt/libvirt-ruby/-/merge_requests/7 was merged upstream + +------------------------------------------------------------------- Old: ---- 0001-Fix-include-of-st.h-to-ruby-st.h.patch ruby-libvirt-0.7.1.gem New: ---- ruby-libvirt-0.8.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-ruby-libvirt.spec ++++++ --- /var/tmp/diff_new_pack.aB3pnz/_old 2022-09-17 20:10:47.321234528 +0200 +++ /var/tmp/diff_new_pack.aB3pnz/_new 2022-09-17 20:10:47.325234540 +0200 @@ -25,7 +25,7 @@ # of those fields # Name: rubygem-ruby-libvirt -Version: 0.7.1 +Version: 0.8.0 Release: 0 Summary: Ruby bindings for LIBVIRT License: LGPL-2.1-or-later @@ -41,18 +41,11 @@ BuildRequires: libvirt-devel BuildRequires: pkgconfig # /MANUAL -# MANUAL -Patch0: 0001-Fix-include-of-st.h-to-ruby-st.h.patch -# /MANUAL %description Ruby bindings for libvirt. %prep -%gem_unpack -%patch0 -p1 -find -type f -print0 | xargs -0 touch -r %{SOURCE0} -%{gem_build} %build ++++++ gem2rpm.yml ++++++ --- /var/tmp/diff_new_pack.aB3pnz/_old 2022-09-17 20:10:47.365234655 +0200 +++ /var/tmp/diff_new_pack.aB3pnz/_new 2022-09-17 20:10:47.369234667 +0200 @@ -21,8 +21,8 @@ # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm - :patches: - 0001-Fix-include-of-st.h-to-ruby-st.h.patch: -p1 +# :patches: +# 0001-Fix-include-of-st.h-to-ruby-st.h.patch: -p1 # bar.patch: # ## used by gem2rpm :sources: ++++++ ruby-libvirt-0.7.1.gem -> ruby-libvirt-0.8.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/NEWS new/NEWS --- old/NEWS 2018-02-18 14:18:03.000000000 +0100 +++ new/NEWS 2021-11-16 01:05:04.000000000 +0100 @@ -1,3 +1,10 @@ +2021-11-15 0.8.0 + * Fix default values for node_cpu_stats and node_memory_stats + * Fix cpumap allocation for virDomainGetVcpus + * Enforce UTF8 for strings and exceptions + * Drop local have_const + * Use sensible default for libvirt_domain_qemu_agent_command + 2018-02-18 0.7.1 * Fix a bad bug in block_resize (Marius Rieder) * Fix up some problems pointed out by clang diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2018-02-18 14:18:03.000000000 +0100 +++ new/Rakefile 2021-11-16 01:05:04.000000000 +0100 @@ -21,7 +21,7 @@ require 'rbconfig' PKG_NAME='ruby-libvirt' -PKG_VERSION='0.7.1' +PKG_VERSION='0.8.0' EXT_CONF='ext/libvirt/extconf.rb' MAKEFILE="ext/libvirt/Makefile" @@ -145,7 +145,7 @@ s.author = "David Lutterkort, Chris Lalancette" s.rubyforge_project = "None" s.description = "Ruby bindings for libvirt." - s.license = "LGPLv2" + s.license = "LGPL-2.1-or-later" end Gem::PackageTask.new(SPEC) do |pkg| Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/libvirt/common.c new/ext/libvirt/common.c --- old/ext/libvirt/common.c 2018-02-18 14:18:03.000000000 +0100 +++ new/ext/libvirt/common.c 2021-11-16 01:05:04.000000000 +0100 @@ -24,7 +24,8 @@ #endif #include <stdio.h> #include <ruby.h> -#include <st.h> +#include <ruby/encoding.h> +#include <ruby/st.h> #include <libvirt/libvirt.h> #include <libvirt/virterror.h> #include "common.h" @@ -38,8 +39,9 @@ static VALUE ruby_libvirt_exc_new2_wrap(VALUE arg) { struct rb_exc_new2_arg *e = (struct rb_exc_new2_arg *)arg; + VALUE ruby_msg = ruby_libvirt_str_new2_wrap((VALUE)&e->msg); - return rb_exc_new2(e->error, e->msg); + return rb_exc_new3(e->error, ruby_msg); } VALUE ruby_libvirt_ary_new2_wrap(VALUE arg) @@ -66,8 +68,11 @@ VALUE ruby_libvirt_str_new2_wrap(VALUE arg) { char **str = (char **)arg; + VALUE ruby_msg = rb_str_new2(*str); + int enc = rb_enc_find_index("UTF-8"); - return rb_str_new2(*str); + rb_enc_associate_index(ruby_msg, enc); + return ruby_msg; } VALUE ruby_libvirt_str_new_wrap(VALUE arg) @@ -144,7 +149,7 @@ rb_iv_set(ruby_errinfo, "@libvirt_level", INT2NUM(err->level)); if (err->message != NULL) { rb_iv_set(ruby_errinfo, "@libvirt_message", - rb_str_new2(err->message)); + ruby_libvirt_str_new2_wrap((VALUE)&err->message)); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/libvirt/common.h new/ext/libvirt/common.h --- old/ext/libvirt/common.h 2018-02-18 14:18:03.000000000 +0100 +++ new/ext/libvirt/common.h 2021-11-16 01:05:04.000000000 +0100 @@ -56,7 +56,7 @@ } \ } \ else { \ - result = rb_str_new2(str); \ + result = ruby_libvirt_str_new2_wrap((VALUE)&str); \ } \ return result; \ } while(0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/libvirt/connect.c new/ext/libvirt/connect.c --- old/ext/libvirt/connect.c 2018-02-18 14:18:03.000000000 +0100 +++ new/ext/libvirt/connect.c 2021-11-16 01:05:04.000000000 +0100 @@ -2079,7 +2079,12 @@ rb_scan_args(argc, argv, "02", &intparam, &flags); - tmp = ruby_libvirt_value_to_int(intparam); + if (NIL_P(intparam)) { + tmp = -1; + } + else { + tmp = ruby_libvirt_value_to_int(intparam); + } return ruby_libvirt_get_parameters(c, ruby_libvirt_value_to_uint(flags), (void *)&tmp, sizeof(virNodeCPUStats), @@ -2139,7 +2144,12 @@ rb_scan_args(argc, argv, "02", &intparam, &flags); - tmp = ruby_libvirt_value_to_int(intparam); + if (NIL_P(intparam)) { + tmp = -1; + } + else { + tmp = ruby_libvirt_value_to_int(intparam); + } return ruby_libvirt_get_parameters(c, ruby_libvirt_value_to_uint(flags), (void *)&tmp, sizeof(virNodeMemoryStats), @@ -2280,9 +2290,7 @@ {VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED, VIR_TYPED_PARAM_ULLONG}, {VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE, VIR_TYPED_PARAM_ULLONG}, {VIR_NODE_MEMORY_SHARED_FULL_SCANS, VIR_TYPED_PARAM_ULLONG}, -#if HAVE_CONST_VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES {VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, VIR_TYPED_PARAM_UINT}, -#endif }; /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/libvirt/domain.c new/ext/libvirt/domain.c --- old/ext/libvirt/domain.c 2018-02-18 14:18:03.000000000 +0100 +++ new/ext/libvirt/domain.c 2021-11-16 01:05:04.000000000 +0100 @@ -23,7 +23,7 @@ #include <unistd.h> #include <ruby.h> /* we need to include st.h since ruby 1.8 needs it for RHash */ -#include <st.h> +#include <ruby/st.h> #include <libvirt/libvirt.h> #if HAVE_VIRDOMAINQEMUMONITORCOMMAND #include <libvirt/libvirt-qemu.h> @@ -803,7 +803,7 @@ cpumaplen = VIR_CPU_MAPLEN(maxcpus); - cpumap = alloca(sizeof(unsigned char) * cpumaplen); + cpumap = alloca(sizeof(unsigned char) * cpumaplen * dominfo.nrVirtCpu); r = virDomainGetVcpus(ruby_libvirt_domain_get(d), cpuinfo, dominfo.nrVirtCpu, cpumap, cpumaplen); @@ -832,15 +832,16 @@ result = rb_ary_new(); - for (i = 0; i < dominfo.nrVirtCpu; i++) { + for (i = 0; i < r; i++) { vcpuinfo = rb_class_new_instance(0, NULL, c_domain_vcpuinfo); - rb_iv_set(vcpuinfo, "@number", UINT2NUM(i)); if (cpuinfo != NULL) { + rb_iv_set(vcpuinfo, "@number", INT2NUM(cpuinfo[i].number)); rb_iv_set(vcpuinfo, "@state", INT2NUM(cpuinfo[i].state)); rb_iv_set(vcpuinfo, "@cpu_time", ULL2NUM(cpuinfo[i].cpuTime)); rb_iv_set(vcpuinfo, "@cpu", INT2NUM(cpuinfo[i].cpu)); } else { + rb_iv_set(vcpuinfo, "@number", Qnil); rb_iv_set(vcpuinfo, "@state", Qnil); rb_iv_set(vcpuinfo, "@cpu_time", Qnil); rb_iv_set(vcpuinfo, "@cpu", Qnil); @@ -1948,12 +1949,8 @@ {VIR_DOMAIN_SCHEDULER_CPU_SHARES, VIR_TYPED_PARAM_ULLONG}, {VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, VIR_TYPED_PARAM_ULLONG}, {VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_TYPED_PARAM_LLONG}, -#if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD {VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, VIR_TYPED_PARAM_ULLONG}, -#endif -#if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA {VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, VIR_TYPED_PARAM_LLONG}, -#endif {VIR_DOMAIN_SCHEDULER_WEIGHT, VIR_TYPED_PARAM_UINT}, {VIR_DOMAIN_SCHEDULER_CAP, VIR_TYPED_PARAM_UINT}, {VIR_DOMAIN_SCHEDULER_RESERVATION, VIR_TYPED_PARAM_LLONG}, @@ -3262,9 +3259,7 @@ {VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, VIR_TYPED_PARAM_ULLONG}, {VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, VIR_TYPED_PARAM_ULLONG}, {VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG}, -#if HAVE_CONST_VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC {VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG}, -#endif }; /* @@ -3775,6 +3770,10 @@ rb_scan_args(argc, argv, "12", &command, &timeout, &flags); + if (NIL_P(timeout)) { + timeout = INT2NUM(VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT); + } + ret = virDomainQemuAgentCommand(ruby_libvirt_domain_get(d), StringValueCStr(command), ruby_libvirt_value_to_int(timeout), @@ -3866,16 +3865,14 @@ {VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING}, {VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG}, {VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING}, -#if HAVE_CONST_VIR_MIGRATE_PARAM_LISTEN_ADDRESS {VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING}, -#endif }; /* * call-seq: * dom.migrate3(dconn, Hash=nil, flags=0) -> Libvirt::Domain * - * Call virDomainMigrate3[http://www.libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate2] + * Call virDomainMigrate3[http://www.libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate3] * to migrate a domain from the host on this connection to the connection * referenced in dconn. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/libvirt/extconf.h new/ext/libvirt/extconf.h --- old/ext/libvirt/extconf.h 2018-02-18 14:18:03.000000000 +0100 +++ new/ext/libvirt/extconf.h 2021-11-16 01:05:04.000000000 +0100 @@ -381,6 +381,7 @@ #define HAVE_VIRDOMAINQEMUMONITORCOMMAND 1 #define HAVE_VIRDOMAINQEMUATTACH 1 #define HAVE_VIRDOMAINQEMUAGENTCOMMAND 1 +#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN 1 #define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK 1 #define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT 1 #define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/libvirt/extconf.rb new/ext/libvirt/extconf.rb --- old/ext/libvirt/extconf.rb 2018-02-18 14:18:03.000000000 +0100 +++ new/ext/libvirt/extconf.rb 2021-11-16 01:05:04.000000000 +0100 @@ -4,38 +4,6 @@ RbConfig::MAKEFILE_CONFIG['CCDLFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS'] RbConfig::MAKEFILE_CONFIG['EXTDLDFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS'] -# older mkmf does not have checking_message, so implement our own here -def libvirt_checking_message(target, place = nil, opt = nil) - [["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)| - if noun - [[:to_str], [:join, ","], [:to_s]].each do |meth, *args| - if noun.respond_to?(meth) - break noun = noun.send(meth, *args) - end - end - msg << " #{pre} #{noun}" unless noun.empty? - end - msg - end -end - -def have_const(const, headers = nil, opt = "", &b) - checking_for libvirt_checking_message(const, headers, opt) do - headers = cpp_include(headers) - if try_compile(<<"SRC", opt, &b) -#{COMMON_HEADERS} -#{headers} -/*top*/ -static int t = #{const}; -SRC - $defs.push(format("-DHAVE_CONST_%s", const.strip.upcase.tr_s("^A-Z0-9_", "_"))) - true - else - false - end - end -end - extension_name = '_libvirt' # this is a poor-man's dir_config, but is a bit more flexible. In particular, @@ -58,22 +26,23 @@ include = with_config("libvirt-include") lib = with_config("libvirt-lib") if include and lib + print "Looking for libvirt in " + include + " and " + lib + "\n" $LIBPATH = [lib] | $LIBPATH $CPPFLAGS += " -I" + include - have_library("virt", "virConnectOpen", "libvirt/libvirt.h") - - # if we are using custom libvirt libraries, we have to suppress the default - # library path so have_func() only picks up the custom ones, not the installed - # ones - $DEFLIBPATH = [] elsif (include and not lib) or (not include and lib) raise "Must specify both --with-libvirt-include and --with-libvirt-lib, or neither" else + print "Looking for libvirt using pkg-config\n" unless pkg_config("libvirt") raise "libvirt library not found in default locations" end end +# Quick sanity check: if we can't find the virConnectOpen() function, +# there's no way anything will work and we might as well give up now +unless have_library("virt", "virConnectOpen", "libvirt/libvirt.h") + raise "No working libvirt installation found" +end libvirt_types = [ 'virNetworkPtr', 'virStoragePoolPtr', @@ -409,11 +378,7 @@ 'VIR_DOMAIN_BLOCK_JOB_FAILED', 'VIR_DOMAIN_BLOCK_JOB_CANCELED', 'VIR_DOMAIN_BLOCK_JOB_READY', - 'VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES', 'VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC', - 'VIR_MIGRATE_PARAM_LISTEN_ADDRESS', - 'VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD', - 'VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA', 'VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT', 'VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE', 'VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC', @@ -430,14 +395,12 @@ 'VIR_DOMAIN_BLOCK_COMMIT_ACTIVE', 'VIR_DOMAIN_BLOCK_COMMIT_RELATIVE', 'VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES', - 'VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC', 'VIR_STORAGE_POOL_CREATE_NORMAL', 'VIR_STORAGE_POOL_CREATE_WITH_BUILD', 'VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE', 'VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE', 'VIR_STORAGE_VOL_CREATE_REFLINK', 'VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS', - 'VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN', 'VIR_DOMAIN_DEFINE_VALIDATE', 'VIR_DOMAIN_PASSWORD_ENCRYPTED', 'VIR_DOMAIN_TIME_SYNC', @@ -480,6 +443,7 @@ ] libvirt_qemu_consts = [ + 'VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN', 'VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK', 'VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT', 'VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT', @@ -492,13 +456,13 @@ libvirt_consts.each { |c| have_const(c, ["libvirt/libvirt.h"]) } virterror_consts.each { |c| have_const(c, ["libvirt/virterror.h"]) } if find_header("libvirt/libvirt-qemu.h") - have_library("virt-qemu", "virDomainQemuMonitorCommand") + have_library("virt-qemu", "virDomainQemuMonitorCommand", "libvirt/libvirt-qemu.h") libvirt_qemu_funcs.each { |f| have_func(f, "libvirt/libvirt-qemu.h") } libvirt_qemu_consts.each { |c| have_const(c, ["libvirt/libvirt-qemu.h"]) } end if find_header("libvirt/libvirt-lxc.h") - have_library("virt-lxc", "virDomainLxcOpenNamespace") + have_library("virt-lxc", "virDomainLxcOpenNamespace", "libvirt/libvirt-lxc.h") libvirt_lxc_funcs.each{ |f| have_func(f, "libvirt/libvirt-lxc.h") } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-02-18 14:18:03.000000000 +0100 +++ new/metadata 2021-11-16 01:05:04.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: ruby-libvirt version: !ruby/object:Gem::Version - version: 0.7.1 + version: 0.8.0 platform: ruby authors: - David Lutterkort, Chris Lalancette -autorequire: +autorequire: bindir: bin cert_chain: [] -date: 2018-02-18 00:00:00.000000000 Z +date: 2021-11-16 00:00:00.000000000 Z dependencies: [] description: Ruby bindings for libvirt. email: libvir-l...@redhat.com @@ -59,9 +59,9 @@ - tests/test_utils.rb homepage: http://libvirt.org/ruby/ licenses: -- LGPLv2 +- LGPL-2.1-or-later metadata: {} -post_install_message: +post_install_message: rdoc_options: [] require_paths: - lib @@ -76,9 +76,8 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubyforge_project: None -rubygems_version: 2.6.14 -signing_key: +rubygems_version: 3.2.22 +signing_key: specification_version: 4 summary: Ruby bindings for LIBVIRT test_files: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tests/test_domain.rb new/tests/test_domain.rb --- old/tests/test_domain.rb 2018-02-18 14:18:03.000000000 +0100 +++ new/tests/test_domain.rb 2021-11-16 01:05:04.000000000 +0100 @@ -606,6 +606,7 @@ expect_too_many_args(newdom, "name", 1) expect_success(newdom, "no args", "name") {|x| x == "rb-libvirt-test"} +expect_success(newdom, "is UTF-8", "name") {|x| x.encoding.name == "UTF-8"} newdom.destroy @@ -909,6 +910,7 @@ expect_too_few_args(newdom, "lookup_snapshot_by_name") expect_invalid_arg_type(newdom, "lookup_snapshot_by_name", 1) expect_invalid_arg_type(newdom, "lookup_snapshot_by_name", 'foo', 'bar') +expect_utf8_exception_msg(newdom, Libvirt::RetrieveError, "lookup_snapshot_by_name", "__non_existing_snapshot") expect_success(newdom, "name arg", "lookup_snapshot_by_name", "foo") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tests/test_utils.rb new/tests/test_utils.rb --- old/tests/test_utils.rb 2018-02-18 14:18:03.000000000 +0100 +++ new/tests/test_utils.rb 2021-11-16 01:05:04.000000000 +0100 @@ -166,6 +166,24 @@ end end +def expect_utf8_exception_msg(object, errtype, func, *args) + begin + object.__send__(func, *args) + rescue NoMethodError + puts_skipped "#{$test_object}.#{func} does not exist" + rescue errtype => e + if e.message.encoding.name == 'UTF-8' + puts_ok "#{$test_object}.#{func} threw #{errtype.to_s} with UTF-8 encoding" + else + puts_fail "#{$test_object}.#{func} threw #{errtype.to_s} with #{e.message.encoding.name} encoding" + end + rescue => e + puts_fail "#{$test_object}.#{func} expected to throw #{errtype.to_s}, but instead threw #{e.class.to_s}: #{e.to_s}" + else + puts_fail "#{$test_object}.#{func} expected to throw #{errtype.to_s}, but threw nothing" + end +end + def expect_too_many_args(object, func, *args) expect_fail(object, ArgumentError, "too many args", func, *args) end