File tests-add-helper-require_swap_.patch of Package parted

From: Sebastian Parschauer <sparschauer@suse.de>
Date: Tue, 20 Feb 2018 12:30:23 +0100
Subject: tests: Add helper 'require_swap_'
For: libparted-canonicalize-dev-md-paths.patch
References: bsc#1078820
Patch-mainline: submitted, 2018-02-20

To achieve that a partition is busy, it is easiest to use it as swap
partition. So check if mkswap, swapon, and swapoff are available.

Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
 tests/t-lib-helpers.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
index 9312343..962b4f1 100644
--- a/tests/t-lib-helpers.sh
+++ b/tests/t-lib-helpers.sh
@@ -362,6 +362,12 @@ require_xfs_()
   mkfs.xfs -V || skip_ "this test requires XFS support"
 }
 
+require_swap_()
+{
+  mkswap -V && swapon -V && swapoff -V || \
+    skip_ "this test requires swap support"
+}
+
 require_dvhtool_()
 {
   dvhtool --help \
openSUSE Build Service is sponsored by