Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package barrel for openSUSE:Factory checked in at 2021-12-22 20:18:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/barrel (Old) and /work/SRC/openSUSE:Factory/.barrel.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "barrel" Wed Dec 22 20:18:09 2021 rev:3 rq:942066 version:0.0.8 Changes: -------- --- /work/SRC/openSUSE:Factory/barrel/barrel.changes 2021-11-23 22:13:02.418387808 +0100 +++ /work/SRC/openSUSE:Factory/.barrel.new.2520/barrel.changes 2021-12-22 20:19:12.663879236 +0100 @@ -1,0 +2,6 @@ +Thu Dec 02 10:28:02 CET 2021 - aschn...@suse.com + +- handle multipath and DM RAID during loading of devicegraph +- version 0.0.8 + +------------------------------------------------------------------- Old: ---- barrel-0.0.7.tar.xz New: ---- barrel-0.0.8.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ barrel.spec ++++++ --- /var/tmp/diff_new_pack.M42w4s/_old 2021-12-22 20:19:13.123879452 +0100 +++ /var/tmp/diff_new_pack.M42w4s/_new 2021-12-22 20:19:13.127879453 +0100 @@ -1,7 +1,7 @@ # # spec file for package barrel # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2021 SUSE LLC, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,37 +12,36 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # - Name: barrel -Version: 0.0.7 +Version: 0.0.8 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: barrel-%{version}.tar.xz %if 0%{?fedora_version} BuildRequires: boost-devel -BuildRequires: docbook-style-xsl BuildRequires: json-c-devel +BuildRequires: docbook-style-xsl %else -BuildRequires: docbook-xsl-stylesheets BuildRequires: libboost_headers-devel BuildRequires: libboost_test-devel BuildRequires: libjson-c-devel +BuildRequires: docbook-xsl-stylesheets %endif BuildRequires: fdupes -BuildRequires: libstorage-ng-devel >= 4.4.57 +BuildRequires: libstorage-ng-devel >= 4.4.59 BuildRequires: libtool BuildRequires: libxslt BuildRequires: readline-devel -Requires: libstorage-ng1 >= 4.4.57 +Requires: libstorage-ng1 >= 4.4.59 Recommends: %{name}-lang Summary: Tool for storage management -URL: http://github.com/aschnell/barrel +Url: http://github.com/aschnell/barrel License: GPL-2.0-only Group: System/Packages ++++++ barrel-0.0.7.tar.xz -> barrel-0.0.8.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/VERSION new/barrel-0.0.8/VERSION --- old/barrel-0.0.7/VERSION 2021-11-23 08:13:52.000000000 +0100 +++ new/barrel-0.0.8/VERSION 2021-12-02 10:25:36.000000000 +0100 @@ -1 +1 @@ -0.0.7 +0.0.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/barrel/Utils/Args.h new/barrel-0.0.8/barrel/Utils/Args.h --- old/barrel-0.0.7/barrel/Utils/Args.h 2021-11-23 12:17:00.000000000 +0100 +++ new/barrel-0.0.8/barrel/Utils/Args.h 2021-11-26 09:21:42.000000000 +0100 @@ -38,25 +38,28 @@ Args(std::initializer_list<string> init) { + tmp.push_back(strdup("barrel")); + for (const string& s : init) tmp.push_back(strdup(s.c_str())); + tmp.push_back(nullptr); } Args(const vector<string>& init) { + tmp.push_back(strdup("barrel")); + for (const string& s : init) - tmp.push_back(strdup(s.c_str())); + tmp.push_back(strdup(s.c_str())); + tmp.push_back(nullptr); } ~Args() { - // TODO enabling this causes testsuite/strange1.cc to fail -#if 0 for (char* p : tmp) free(p); -#endif } int argc() const { return tmp.size() - 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/barrel/create-lvm-lv.cc new/barrel-0.0.8/barrel/create-lvm-lv.cc --- old/barrel-0.0.7/barrel/create-lvm-lv.cc 2021-11-18 15:46:47.000000000 +0100 +++ new/barrel-0.0.8/barrel/create-lvm-lv.cc 2021-11-29 16:07:21.000000000 +0100 @@ -197,8 +197,6 @@ void ParsedCmdCreateLvmLv::doit(const GlobalOptions& global_options, State& state) const { - // TODO check name (valid, unique) - Devicegraph* staging = state.storage->get_staging(); LvmVg* lvm_vg = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/barrel/handle.cc new/barrel-0.0.8/barrel/handle.cc --- old/barrel-0.0.7/barrel/handle.cc 2021-11-23 09:41:40.000000000 +0100 +++ new/barrel-0.0.8/barrel/handle.cc 2021-12-17 09:44:00.000000000 +0100 @@ -36,6 +36,7 @@ #include "Utils/Text.h" #include "Utils/Misc.h" #include "Utils/Readline.h" +#include "Utils/Prompt.h" #include "handle.h" #include "cmds.h" @@ -101,6 +102,14 @@ { vector<shared_ptr<ParsedCmd>> cmds; + // This is tricky. getopt needs optind = 0 to reinit itself in interactive + // mode. Without that strange things can happen, esp. with short options. So call + // GetOpts::parse explicitely. Also notice that getopt sets optind to 1 if it is 0 + // to skip the program name. For that reason argv includes a program name as first + // element. + + get_opts.parse(GetOpts::no_ext_options); + const char* command = get_opts.pop_arg(); vector<MainCmd>::const_iterator main_cmd = sloppy_find(main_cmds, command); @@ -177,29 +186,58 @@ { } + virtual void begin() const override + { + if (global_options.verbose || global_options.quiet) + return; + + cout << _("Probing...") << flush; + beginning_of_line = false; + } + + virtual void end() const override + { + if (global_options.verbose || global_options.quiet) + return; + + if (!beginning_of_line) + cout << " "; + + cout << _("done") << endl; + beginning_of_line = true; + } + virtual void message(const string& message) const override { - if (global_options.verbose) - cout << message << endl; + if (!global_options.verbose) + return; + + cout << message << endl; } virtual bool error(const string& message, const string& what) const override { + if (!beginning_of_line) + cout << '\n'; + beginning_of_line = true; + cerr << _("error:") << ' ' << message << endl; - return false; + + return prompt(_("Continue?")); } virtual bool missing_command(const string& message, const string& what, const string& command, uint64_t used_features) const override { - cerr << _("error:") << ' ' << message << endl; - return false; + return error(message, what); } private: const GlobalOptions& global_options; + mutable bool beginning_of_line = true; + }; @@ -222,14 +260,8 @@ if (global_options.probe) { - if (!global_options.verbose && !global_options.quiet) - cout << _("Probing...") << flush; - MyProbeCallbacks my_probe_callbacks(global_options); storage.probe(&my_probe_callbacks); - - if (!global_options.verbose && !global_options.quiet) - cout << " " << _("done") << endl; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/barrel/load-devicegraph.cc new/barrel-0.0.8/barrel/load-devicegraph.cc --- old/barrel-0.0.7/barrel/load-devicegraph.cc 2021-11-18 15:48:26.000000000 +0100 +++ new/barrel-0.0.8/barrel/load-devicegraph.cc 2021-12-02 10:31:19.000000000 +0100 @@ -24,6 +24,8 @@ #include <storage/Devicegraph.h> #include <storage/Devices/Disk.h> #include <storage/Devices/Dasd.h> +#include <storage/Devices/Multipath.h> +#include <storage/Devices/DmRaid.h> #include <storage/Holders/Holder.h> #include "Utils/GetOpts.h" @@ -93,7 +95,7 @@ /** * Make an automatic mapping for disks and DASDs. Either the udev path or id must be - * identical. + * identical. For multipath and DM RAID the name must be identical. */ mapping_t make_mapping(const Devicegraph* probed, const Devicegraph* staging) const; @@ -112,6 +114,16 @@ const Dasd* map_dasd(const GlobalOptions& global_options, const Devicegraph* probed, SystemInfo& system_info, const mapping_t& mapping, const Dasd* a) const; + const Multipath* map_multipath(const GlobalOptions& global_options, const Devicegraph* probed, + SystemInfo& system_info, const mapping_t& mapping, const Multipath* a) const; + + const DmRaid* map_dm_raid(const GlobalOptions& global_options, const Devicegraph* probed, + SystemInfo& system_info, const mapping_t& mapping, const DmRaid* a) const; + + bool skip_disk(const Disk* a) const; + + void copy_to_staging(Devicegraph* staging, BlkDevice* a, const BlkDevice* b) const; + }; @@ -220,6 +232,44 @@ mapping[a->get_name()] = { matches.front()->get_name() }; } + for (const Multipath* a : Multipath::get_all(staging)) + { + vector<const Multipath*> matches; + + for (const Multipath* b : Multipath::get_all(probed)) + { + if (a->get_name() == b->get_name()) + matches.push_back(b); + } + + if (matches.size() == 0) + throw runtime_error(sformat(_("no mapping multipath for '%s' found"), a->get_name().c_str())); + + if (matches.size() >= 2) + throw runtime_error(sformat(_("several mapping multipath for '%s' found"), a->get_name().c_str())); + + mapping[a->get_name()] = { matches.front()->get_name() }; + } + + for (const DmRaid* a : DmRaid::get_all(staging)) + { + vector<const DmRaid*> matches; + + for (const DmRaid* b : DmRaid::get_all(probed)) + { + if (a->get_name() == b->get_name()) + matches.push_back(b); + } + + if (matches.size() == 0) + throw runtime_error(sformat(_("no mapping DM RAID for '%s' found"), a->get_name().c_str())); + + if (matches.size() >= 2) + throw runtime_error(sformat(_("several mapping DM RAIDs for '%s' found"), a->get_name().c_str())); + + mapping[a->get_name()] = { matches.front()->get_name() }; + } + return mapping; } @@ -317,6 +367,72 @@ } + const Multipath* + ParsedCmdLoadDevicegraph::map_multipath(const GlobalOptions& global_options, const Devicegraph* probed, + SystemInfo& system_info, const mapping_t& mapping, const Multipath* a) const + { + const BlkDevice* b = map_blk_device(global_options, probed, system_info, mapping, a); + + if (!is_multipath(b)) + throw runtime_error(sformat(_("mapped device for '%s' is not a multipath"), a->get_name().c_str())); + + return to_multipath(b); + } + + + const DmRaid* + ParsedCmdLoadDevicegraph::map_dm_raid(const GlobalOptions& global_options, const Devicegraph* probed, + SystemInfo& system_info, const mapping_t& mapping, const DmRaid* a) const + { + const BlkDevice* b = map_blk_device(global_options, probed, system_info, mapping, a); + + if (!is_dm_raid(b)) + throw runtime_error(sformat(_("mapped device for '%s' is not a DM RAID"), a->get_name().c_str())); + + return to_dm_raid(b); + } + + + bool + ParsedCmdLoadDevicegraph::skip_disk(const Disk* a) const + { + for (const Device* child : a->get_children()) + { + if (is_multipath(child) || is_dm_raid(child)) + return true; + } + + return false; + } + + + void + ParsedCmdLoadDevicegraph::copy_to_staging(Devicegraph* staging, BlkDevice* a, const BlkDevice* b) const + { + // copy device to staging and attach children + + Device* c = b->copy_to_devicegraph(staging); + + for (Holder* holder : a->get_out_holders()) + holder->set_source(c); + + // copy parents with holders to staging (e.g. for multipath) + + for (const Holder* holder : b->get_in_holders()) + { + holder->get_source()->copy_to_devicegraph(staging); + holder->copy_to_devicegraph(staging); + } + + // remove old (loaded) device and old (loaded) parents from staging + + for (Holder* holder : a->get_in_holders()) + staging->remove_device(holder->get_source()); + + staging->remove_device(a); + } + + void ParsedCmdLoadDevicegraph::doit(const GlobalOptions& global_options, State& state) const { @@ -340,24 +456,17 @@ SystemInfo system_info; - // TODO multipath, md raid, dm raid - for (Disk* a : Disk::get_all(staging)) { + if (skip_disk(a)) + continue; + const Disk* b = map_disk(global_options, probed, system_info, mapping, a); if (b->exists_in_devicegraph(staging)) throw runtime_error(sformat(_("mapped disk for '%s' mapped twice"), a->get_name().c_str())); - Device* c = b->copy_to_devicegraph(staging); - - for (Holder* holder : a->get_out_holders()) - holder->set_source(c); - - staging->remove_device(a); - - // TODO must anything dependent be update? e.g. name, sysfs_name, sysfs_path - // of partitions, topology, ... + copy_to_staging(staging, a, b); } for (Dasd* a : Dasd::get_all(staging)) @@ -367,17 +476,32 @@ if (b->exists_in_devicegraph(staging)) throw runtime_error(sformat(_("mapped DASD for '%s' mapped twice"), a->get_name().c_str())); - Device* c = b->copy_to_devicegraph(staging); + copy_to_staging(staging, a, b); + } + + for (Multipath* a : Multipath::get_all(staging)) + { + const Multipath* b = map_multipath(global_options, probed, system_info, mapping, a); + + if (b->exists_in_devicegraph(staging)) + throw runtime_error(sformat(_("mapped multipath for '%s' mapped twice"), a->get_name().c_str())); - for (Holder* holder : a->get_out_holders()) - holder->set_source(c); + copy_to_staging(staging, a, b); + } - staging->remove_device(a); + for (DmRaid* a : DmRaid::get_all(staging)) + { + const DmRaid* b = map_dm_raid(global_options, probed, system_info, mapping, a); - // TODO must anything dependent be update? e.g. name, sysfs_name, sysfs_path - // of partitions, topology, ... + if (b->exists_in_devicegraph(staging)) + throw runtime_error(sformat(_("mapped DM RAID for '%s' mapped twice"), a->get_name().c_str())); + + copy_to_staging(staging, a, b); } + // TODO must anything dependent be update? libstorage-ng already takes are of some + // stuff + // TODO clear uuids // TODO what to do with subvolumes/snapshots of snapper? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/barrel.spec.in new/barrel-0.0.8/barrel.spec.in --- old/barrel-0.0.7/barrel.spec.in 2021-11-22 17:24:22.000000000 +0100 +++ new/barrel-0.0.8/barrel.spec.in 2021-12-02 10:52:41.000000000 +0100 @@ -32,12 +32,12 @@ BuildRequires: docbook-xsl-stylesheets %endif BuildRequires: fdupes -BuildRequires: libstorage-ng-devel >= 4.4.57 +BuildRequires: libstorage-ng-devel >= 4.4.59 BuildRequires: libtool BuildRequires: libxslt BuildRequires: readline-devel -Requires: libstorage-ng1 >= 4.4.57 +Requires: libstorage-ng1 >= 4.4.59 Recommends: %{name}-lang Summary: Tool for storage management diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/Makefile.am new/barrel-0.0.8/testsuite/Makefile.am --- old/barrel-0.0.7/testsuite/Makefile.am 2021-11-23 11:25:35.000000000 +0100 +++ new/barrel-0.0.8/testsuite/Makefile.am 2021-12-02 11:00:06.000000000 +0100 @@ -13,7 +13,7 @@ getopts.test table.test raid1.test xfs1.test \ complex1.test parse-line.test lvm1.test load1.test \ pools1.test show1.test show2.test remove1.test \ - luks1.test gpt1.test misuse1.test strange1.test + luks1.test gpt1.test misuse1.test AM_DEFAULT_SOURCE_EXT = .cc @@ -21,5 +21,5 @@ EXTRA_DIST = empty1.xml empty2.xml mapping1.json load1.xml \ real1.xml real2.xml real3.xml real4.xml real5.xml \ - real6.xml + real6.xml dmraid1.xml dmraid2.xml mapping2.json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/Makefile.in new/barrel-0.0.8/testsuite/Makefile.in --- old/barrel-0.0.7/testsuite/Makefile.in 2021-11-23 12:24:33.000000000 +0100 +++ new/barrel-0.0.8/testsuite/Makefile.in 2021-12-02 11:33:12.000000000 +0100 @@ -96,8 +96,7 @@ parse-line.test$(EXEEXT) lvm1.test$(EXEEXT) \ load1.test$(EXEEXT) pools1.test$(EXEEXT) show1.test$(EXEEXT) \ show2.test$(EXEEXT) remove1.test$(EXEEXT) luks1.test$(EXEEXT) \ - gpt1.test$(EXEEXT) misuse1.test$(EXEEXT) \ - strange1.test$(EXEEXT) + gpt1.test$(EXEEXT) misuse1.test$(EXEEXT) subdir = testsuite ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -177,11 +176,6 @@ show2_test_LDADD = $(LDADD) show2_test_DEPENDENCIES = ../barrel/libbarrel.la \ ../barrel/Utils/libutils.la -strange1_test_SOURCES = strange1.cc -strange1_test_OBJECTS = strange1.$(OBJEXT) -strange1_test_LDADD = $(LDADD) -strange1_test_DEPENDENCIES = ../barrel/libbarrel.la \ - ../barrel/Utils/libutils.la table_test_SOURCES = table.cc table_test_OBJECTS = table.$(OBJEXT) table_test_LDADD = $(LDADD) @@ -212,8 +206,7 @@ ./$(DEPDIR)/lvm1.Po ./$(DEPDIR)/misuse1.Po \ ./$(DEPDIR)/parse-line.Po ./$(DEPDIR)/pools1.Po \ ./$(DEPDIR)/raid1.Po ./$(DEPDIR)/remove1.Po \ - ./$(DEPDIR)/show1.Po ./$(DEPDIR)/show2.Po \ - ./$(DEPDIR)/strange1.Po ./$(DEPDIR)/table.Po \ + ./$(DEPDIR)/show1.Po ./$(DEPDIR)/show2.Po ./$(DEPDIR)/table.Po \ ./$(DEPDIR)/xfs1.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ @@ -236,10 +229,10 @@ am__v_CXXLD_1 = SOURCES = complex1.cc getopts.cc gpt1.cc load1.cc luks1.cc lvm1.cc \ misuse1.cc parse-line.cc pools1.cc raid1.cc remove1.cc \ - show1.cc show2.cc strange1.cc table.cc xfs1.cc + show1.cc show2.cc table.cc xfs1.cc DIST_SOURCES = complex1.cc getopts.cc gpt1.cc load1.cc luks1.cc \ lvm1.cc misuse1.cc parse-line.cc pools1.cc raid1.cc remove1.cc \ - show1.cc show2.cc strange1.cc table.cc xfs1.cc + show1.cc show2.cc table.cc xfs1.cc am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -608,7 +601,7 @@ TESTS = $(check_PROGRAMS) EXTRA_DIST = empty1.xml empty2.xml mapping1.json load1.xml \ real1.xml real2.xml real3.xml real4.xml real5.xml \ - real6.xml + real6.xml dmraid1.xml dmraid2.xml mapping2.json all: all-am @@ -705,10 +698,6 @@ @rm -f show2.test$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(show2_test_OBJECTS) $(show2_test_LDADD) $(LIBS) -strange1.test$(EXEEXT): $(strange1_test_OBJECTS) $(strange1_test_DEPENDENCIES) $(EXTRA_strange1_test_DEPENDENCIES) - @rm -f strange1.test$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(strange1_test_OBJECTS) $(strange1_test_LDADD) $(LIBS) - table.test$(EXEEXT): $(table_test_OBJECTS) $(table_test_DEPENDENCIES) $(EXTRA_table_test_DEPENDENCIES) @rm -f table.test$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(table_test_OBJECTS) $(table_test_LDADD) $(LIBS) @@ -736,7 +725,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remove1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show2.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strange1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfs1.Po@am__quote@ # am--include-marker @@ -1072,7 +1060,6 @@ -rm -f ./$(DEPDIR)/remove1.Po -rm -f ./$(DEPDIR)/show1.Po -rm -f ./$(DEPDIR)/show2.Po - -rm -f ./$(DEPDIR)/strange1.Po -rm -f ./$(DEPDIR)/table.Po -rm -f ./$(DEPDIR)/xfs1.Po -rm -f Makefile @@ -1133,7 +1120,6 @@ -rm -f ./$(DEPDIR)/remove1.Po -rm -f ./$(DEPDIR)/show1.Po -rm -f ./$(DEPDIR)/show2.Po - -rm -f ./$(DEPDIR)/strange1.Po -rm -f ./$(DEPDIR)/table.Po -rm -f ./$(DEPDIR)/xfs1.Po -rm -f Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/complex1.cc new/barrel-0.0.8/testsuite/complex1.cc --- old/barrel-0.0.7/testsuite/complex1.cc 2021-08-18 11:56:38.000000000 +0200 +++ new/barrel-0.0.8/testsuite/complex1.cc 2021-11-26 09:13:36.000000000 +0100 @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes", "create", "raid", "--level", "5", "--pool", "HDDs (512 B)", + Args args({ "--dry-run", "--yes", "create", "raid", "--level", "5", "--pool", "HDDs (512 B)", "--devices", "3+1", "--size", "8 GiB", "xfs", "--path", "/test1" }); vector<string> actions = { @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--dry-run", "--yes", "create", "raid5", "--pool", "HDDs (512 B)", "--devices", + Args args({ "--dry-run", "--yes", "create", "raid5", "--pool", "HDDs (512 B)", "--devices", "3+1", "--size", "8 GiB", "gpt", "xfs", "--size", "1 GiB", "--path", "/test1" }); vector<string> actions = { @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--dry-run", "--yes", "create", "raid", "--level", "5", "--pool", "HDDs (512 B)", + Args args({ "--dry-run", "--yes", "create", "raid", "--level", "5", "--pool", "HDDs (512 B)", "--devices", "3+1", "--size", "8 GiB", "vg", "--name", "test", "lv", "--name", "foo", "--size", "2 GiB" }); @@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(test4) { - Args args({ "barrel", "--dry-run", "--yes", "create", "raid5", "--pool", "HDDs (512 B)", "--devices", + Args args({ "--dry-run", "--yes", "create", "raid5", "--pool", "HDDs (512 B)", "--devices", "3+1", "--size", "8 GiB", "gpt", "vg", "--name", "test", "--size", "6 GiB", "lv", "--name", "foo", "--size", "2 GiB" }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/dmraid1.xml new/barrel-0.0.8/testsuite/dmraid1.xml --- old/barrel-0.0.7/testsuite/dmraid1.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/barrel-0.0.8/testsuite/dmraid1.xml 2021-12-02 10:49:48.000000000 +0100 @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<!-- generated by libstorage-ng version 4.4.61, kassandra.suse.de, 2021-12-02 09:47:07 GMT --> +<Devicegraph> + <Devices> + <Disk> + <sid>44</sid> + <name>/dev/sdb</name> + <sysfs-name>sdb</sysfs-name> + <sysfs-path>/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb</sysfs-path> + <region> + <length>67108864</length> + <block-size>512</block-size> + </region> + <udev-path>pci-0000:00:1f.2-ata-2</udev-path> + <udev-path>pci-0000:00:1f.2-ata-2.0</udev-path> + <udev-id>ata-VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <udev-id>scsi-0ATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <udev-id>scsi-1ATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <udev-id>scsi-SATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <range>256</range> + <rotational>true</rotational> + </Disk> + <Disk> + <sid>47</sid> + <name>/dev/sdc</name> + <sysfs-name>sdc</sysfs-name> + <sysfs-path>/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sdc</sysfs-path> + <region> + <length>67108864</length> + <block-size>512</block-size> + </region> + <udev-path>pci-0000:00:1f.2-ata-3</udev-path> + <udev-path>pci-0000:00:1f.2-ata-3.0</udev-path> + <udev-id>ata-VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <udev-id>scsi-0ATA_VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <udev-id>scsi-1ATA_VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <udev-id>scsi-SATA_VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <range>256</range> + <rotational>true</rotational> + </Disk> + <DmRaid> + <sid>49</sid> + <name>/dev/mapper/isw_ccffigbhjc_test2</name> + <sysfs-name>dm-0</sysfs-name> + <sysfs-path>/devices/virtual/block/dm-0</sysfs-path> + <region> + <length>67099392</length> + <block-size>512</block-size> + </region> + <dm-table-name>isw_ccffigbhjc_test2</dm-table-name> + <range>256</range> + <rotational>true</rotational> + </DmRaid> + <Gpt> + <sid>54</sid> + </Gpt> + <Partition> + <sid>55</sid> + <name>/dev/mapper/isw_ccffigbhjc_test2-part1</name> + <sysfs-name>dm-1</sysfs-name> + <sysfs-path>/devices/virtual/block/dm-1</sysfs-path> + <region> + <start>2048</start> + <length>13418496</length> + <block-size>512</block-size> + </region> + <dm-table-name>isw_ccffigbhjc_test2-part1</dm-table-name> + <type>primary</type> + <id>131</id> + <uuid>8b76ee05-1184-4bdf-834f-a24b5fccd9b4</uuid> + </Partition> + <Xfs> + <sid>58</sid> + <uuid>eac326ab-fa44-4c0d-9228-256f45eb9609</uuid> + </Xfs> + </Devices> + <Holders> + <User> + <source-sid>44</source-sid> + <target-sid>49</target-sid> + </User> + <User> + <source-sid>47</source-sid> + <target-sid>49</target-sid> + </User> + <User> + <source-sid>49</source-sid> + <target-sid>54</target-sid> + </User> + <Subdevice> + <source-sid>54</source-sid> + <target-sid>55</target-sid> + </Subdevice> + <FilesystemUser> + <source-sid>55</source-sid> + <target-sid>58</target-sid> + </FilesystemUser> + </Holders> +</Devicegraph> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/dmraid2.xml new/barrel-0.0.8/testsuite/dmraid2.xml --- old/barrel-0.0.7/testsuite/dmraid2.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/barrel-0.0.8/testsuite/dmraid2.xml 2021-12-02 10:49:54.000000000 +0100 @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<!-- generated by libstorage-ng version 4.4.61, kassandra.suse.de, 2021-12-02 09:48:46 GMT --> +<Devicegraph> + <Devices> + <Disk> + <sid>44</sid> + <name>/dev/sdb</name> + <sysfs-name>sdb</sysfs-name> + <sysfs-path>/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb</sysfs-path> + <region> + <length>67108864</length> + <block-size>512</block-size> + </region> + <udev-path>pci-0000:00:1f.2-ata-2</udev-path> + <udev-path>pci-0000:00:1f.2-ata-2.0</udev-path> + <udev-id>ata-VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <udev-id>scsi-0ATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <udev-id>scsi-1ATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <udev-id>scsi-SATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc</udev-id> + <range>256</range> + <rotational>true</rotational> + </Disk> + <Disk> + <sid>47</sid> + <name>/dev/sdc</name> + <sysfs-name>sdc</sysfs-name> + <sysfs-path>/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sdc</sysfs-path> + <region> + <length>67108864</length> + <block-size>512</block-size> + </region> + <udev-path>pci-0000:00:1f.2-ata-3</udev-path> + <udev-path>pci-0000:00:1f.2-ata-3.0</udev-path> + <udev-id>ata-VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <udev-id>scsi-0ATA_VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <udev-id>scsi-1ATA_VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <udev-id>scsi-SATA_VBOX_HARDDISK_VBe1488f70-95221d44</udev-id> + <range>256</range> + <rotational>true</rotational> + </Disk> + <DmRaid> + <sid>49</sid> + <name>/dev/mapper/isw_ccffihaefd_test2</name> + <sysfs-name>dm-0</sysfs-name> + <sysfs-path>/devices/virtual/block/dm-0</sysfs-path> + <region> + <length>67099392</length> + <block-size>512</block-size> + </region> + <dm-table-name>isw_ccffihaefd_test2</dm-table-name> + <range>256</range> + <rotational>true</rotational> + </DmRaid> + <Gpt> + <sid>54</sid> + </Gpt> + <Partition> + <sid>55</sid> + <name>/dev/mapper/isw_ccffihaefd_test2-part1</name> + <sysfs-name>dm-1</sysfs-name> + <sysfs-path>/devices/virtual/block/dm-1</sysfs-path> + <region> + <start>2048</start> + <length>67096576</length> + <block-size>512</block-size> + </region> + <dm-table-name>isw_ccffihaefd_test2-part1</dm-table-name> + <type>primary</type> + <id>131</id> + <uuid>c7327ecb-784c-4a2c-b487-e69896302fff</uuid> + </Partition> + <Xfs> + <sid>58</sid> + <uuid>eac326ab-fa44-4c0d-9228-256f45eb9609</uuid> + </Xfs> + </Devices> + <Holders> + <User> + <source-sid>44</source-sid> + <target-sid>49</target-sid> + </User> + <User> + <source-sid>47</source-sid> + <target-sid>49</target-sid> + </User> + <User> + <source-sid>49</source-sid> + <target-sid>54</target-sid> + </User> + <Subdevice> + <source-sid>54</source-sid> + <target-sid>55</target-sid> + </Subdevice> + <FilesystemUser> + <source-sid>55</source-sid> + <target-sid>58</target-sid> + </FilesystemUser> + </Holders> +</Devicegraph> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/getopts.cc new/barrel-0.0.8/testsuite/getopts.cc --- old/barrel-0.0.7/testsuite/getopts.cc 2021-11-23 06:50:43.000000000 +0100 +++ new/barrel-0.0.8/testsuite/getopts.cc 2021-11-26 09:14:35.000000000 +0100 @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(good1) { - Args args({ "getopt", "--verbose" }); + Args args({ "--verbose" }); GetOpts get_opts(args.argc(), args.argv()); ParsedOpts parsed_global_opts = get_opts.parse(global_opts); @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(good2) { - Args args({ "getopt", "-v", "create", "raid", "--size", "1 TiB", "/dev/sd[cd]1" }); + Args args({ "-v", "create", "raid", "--size", "1 TiB", "/dev/sd[cd]1" }); GetOpts get_opts(args.argc(), args.argv(), true, { "/dev/sda", "/dev/sdb", "/dev/sdc", "/dev/sdc1", "/dev/sdc2", "/dev/sdd", "/dev/sdd1", "/dev/sdd2" }); @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(good3) { - Args args({ "getopt", "--verbose", "create", "raid", "--size=1 TiB", "/dev/sdc1", "/dev/sdd1", + Args args({ "--verbose", "create", "raid", "--size=1 TiB", "/dev/sdc1", "/dev/sdd1", "filesystem", "--type=xfs" }); GetOpts get_opts(args.argc(), args.argv()); @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(good4) { - Args args({ "getopt", "--verbose", "create", "raid", "--size=1 TiB", "/dev/sd[cd]1" }); + Args args({ "--verbose", "create", "raid", "--size=1 TiB", "/dev/sd[cd]1" }); GetOpts get_opts(args.argc(), args.argv(), true, { "/dev/sdc", "/dev/sdd" }); // parse global options @@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE(error1) { - Args args({ "getopt", "--table-style" }); + Args args({ "--table-style" }); GetOpts get_opts(args.argc(), args.argv()); BOOST_CHECK_EXCEPTION(get_opts.parse(global_opts), runtime_error, [](const exception& e) { @@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(error2) { - Args args({ "getopt", "create", "raid", "--size" }); + Args args({ "create", "raid", "--size" }); GetOpts get_opts(args.argc(), args.argv()); get_opts.parse(global_opts); @@ -208,7 +208,7 @@ BOOST_AUTO_TEST_CASE(error3) { - Args args({ "getopt", "--read-my-mind" }); + Args args({ "--read-my-mind" }); GetOpts get_opts(args.argc(), args.argv()); BOOST_CHECK_EXCEPTION(get_opts.parse(global_opts), runtime_error, [](const exception& e) { @@ -219,7 +219,7 @@ BOOST_AUTO_TEST_CASE(error4) { - Args args({ "getopt", "create", "raid", "--read-my-mind" }); + Args args({ "create", "raid", "--read-my-mind" }); GetOpts get_opts(args.argc(), args.argv()); get_opts.parse(global_opts); @@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(error5) { - Args args({ "getopt", "/dev/sdz", "show" }); + Args args({ "/dev/sdz", "show" }); GetOpts get_opts(args.argc(), args.argv()); BOOST_CHECK_EXCEPTION(get_opts.parse(global_opts), runtime_error, [](const exception& e) { @@ -245,7 +245,7 @@ BOOST_AUTO_TEST_CASE(error6) { - Args args({ "getopt", "show", "disks", "/dev/sdz" }); + Args args({ "show", "disks", "/dev/sdz" }); GetOpts get_opts(args.argc(), args.argv()); get_opts.parse(GetOpts::no_ext_options); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/gpt1.cc new/barrel-0.0.8/testsuite/gpt1.cc --- old/barrel-0.0.7/testsuite/gpt1.cc 2021-10-21 11:53:58.000000000 +0200 +++ new/barrel-0.0.8/testsuite/gpt1.cc 2021-11-26 09:11:15.000000000 +0100 @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes", "create", "gpt", "/dev/sdb", "--force" }); + Args args({ "--dry-run", "--yes", "create", "gpt", "/dev/sdb", "--force" }); vector<string> actions = { "Delete GPT on /dev/sdb", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/load1.cc new/barrel-0.0.8/testsuite/load1.cc --- old/barrel-0.0.7/testsuite/load1.cc 2021-08-09 15:16:48.000000000 +0200 +++ new/barrel-0.0.8/testsuite/load1.cc 2021-12-02 11:00:32.000000000 +0100 @@ -32,7 +32,7 @@ // So far only /dev/sda and alike can be used in the mapping file. E.g. by-path links // need a real system lookup (in find_by_any_name()). - Args args({ "barrel", "--dry-run", "--yes", "--verbose", "load", "devicegraph", "--name", "load1.xml", + Args args({ "--dry-run", "--yes", "--verbose", "load", "devicegraph", "--name", "load1.xml", "--mapping", "mapping1.json" }); vector<string> actions = { @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--dry-run", "--yes", "--verbose", "load", "devicegraph", "--name", "load1.xml" }); + Args args({ "--dry-run", "--yes", "--verbose", "load", "devicegraph", "--name", "load1.xml" }); vector<string> actions = { "Delete GPT on /dev/sda", @@ -96,6 +96,35 @@ vector<string> tmp; testsuite.save_actiongraph = [&tmp](const Actiongraph* actiongraph) { + tmp = actiongraph->get_commit_actions_as_strings(); + }; + + handle(args.argc(), args.argv(), &testsuite); + + BOOST_CHECK_EQUAL(actions, tmp); // TODO sort +} + + +BOOST_AUTO_TEST_CASE(test3) +{ + Args args({ "--dry-run", "--yes", "--verbose", "load", "devicegraph", "--name", "dmraid2.xml", + "--mapping", "mapping2.json" }); + + vector<string> actions = { + "Delete xfs on /dev/mapper/isw_ccffigbhjc_test2-part1 (6.40 GiB)", + "Delete partition /dev/mapper/isw_ccffigbhjc_test2-part1 (6.40 GiB)", + "Delete GPT on /dev/mapper/isw_ccffigbhjc_test2", + "Create GPT on /dev/mapper/isw_ccffigbhjc_test2", + "Create partition /dev/mapper/isw_ccffigbhjc_test2-part1 (31.99 GiB)", + "Create xfs on /dev/mapper/isw_ccffigbhjc_test2-part1 (31.99 GiB)", + "Set UUID of xfs on /dev/mapper/isw_ccffigbhjc_test2-part1 (31.99 GiB) to eac326ab-fa44-4c0d-9228-256f45eb9609" + }; + + Testsuite testsuite; + testsuite.devicegraph_filename = "dmraid1.xml"; + + vector<string> tmp; + testsuite.save_actiongraph = [&tmp](const Actiongraph* actiongraph) { tmp = actiongraph->get_commit_actions_as_strings(); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/luks1.cc new/barrel-0.0.8/testsuite/luks1.cc --- old/barrel-0.0.7/testsuite/luks1.cc 2021-10-01 08:44:49.000000000 +0200 +++ new/barrel-0.0.8/testsuite/luks1.cc 2021-11-26 09:11:55.000000000 +0100 @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes", "create", "luks1", "--name=cr1", "/dev/sdb", "-s", "max", + Args args({ "--dry-run", "--yes", "create", "luks1", "--name=cr1", "/dev/sdb", "-s", "max", "ext4" }); vector<string> actions = { @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--dry-run", "--yes", "create", "encryption", "--type=luks2", "--name=cr2", + Args args({ "--dry-run", "--yes", "create", "encryption", "--type=luks2", "--name=cr2", "/dev/sdb", "--force", "ext4" }); vector<string> actions = { @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--dry-run", "--yes", "create", "luks1", "--pool", "HDDs (512 B)", "--name", + Args args({ "--dry-run", "--yes", "create", "luks1", "--pool", "HDDs (512 B)", "--name", "cr3", "--size=12 GiB", "ext4" }); vector<string> actions = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/lvm1.cc new/barrel-0.0.8/testsuite/lvm1.cc --- old/barrel-0.0.7/testsuite/lvm1.cc 2021-08-18 21:46:03.000000000 +0200 +++ new/barrel-0.0.8/testsuite/lvm1.cc 2021-11-26 09:12:46.000000000 +0100 @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes", "create", "vg", "--name", "test", "--size", "5g", "--pool", + Args args({ "--dry-run", "--yes", "create", "vg", "--name", "test", "--size", "5g", "--pool", "HDDs (512 B)", "--devices", "2", "lv", "--name", "a", "--size", "2g", "--stripes", "max", "xfs", "--path", "/test" }); @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--dry-run", "--yes" }); + Args args({ "--dry-run", "--yes" }); vector<string> actions = { "Create partition /dev/sdb1 (2.50 GiB)", @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--dry-run", "--yes", "create", "vg", "--name", "test", "/dev/sdb", "/dev/sdc", + Args args({ "--dry-run", "--yes", "create", "vg", "--name", "test", "/dev/sdb", "/dev/sdc", "--size=max", "--extent-size=8m", "lv", "--name", "a", "--size", "max", "ext4" }); vector<string> actions = { @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(test4) { - Args args({ "barrel", "--dry-run", "--yes", "create", "vg", "--name", "test", "/dev/sdb", "--force", + Args args({ "--dry-run", "--yes", "create", "vg", "--name", "test", "/dev/sdb", "--force", "lv", "--name", "a", "--size", "2g", "--stripes", "max", "xfs", "--path", "/test" }); vector<string> actions = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/mapping2.json new/barrel-0.0.8/testsuite/mapping2.json --- old/barrel-0.0.7/testsuite/mapping2.json 1970-01-01 01:00:00.000000000 +0100 +++ new/barrel-0.0.8/testsuite/mapping2.json 2021-12-02 11:05:56.000000000 +0100 @@ -0,0 +1,5 @@ +{ + "mapping" : { + "/dev/mapper/isw_ccffihaefd_test2" : "/dev/mapper/isw_ccffigbhjc_test2" + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/misuse1.cc new/barrel-0.0.8/testsuite/misuse1.cc --- old/barrel-0.0.7/testsuite/misuse1.cc 2021-10-22 08:53:36.000000000 +0200 +++ new/barrel-0.0.8/testsuite/misuse1.cc 2021-11-30 13:12:41.000000000 +0100 @@ -29,7 +29,7 @@ pair<string, string> -huhu(int argc, char** argv, const Testsuite* testsuite) +run_and_capture(int argc, char** argv, const Testsuite* testsuite) { ostringstream buffer1; ostringstream buffer2; @@ -50,7 +50,7 @@ { // The block devices are missing. That is detected before probing. - Args args({ "barrel", "--dry-run", "create", "raid5" }); + Args args({ "--dry-run", "create", "raid5" }); vector<string> output1 = { // No "Probing..." @@ -63,7 +63,7 @@ Testsuite testsuite; testsuite.devicegraph_filename = "empty1.xml"; - pair<string, string> lhs = huhu(args.argc(), args.argv(), &testsuite); + pair<string, string> lhs = run_and_capture(args.argc(), args.argv(), &testsuite); string rhs1 = accumulate(output1.begin(), output1.end(), ""s, [](auto a, auto b) { return a + b + "\n"; }); @@ -81,7 +81,7 @@ { // The --size option is missing. That is detected before probing. - Args args({ "barrel", "--dry-run", "create", "vg", "--name", "test", "--pool", "HDDs (512 B)" }); + Args args({ "--dry-run", "create", "vg", "--name", "test", "--pool", "HDDs (512 B)" }); vector<string> output1 = { // No "Probing..." @@ -94,7 +94,7 @@ Testsuite testsuite; testsuite.devicegraph_filename = "empty1.xml"; - pair<string, string> lhs = huhu(args.argc(), args.argv(), &testsuite); + pair<string, string> lhs = run_and_capture(args.argc(), args.argv(), &testsuite); string rhs1 = accumulate(output1.begin(), output1.end(), ""s, [](auto a, auto b) { return a + b + "\n"; }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/pools1.cc new/barrel-0.0.8/testsuite/pools1.cc --- old/barrel-0.0.7/testsuite/pools1.cc 2021-08-19 07:20:39.000000000 +0200 +++ new/barrel-0.0.8/testsuite/pools1.cc 2021-11-26 09:13:04.000000000 +0100 @@ -16,7 +16,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes" }); + Args args({ "--dry-run", "--yes" }); vector<string> output = { "Probing... done", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/raid1.cc new/barrel-0.0.8/testsuite/raid1.cc --- old/barrel-0.0.7/testsuite/raid1.cc 2021-08-18 21:54:43.000000000 +0200 +++ new/barrel-0.0.8/testsuite/raid1.cc 2021-11-26 09:11:34.000000000 +0100 @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes", "create", "raid", "--level", "5", "--pool-name=HDDs (512 B)", + Args args({ "--dry-run", "--yes", "create", "raid", "--level", "5", "--pool-name=HDDs (512 B)", "--devices", "3+1", "--size", "8 GiB" }); vector<string> actions = { @@ -64,7 +64,7 @@ // Here the shell does the expansion of /dev/sd[b-e]. // barrel --dry-run create raid5 /dev/sd[b-e] --size "8 GiB" - Args args({ "barrel", "--dry-run", "--yes", "create", "raid5", "/dev/sdb", "/dev/sdc", "/dev/sdd", "/dev/sde", + Args args({ "--dry-run", "--yes", "create", "raid5", "/dev/sdb", "/dev/sdc", "/dev/sdd", "/dev/sde", "--size", "8 GiB" }); vector<string> actions = { @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--dry-run", "--yes" }); + Args args({ "--dry-run", "--yes" }); vector<string> actions = { "Create partition /dev/sdb1 (4.06 GiB)", @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(test4) { - Args args({ "barrel", "--dry-run", "--yes", "create", "raid", "--level", "mirror", "--name", "test", + Args args({ "--dry-run", "--yes", "create", "raid", "--level", "mirror", "--name", "test", "/dev/sdb", "/dev/sdc", "--force" }); vector<string> actions = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/remove1.cc new/barrel-0.0.8/testsuite/remove1.cc --- old/barrel-0.0.7/testsuite/remove1.cc 2021-10-11 09:54:52.000000000 +0200 +++ new/barrel-0.0.8/testsuite/remove1.cc 2021-11-26 09:12:31.000000000 +0100 @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes" }); + Args args({ "--dry-run", "--yes" }); vector<string> actions = { "Create partition /dev/sdb1 (8.12 GiB)", @@ -65,7 +65,7 @@ // Even on GPT partitions can be renumber due to the inability of parted to create // partitions with a defined number. - Args args({ "barrel", "--dry-run", "--yes" }); + Args args({ "--dry-run", "--yes" }); vector<string> actions = { "Create partition /dev/sdb1 (2.03 GiB)", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/show1.cc new/barrel-0.0.8/testsuite/show1.cc --- old/barrel-0.0.7/testsuite/show1.cc 2021-11-23 08:53:26.000000000 +0100 +++ new/barrel-0.0.8/testsuite/show1.cc 2021-11-26 09:10:38.000000000 +0100 @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "show", "disks" }); + Args args({ "--dry-run", "show", "disks" }); vector<string> output = { "Probing... done", @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--dry-run", "show", "raids" }); + Args args({ "--dry-run", "show", "raids" }); vector<string> output = { "Probing... done", @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--quiet", "--dry-run", "show", "vgs" }); + Args args({ "--quiet", "--dry-run", "show", "vgs" }); vector<string> output = { "Name ??? Size ??? Extent Size ??? Devices ??? Used ??? Stripes ??? Usage", @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(test4) { - Args args({ "barrel", "--quiet", "--dry-run", "show", "vgs" }); + Args args({ "--quiet", "--dry-run", "show", "vgs" }); vector<string> output = { "Name ??? Size ??? Extent Size ??? Devices ??? Used ??? Stripes ??? Usage", @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(test5) { - Args args({ "barrel", "--dry-run", "--quiet", "show", "filesystems" }); + Args args({ "--dry-run", "--quiet", "show", "filesystems" }); vector<string> output = { "Type ??? Label ??? Name ??? Size ??? Mount Point", @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(test6) { - Args args({ "barrel", "--dry-run", "--quiet", "show", "filesystems" }); + Args args({ "--dry-run", "--quiet", "show", "filesystems" }); vector<string> output = { "Type ??? Label ??? Name ??? Size ??? Mount Point", @@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(test7) { - Args args({ "barrel", "--dry-run", "--quiet", "show", "dasds", "--no-partitions" }); + Args args({ "--dry-run", "--quiet", "show", "dasds", "--no-partitions" }); vector<string> output = { "Name ??? Size ??? Block Size ??? Bus ID ??? Type ??? Format ??? Usage ??? Pool", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/show2.cc new/barrel-0.0.8/testsuite/show2.cc --- old/barrel-0.0.7/testsuite/show2.cc 2021-11-23 11:25:44.000000000 +0100 +++ new/barrel-0.0.8/testsuite/show2.cc 2021-11-26 09:10:57.000000000 +0100 @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "show", "tree", "/dev/md0" }); + Args args({ "--dry-run", "show", "tree", "/dev/md0" }); vector<string> output = { "Probing... done", @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--quiet", "--dry-run", "show", "tree", "/dev/data/home" }); + Args args({ "--quiet", "--dry-run", "show", "tree", "/dev/data/home" }); vector<string> output = { "Name ??? Size ??? Usage ??? Pool", @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--dry-run", "--quiet", "show", "tree", "/dev/mapper/36005076305ffc73a00000000000013b4" }); + Args args({ "--dry-run", "--quiet", "show", "tree", "/dev/mapper/36005076305ffc73a00000000000013b4" }); vector<string> output = { "Name ??? Size ??? Usage ??? Pool", @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(test4) { - Args args({ "barrel", "--dry-run", "--quiet", "show", "tree", "/dev/mapper/isw_ddgdcbibhd_test1" }); + Args args({ "--dry-run", "--quiet", "show", "tree", "/dev/mapper/isw_ddgdcbibhd_test1" }); vector<string> output = { "Name ??? Size ??? Usage ??? Pool", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/strange1.cc new/barrel-0.0.8/testsuite/strange1.cc --- old/barrel-0.0.7/testsuite/strange1.cc 2021-11-23 12:21:00.000000000 +0100 +++ new/barrel-0.0.8/testsuite/strange1.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,62 +0,0 @@ - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE barrel - -#include <numeric> -#include <boost/test/unit_test.hpp> - -#include <storage/Actiongraph.h> - -#include "../barrel/handle.h" -#include "../barrel/Utils/Args.h" - - -using namespace std; -using namespace storage; -using namespace barrel; - - -namespace std -{ - ostream& operator<<(ostream& s, const vector<string>& lines) - { - for (const string& line : lines) - s << line << '\n'; - - return s; - } -} - - -BOOST_AUTO_TEST_CASE(test1) -{ - Args args({ "barrel", "--dry-run", "--yes" }); - - Testsuite testsuite; - testsuite.devicegraph_filename = "empty1.xml"; - - testsuite.readlines = { - "show tree -u", - "show tree -u", - "quit" - }; - - vector<string> output = { - "Probing... done", - "Name ??? Size ??? Usage ??? Pool", - "??????????????????????????????????????????????????????????????????????????????", - "Name ??? Size ??? Usage ??? Pool", - "??????????????????????????????????????????????????????????????????????????????" - }; - - ostringstream buffer; - streambuf* old = cout.rdbuf(buffer.rdbuf()); - handle(args.argc(), args.argv(), &testsuite); - cout.rdbuf(old); - - string lhs = buffer.str(); - string rhs = accumulate(output.begin(), output.end(), ""s, - [](auto a, auto b) { return a + b + "\n"; }); - - BOOST_CHECK_EQUAL(lhs, rhs); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/barrel-0.0.7/testsuite/xfs1.cc new/barrel-0.0.8/testsuite/xfs1.cc --- old/barrel-0.0.7/testsuite/xfs1.cc 2021-08-18 19:17:58.000000000 +0200 +++ new/barrel-0.0.8/testsuite/xfs1.cc 2021-11-26 09:12:09.000000000 +0100 @@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(test1) { - Args args({ "barrel", "--dry-run", "--yes", "create", "xfs", "/dev/sdb", "-s", "8 GiB", "-p", "/test", + Args args({ "--dry-run", "--yes", "create", "xfs", "/dev/sdb", "-s", "8 GiB", "-p", "/test", "-o", "noauto" }); vector<string> actions = { @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(test2) { - Args args({ "barrel", "--dry-run", "--yes", "create", "filesystem", "--type=xfs", "/dev/sdb", "--force" }); + Args args({ "--dry-run", "--yes", "create", "filesystem", "--type=xfs", "/dev/sdb", "--force" }); vector<string> actions = { "Delete GPT on /dev/sdb", @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(test3) { - Args args({ "barrel", "--dry-run", "--yes", "create", "xfs", "--pool", "HDDs (512 B)", "--size=12 GiB", + Args args({ "--dry-run", "--yes", "create", "xfs", "--pool", "HDDs (512 B)", "--size=12 GiB", "--mkfs-options=-m bigtime=1" }); vector<string> actions = {