Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libstorage-ng for openSUSE:Factory 
checked in at 2023-07-07 15:46:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old)
 and      /work/SRC/openSUSE:Factory/.libstorage-ng.new.23466 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libstorage-ng"

Fri Jul  7 15:46:02 2023 rev:230 rq:1097425 version:4.5.122

Changes:
--------
--- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes      
2023-06-23 21:51:54.454390274 +0200
+++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.23466/libstorage-ng.changes   
2023-07-07 15:46:04.147748728 +0200
@@ -1,0 +2,7 @@
+Thu Jul 6 15:44:49 UTC 2023 - aschn...@suse.com
+
+- merge gh#openSUSE/libstorage-ng#938
+- prioritize activation of swap
+- 4.5.122
+
+--------------------------------------------------------------------

Old:
----
  libstorage-ng-4.5.121.tar.xz

New:
----
  libstorage-ng-4.5.122.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libstorage-ng.spec ++++++
--- /var/tmp/diff_new_pack.qMZnkc/_old  2023-07-07 15:46:04.935753422 +0200
+++ /var/tmp/diff_new_pack.qMZnkc/_new  2023-07-07 15:46:04.943753469 +0200
@@ -18,7 +18,7 @@
 
 %define libname %{name}1
 Name:           libstorage-ng
-Version:        4.5.121
+Version:        4.5.122
 Release:        0
 Summary:        Library for storage management
 License:        GPL-2.0-only

++++++ libstorage-ng-4.5.121.tar.xz -> libstorage-ng-4.5.122.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/LIBVERSION 
new/libstorage-ng-4.5.122/LIBVERSION
--- old/libstorage-ng-4.5.121/LIBVERSION        2023-06-22 09:58:15.000000000 
+0200
+++ new/libstorage-ng-4.5.122/LIBVERSION        2023-07-06 17:44:49.000000000 
+0200
@@ -1 +1 @@
-1.89.0
+1.89.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/VERSION 
new/libstorage-ng-4.5.122/VERSION
--- old/libstorage-ng-4.5.121/VERSION   2023-06-22 09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/VERSION   2023-07-06 17:44:49.000000000 +0200
@@ -1 +1 @@
-4.5.121
+4.5.122
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/configure.ac 
new/libstorage-ng-4.5.122/configure.ac
--- old/libstorage-ng-4.5.121/configure.ac      2023-06-22 09:58:15.000000000 
+0200
+++ new/libstorage-ng-4.5.122/configure.ac      2023-07-06 17:44:49.000000000 
+0200
@@ -129,6 +129,7 @@
        testsuite/dependencies/resize/btrfs/Makefile
        testsuite/dependencies/bcache/Makefile
        testsuite/dependencies/rear/Makefile
+       testsuite/order/Makefile
        testsuite/sorting/Makefile
        testsuite/style/Makefile
        testsuite/partitions/Makefile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/storage/ActiongraphImpl.cc 
new/libstorage-ng-4.5.122/storage/ActiongraphImpl.cc
--- old/libstorage-ng-4.5.121/storage/ActiongraphImpl.cc        2023-06-22 
09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/storage/ActiongraphImpl.cc        2023-07-06 
17:44:49.000000000 +0200
@@ -53,6 +53,7 @@
 #include "storage/Actions/SetQuotaImpl.h"
 #include "storage/Actions/MountImpl.h"
 #include "storage/Actions/UnmountImpl.h"
+#include "storage/EnvironmentImpl.h"
 
 
 namespace storage
@@ -151,6 +152,7 @@
        set_special_actions();
        add_dependencies();
        remove_only_syncs();
+       set_priorities();
 
        calculate_order();
 
@@ -723,19 +725,131 @@
 
 
     void
