]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add /proc/swaps libmount parser test
authorKarel Zak <kzak@redhat.com>
Tue, 20 Mar 2018 12:34:31 +0000 (13:34 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Mar 2018 12:34:31 +0000 (13:34 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/libmount/tabfiles-parse-swaps [new file with mode: 0644]
tests/ts/libmount/files/swaps [new file with mode: 0644]
tests/ts/libmount/tabfiles

diff --git a/tests/expected/libmount/tabfiles-parse-swaps b/tests/expected/libmount/tabfiles-parse-swaps
new file mode 100644 (file)
index 0000000..bd781d4
--- /dev/null
@@ -0,0 +1,22 @@
+------ fs:
+source: /dev/dm-2
+target: (null)
+fstype: swap
+swaptype: partition
+size: 8151036
+usedsize: 2283436
+priority: -2
+------ fs:
+source: /some/swapfile
+target: (null)
+fstype: swap
+swaptype: file
+size: 111
+usedsize: 111
+------ fs:
+source: /some/swapfile2
+target: (null)
+fstype: swap
+swaptype: file
+size: 111
+usedsize: 111
diff --git a/tests/ts/libmount/files/swaps b/tests/ts/libmount/files/swaps
new file mode 100644 (file)
index 0000000..13ce933
--- /dev/null
@@ -0,0 +1,4 @@
+Filename                               Type            Size    Used    Priority
+/dev/dm-2                               partition      8151036 2283436 -2
+/some/swapfile                          file            111     111     0
+/some/swapfile2\040(deleted)            file            111     111     0
index ba424b24da7fc6d6b75451f6021f5d552b9af438..a45c286060dc3d17eef6c86b64c95279a147d1e8 100755 (executable)
@@ -37,6 +37,11 @@ ts_run $TESTPROG --parse "$TS_SELF/files/mountinfo" &> $TS_OUTPUT
 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
 ts_finalize_subtest
 
+ts_init_subtest "parse-swaps"
+ts_run $TESTPROG --parse "$TS_SELF/files/swaps" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
 ts_init_subtest "copy"
 ts_run $TESTPROG --copy-fs "$TS_SELF/files/fstab" &> $TS_OUTPUT
 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT