summaryrefslogtreecommitdiffstats
path: root/tests/ts/lsblk/lsblk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtests/ts/lsblk/lsblk56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/ts/lsblk/lsblk b/tests/ts/lsblk/lsblk
new file mode 100755
index 0000000..b790f75
--- /dev/null
+++ b/tests/ts/lsblk/lsblk
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+TS_TOPDIR="${0%/*}/../.."
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_LSBLK"
+ts_check_prog xz
+ts_check_prog tar
+
+for dump in $(ls $TS_SELF/dumps/*.tar.xz | sort); do
+ name=$(basename $dump .tar.xz)
+ dumpdir="$TS_OUTDIR/dumps"
+
+ mkdir -p $dumpdir
+ tar -C $dumpdir --xz -xf $dump
+
+ #
+ # Read *.cols from the tarball, but the expected output is not used
+ # from the tarball due to changes in lsblk fomatting etc. We keep up to
+ # date version in tests/expected/lsblk.
+ #
+ for cols_file in $(ls $dumpdir/$name/*.cols | sort); do
+ subname=$(basename $cols_file .cols)
+ subtestname="${name}-${subname}"
+
+ ts_init_subtest $subtestname
+ cols=$(cat $cols_file)
+ ${TS_CMD_LSBLK} --sysroot "${dumpdir}/${name}" \
+ --output $cols \
+ >> ${TS_OUTPUT} 2>> $TS_ERRLOG
+
+ ts_finalize_subtest
+ done
+done
+
+ts_finalize
+