+    Actiongraph::Impl::set_priorities()
+    {
+       for (const vertex_descriptor v : vertices())
+       {
+           Action::Base* action = graph[v].get();
+
+           Action::Mount* mount = dynamic_cast<Action::Mount*>(action);
+           if (mount && mount->get_fs_type(*this) == FsType::SWAP)
+           {
+               mount->priority = 2;
+               set_priorities_upward(v);
+           }
+       }
+    }
+
+
+    void
+    Actiongraph::Impl::set_priorities_upward(vertex_descriptor v1)
+    {
+       for (const vertex_descriptor v2 : parents(v1))
+       {
+           Action::Base* action = graph[v2].get();
+
+           if (action->priority < 1)
+           {
+               action->priority = 1;
+               set_priorities_upward(v2);
+           }
+       }
+    }
+
+
+    void
     Actiongraph::Impl::calculate_order()
     {
        VertexIndexMapGenerator<graph_t> vertex_index_map_generator(graph);
 
-       try
+       switch (topological_sort_method())
        {
-           boost::topological_sort(graph, front_inserter(order),
-                                   
vertex_index_map(vertex_index_map_generator.get()));
+           case 0:
+           {
+               try
+               {
+                   boost::topological_sort(graph, front_inserter(order),
+                                           
vertex_index_map(vertex_index_map_generator.get()));
+               }
+               catch (const boost::not_a_dag&)
+               {
+                   ST_THROW(Exception("actiongraph not a DAG"));
+               }
+           }
+           break;
+
+           case 1:
+           {
+               order = 
prioritised_topological_sort(vertex_index_map_generator.get());
+           }
+           break;
+
+           default:
+               ST_THROW(Exception("unknown topological sort method"));
        }
-       catch (const boost::not_a_dag&)
+    }
+
+
+    class Actiongraph::Impl::CompareByPriority
+    {
+    public:
+
+       CompareByPriority(const graph_t& graph) : graph(graph) {}
+
+       bool operator()(const vertex_descriptor lhs, const vertex_descriptor 
rhs) const
        {
-           ST_THROW(Exception("actiongraph not a DAG"));
+           return graph[lhs].get()->priority < graph[rhs].get()->priority;
        }
+
+    private:
+
+       const graph_t& graph;
+
+    };
+
+
+    Actiongraph::Impl::Order
+    Actiongraph::Impl::prioritised_topological_sort(const 
boost::associative_property_map<vertex_index_map_t>& idx) const
+    {
+       // Based on Kahn's algorithm.
+
+       vector<degree_size_type> in_degrees(num_actions());
+
+       // We use vector/deque instead of the obvious priority_queue since we 
have a few
+       // points below where we can tweak the result (to look more like the 
plain
+       // topological sort).
+       vector<vertex_descriptor> q;
+
+       for (const vertex_descriptor v : vertices())
+       {
+           if ((in_degrees[idx[v]] = boost::in_degree(v, graph)) == 0)
+               q.push_back(v);                                         // 
arbitrary: push_front or push_back
+       }
+
+       const CompareByPriority compare_by_priority(graph);
+
+       Order order;
+
+       while (!q.empty())
+       {
+           stable_sort(q.begin(), q.end(), compare_by_priority);       // 
arbitrary: stable_sort or sort
+
+           const vertex_descriptor v = q.back();
+           q.pop_back();
+
+           order.push_back(v);
+
+           for (const vertex_descriptor v2 : children(v))
+           {
+               if (--in_degrees[idx[v2]] == 0)
+                   q.push_back(v2);                                    // 
arbitrary: push_front or push_back
+           }
+       }
+
+       if (order.size() != num_actions())
+           ST_THROW(Exception("actiongraph not a DAG"));
+
+       return order;
     }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/storage/ActiongraphImpl.h 
new/libstorage-ng-4.5.122/storage/ActiongraphImpl.h
--- old/libstorage-ng-4.5.121/storage/ActiongraphImpl.h 2023-06-22 
09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/storage/ActiongraphImpl.h 2023-07-06 
17:44:49.000000000 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2022] SUSE LLC
+ * Copyright (c) [2016-2023] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -111,6 +111,9 @@
        typedef graph_t::inv_adjacency_iterator inv_adjacency_iterator;
 
        typedef graph_t::vertices_size_type vertices_size_type;
+       typedef graph_t::degree_size_type degree_size_type;
+
+       typedef map<vertex_descriptor, vertices_size_type> vertex_index_map_t;
 
        Impl(const Storage& storage, Devicegraph* lhs, Devicegraph* rhs);
 
@@ -201,6 +204,8 @@
        void add_mount_dependencies();
        void add_special_dasd_pt_dependencies();
        void remove_only_syncs();
+       void set_priorities();
+       void set_priorities_upward(vertex_descriptor v1);
        void calculate_order();
 
        const Storage& storage;
@@ -212,6 +217,10 @@
 
        Order order;
 
+       class CompareByPriority;
+
+       Order prioritised_topological_sort(const 
boost::associative_property_map<vertex_index_map_t>& idx) const;
+
        graph_t graph;
 
        // map from path to mount/unmount action
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/storage/Actions/BaseImpl.h 
new/libstorage-ng-4.5.122/storage/Actions/BaseImpl.h
--- old/libstorage-ng-4.5.121/storage/Actions/BaseImpl.h        2023-06-22 
09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/storage/Actions/BaseImpl.h        2023-07-06 
17:44:49.000000000 +0200
@@ -100,6 +100,9 @@
            // Action is only used to inform user but does no operation.
            bool nop = false;
 
+           // A priority. Used to activate swap ASAP.
+           int priority = 0;
+
        };
 
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/storage/EnvironmentImpl.cc 
new/libstorage-ng-4.5.122/storage/EnvironmentImpl.cc
--- old/libstorage-ng-4.5.121/storage/EnvironmentImpl.cc        2023-06-22 
09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/storage/EnvironmentImpl.cc        2023-07-06 
17:44:49.000000000 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2018-2022] SUSE LLC
+ * Copyright (c) [2018-2023] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -101,6 +101,14 @@
     }
 
 
+    static int
+    read_env_var(const char* name, int fallback)
+    {
+       const char* p = getenv(name);
+       return p ? atoi(p) : fallback;
+    }
+
+
     bool
     support_btrfs_multiple_devices()
     {
@@ -146,8 +154,14 @@
     int
     mdadm_activate_method()
     {
-       const char* p = getenv("LIBSTORAGE_MDADM_ACTIVATE_METHOD");
-       return p ? atoi(p) : 0;
+       return read_env_var("LIBSTORAGE_MDADM_ACTIVATE_METHOD", 0);
+    }
+
+
+    int
+    topological_sort_method()
+    {
+       return read_env_var("LIBSTORAGE_TOPOLOGICAL_SORT_METHOD", 1);
     }
 
 
@@ -194,6 +208,7 @@
            "LIBSTORAGE_OS_FLAVOUR",
            "LIBSTORAGE_PFSOEMS",
            "LIBSTORAGE_ROOTPREFIX",
+           "LIBSTORAGE_TOPOLOGICAL_SORT_METHOD",
        };
 
        for (const char* env_var : env_vars)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/storage/EnvironmentImpl.h 
new/libstorage-ng-4.5.122/storage/EnvironmentImpl.h
--- old/libstorage-ng-4.5.121/storage/EnvironmentImpl.h 2023-06-22 
09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/storage/EnvironmentImpl.h 2023-07-06 
17:44:49.000000000 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2018-2022] SUSE LLC
+ * Copyright (c) [2018-2023] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -127,6 +127,11 @@
     int mdadm_activate_method();
 
     /**
+     * There are several methods for the topological sort of the actiongraph.
+     */
+    int topological_sort_method();
+
+    /**
      * Operating system flavour.
      */
     enum class OsFlavour
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/testsuite/Makefile.am 
new/libstorage-ng-4.5.122/testsuite/Makefile.am
--- old/libstorage-ng-4.5.121/testsuite/Makefile.am     2023-06-22 
09:58:15.000000000 +0200
+++ new/libstorage-ng-4.5.122/testsuite/Makefile.am     2023-07-06 
17:44:49.000000000 +0200
@@ -2,7 +2,7 @@
 # Makefile.am for libstorage/testsuite
 #
 
-SUBDIRS = helpers . Utils SystemInfo probe dependencies sorting                
        \
+SUBDIRS = helpers . Utils SystemInfo probe dependencies order sorting          
\
        freeinfo Devices partitions performance style commented-config-file     
\
        used-features CompoundAction
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/testsuite/order/Makefile.am 
new/libstorage-ng-4.5.122/testsuite/order/Makefile.am
--- old/libstorage-ng-4.5.121/testsuite/order/Makefile.am       1970-01-01 
01:00:00.000000000 +0100
+++ new/libstorage-ng-4.5.122/testsuite/order/Makefile.am       2023-07-06 
17:44:49.000000000 +0200
@@ -0,0 +1,18 @@
+#
+# Makefile.am for libstorage/testsuite/order
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)
+
+LDADD = ../../storage/libstorage-ng.la -lboost_unit_test_framework
+
+check_PROGRAMS =                                                               
\
+       swap1.test
+
+AM_DEFAULT_SOURCE_EXT = .cc
+
+TESTS = $(check_PROGRAMS)
+
+EXTRA_DIST =                                                                   
\
+       swap1-probed.xml swap1-staging.xml
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.121/testsuite/order/swap1-probed.xml 
new/libstorage-ng-4.5.122/testsuite/order/swap1-probed.xml
--- old/libstorage-ng-4.5.121/testsuite/order/swap1-probed.xml  1970-01-01 
01:00:00.000000000 +0100
+++ new/libstorage-ng-4.5.122/testsuite/order/swap1-probed.xml  2023-07-06 
17:44:49.000000000 +0200
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!-- generated by libstorage-ng version 4.5.121, kassandra.suse.de, 2023-07-05 
14:40:07 GMT -->
+<Devicegraph>
+  <Devices>
+    <Disk>
+      <sid>42</sid>
+      <name>/dev/nvme0n1</name>
+      <sysfs-name>nvme0n1</sysfs-name>
+      
<sysfs-path>/devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1</sysfs-path>
+      <region>
+        <length>1000215216</length>
+        <block-size>512</block-size>
+      </region>
+      <udev-path>pci-0000:05:00.0-nvme-1</udev-path>
+      <udev-id>nvme-eui.0000000001000000e4d25cb0ae765001</udev-id>
+      <range>256</range>
+      <transport>PCIe</transport>
+    </Disk>
+  </Devices>
+</Devicegraph>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.121/testsuite/order/swap1-staging.xml 
new/libstorage-ng-4.5.122/testsuite/order/swap1-staging.xml
--- old/libstorage-ng-4.5.121/testsuite/order/swap1-staging.xml 1970-01-01 
01:00:00.000000000 +0100
+++ new/libstorage-ng-4.5.122/testsuite/order/swap1-staging.xml 2023-07-06 
17:44:49.000000000 +0200
@@ -0,0 +1,152 @@
+<?xml version="1.0"?>
+<!-- generated by libstorage-ng version 4.5.121, kassandra.suse.de, 2023-07-05 
14:41:20 GMT -->
+<Devicegraph>
+  <Devices>
+    <Disk>
+      <sid>42</sid>
+      <name>/dev/nvme0n1</name>
+      <sysfs-name>nvme0n1</sysfs-name>
+      
<sysfs-path>/devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1</sysfs-path>
+      <region>
+        <length>1000215216</length>
+        <block-size>512</block-size>
+      </region>
+      <udev-path>pci-0000:05:00.0-nvme-1</udev-path>
+      <udev-id>nvme-eui.0000000001000000e4d25cb0ae765001</udev-id>
+      <range>256</range>
+      <transport>PCIe</transport>
+    </Disk>
+    <Gpt>
+      <sid>60</sid>
+    </Gpt>
+    <Partition>
+      <sid>156</sid>
+      <name>/dev/nvme0n1p1</name>
+      <sysfs-name>nvme0n1p1</sysfs-name>
+      
<sysfs-path>/devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p1</sysfs-path>
+      <region>
+        <start>2048</start>
+        <length>83888128</length>
+        <block-size>512</block-size>
+      </region>
+      <udev-path>pci-0000:05:00.0-nvme-1-part1</udev-path>
+      <udev-id>nvme-eui.0000000001000000e4d25cb0ae765001-part1</udev-id>
+      <type>primary</type>
+      <id>0x83</id>
+    </Partition>
+    <Xfs>
+      <sid>157</sid>
+    </Xfs>
+    <MountPoint>
+      <sid>158</sid>
+      <path>/</path>
+      <rootprefixed>true</rootprefixed>
+      <mount-by>uuid</mount-by>
+      <mount-type>xfs</mount-type>
+      <active>true</active>
+      <in-etc-fstab>true</in-etc-fstab>
+      <freq>0</freq>
+      <passno>0</passno>
+    </MountPoint>
+    <Partition>
+      <sid>159</sid>
+      <name>/dev/nvme0n1p2</name>
+      <sysfs-name>nvme0n1p2</sysfs-name>
+      
<sysfs-path>/devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p2</sysfs-path>
+      <region>
+        <start>83890176</start>
+        <length>4196352</length>
+        <block-size>512</block-size>
+      </region>
+      <udev-path>pci-0000:05:00.0-nvme-1-part2</udev-path>
+      <udev-id>nvme-eui.0000000001000000e4d25cb0ae765001-part2</udev-id>
+      <type>primary</type>
+      <id>0x82</id>
+    </Partition>
+    <Swap>
+      <sid>160</sid>
+    </Swap>
+    <MountPoint>
+      <sid>161</sid>
+      <path>swap</path>
+      <rootprefixed>true</rootprefixed>
+      <mount-by>uuid</mount-by>
+      <mount-type>swap</mount-type>
+      <active>true</active>
+      <in-etc-fstab>true</in-etc-fstab>
+      <freq>0</freq>
+      <passno>0</passno>
+    </MountPoint>
+    <Partition>
+      <sid>163</sid>
+      <name>/dev/nvme0n1p3</name>
+      <sysfs-name>nvme0n1p3</sysfs-name>
+      
<sysfs-path>/devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p3</sysfs-path>
+      <region>
+        <start>88086528</start>
+        <length>419432448</length>
+        <block-size>512</block-size>
+      </region>
+      <udev-path>pci-0000:05:00.0-nvme-1-part3</udev-path>
+      <udev-id>nvme-eui.0000000001000000e4d25cb0ae765001-part3</udev-id>
+      <type>primary</type>
+      <id>0x83</id>
+    </Partition>
+    <Xfs>
+      <sid>164</sid>
+    </Xfs>
+    <MountPoint>
+      <sid>165</sid>
+      <path>/home</path>
+      <rootprefixed>true</rootprefixed>
+      <mount-by>uuid</mount-by>
+      <mount-type>xfs</mount-type>
+      <active>true</active>
+      <in-etc-fstab>true</in-etc-fstab>
+      <freq>0</freq>
+      <passno>0</passno>
+    </MountPoint>
+  </Devices>
+  <Holders>
+    <User>
+      <source-sid>42</source-sid>
+      <target-sid>60</target-sid>
+    </User>
+    <Subdevice>
+      <source-sid>60</source-sid>
+      <target-sid>156</target-sid>
+    </Subdevice>
+    <FilesystemUser>
+      <source-sid>156</source-sid>
+      <target-sid>157</target-sid>
+    </FilesystemUser>
+    <User>
+      <source-sid>157</source-sid>
+      <target-sid>158</target-sid>
+    </User>
+    <Subdevice>
+      <source-sid>60</source-sid>
+      <target-sid>159</target-sid>
+    </Subdevice>
+    <FilesystemUser>
+      <source-sid>159</source-sid>
+      <target-sid>160</target-sid>
+    </FilesystemUser>
+    <User>
+      <source-sid>160</source-sid>
+      <target-sid>161</target-sid>
+    </User>
+    <Subdevice>
+      <source-sid>60</source-sid>
+      <target-sid>163</target-sid>
+    </Subdevice>
+    <FilesystemUser>
+      <source-sid>163</source-sid>
+      <target-sid>164</target-sid>
+    </FilesystemUser>
+    <User>
+      <source-sid>164</source-sid>
+      <target-sid>165</target-sid>
+    </User>
+  </Holders>
+</Devicegraph>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.121/testsuite/order/swap1.cc 
new/libstorage-ng-4.5.122/testsuite/order/swap1.cc
--- old/libstorage-ng-4.5.121/testsuite/order/swap1.cc  1970-01-01 
01:00:00.000000000 +0100
+++ new/libstorage-ng-4.5.122/testsuite/order/swap1.cc  2023-07-06 
17:44:49.000000000 +0200
@@ -0,0 +1,45 @@
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE libstorage
+
+#include <boost/test/unit_test.hpp>
+
+#include "storage/Environment.h"
+#include "storage/Storage.h"
+#include "storage/Devicegraph.h"
+#include "storage/Actiongraph.h"
+#include "storage/Actions/Base.h"
+#include "storage/Utils/Logger.h"
+
+using namespace storage;
+using namespace std;
+
+
+/**
+ * Check that swap is activated ASAP.
+ */
+BOOST_AUTO_TEST_CASE(order)
+{
+    setenv("LIBSTORAGE_TOPOLOGICAL_SORT_METHOD", "1", 1);
+
+    set_logger(get_stdout_logger());
+
+    Environment environment(true, ProbeMode::READ_DEVICEGRAPH, 
TargetMode::DIRECT);
+    environment.set_devicegraph_filename("swap1-probed.xml");
+
+    Storage storage(environment);
+    storage.probe();
+    storage.get_staging()->load("swap1-staging.xml");
+
+    const Actiongraph* actiongraph = storage.calculate_actiongraph();
+
+    const vector<const Action::Base*> actions = 
actiongraph->get_commit_actions();
+
+    BOOST_REQUIRE(actions.size() >= 5);
+
+    BOOST_CHECK_EQUAL(get_string(actiongraph, actions[0]), "Create GPT on 
/dev/nvme0n1");
+    BOOST_CHECK_EQUAL(get_string(actiongraph, actions[1]), "Create partition 
/dev/nvme0n1p1 (40.00 GiB)");
+    BOOST_CHECK_EQUAL(get_string(actiongraph, actions[2]), "Create partition 
/dev/nvme0n1p2 (2.00 GiB)");
+    BOOST_CHECK_EQUAL(get_string(actiongraph, actions[3]), "Create swap on 
/dev/nvme0n1p2 (2.00 GiB)");
+    BOOST_CHECK_EQUAL(get_string(actiongraph, actions[4]), "Mount 
/dev/nvme0n1p2 (2.00 GiB) at swap");
+}

Reply via email to