]> err.no Git - util-linux/commitdiff
tests: add regression tests
authorDavidlohr Bueso <dave@gnu.org>
Thu, 9 Dec 2010 21:56:55 +0000 (22:56 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 9 Dec 2010 21:56:55 +0000 (22:56 +0100)
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/commands.sh.in
tests/expected/partx/partx-bsd [new file with mode: 0644]
tests/expected/partx/partx-dos+bsd [new file with mode: 0644]
tests/expected/partx/partx-gpt [new file with mode: 0644]
tests/expected/partx/partx-sgi [new file with mode: 0644]
tests/expected/partx/partx-sun [new file with mode: 0644]
tests/ts/partx/partx [new file with mode: 0755]

index 94f6521e85ff9bf0c3659fda62a4145829c5a266..2f3bd04dd63695b8c5dcf36c119a23d07696ec91 100644 (file)
@@ -49,5 +49,6 @@ TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"$TOPDIR/hwclock/hwclock"}
 TS_CMD_LSCPU=${TS_CMD_LSCPU-"$TOPDIR/sys-utils/lscpu"}
 
 TS_CMD_BLKID=${TS_CMD_BLKID-"$TOPDIR/misc-utils/blkid"}
+TS_CMD_PARTX=${TS_CMD_PARTX-"$TOPDIR/partx/partx"}
 
 TS_CMD_FDISK=${TS_CMD_FDISK-"$TOPDIR/fdisk/fdisk"}
diff --git a/tests/expected/partx/partx-bsd b/tests/expected/partx/partx-bsd
new file mode 100644 (file)
index 0000000..d4be5c5
--- /dev/null
@@ -0,0 +1,2 @@
+# 1:      7936-    12799 (     4864 sectors,      2 MB)
+# 2:     12544-    16127 (     3584 sectors,      1 MB)
diff --git a/tests/expected/partx/partx-dos+bsd b/tests/expected/partx/partx-dos+bsd
new file mode 100644 (file)
index 0000000..3242a6c
--- /dev/null
@@ -0,0 +1,4 @@
+# 1:        32-     7679 (     7648 sectors,      3 MB)
+# 2:      7680-    16383 (     8704 sectors,      4 MB)
+# 5:      7936-    12799 (     4864 sectors,      2 MB)
+# 6:     12544-    16127 (     3584 sectors,      1 MB)
diff --git a/tests/expected/partx/partx-gpt b/tests/expected/partx/partx-gpt
new file mode 100644 (file)
index 0000000..0a1d491
--- /dev/null
@@ -0,0 +1,5 @@
+# 1:        34-     2047 (     2014 sectors,      1 MB)
+# 2:      2048-     4095 (     2048 sectors,      1 MB)
+# 3:      4096-     6143 (     2048 sectors,      1 MB)
+# 4:      6144-     8191 (     2048 sectors,      1 MB)
+# 5:      8192-    10239 (     2048 sectors,      1 MB)
diff --git a/tests/expected/partx/partx-sgi b/tests/expected/partx/partx-sgi
new file mode 100644 (file)
index 0000000..469d442
--- /dev/null
@@ -0,0 +1,2 @@
+# 1:        63-  1606499 (  1606437 sectors,    822 MB)
+# 2:   1606500- 32129999 ( 30523500 sectors,  15628 MB)
diff --git a/tests/expected/partx/partx-sun b/tests/expected/partx/partx-sun
new file mode 100644 (file)
index 0000000..d957f58
--- /dev/null
@@ -0,0 +1,2 @@
+# 1:         0-    87379 (    87380 sectors,     44 MB)
+# 2:     87380-   131069 (    43690 sectors,     22 MB)
diff --git a/tests/ts/partx/partx b/tests/ts/partx/partx
new file mode 100755 (executable)
index 0000000..5b3b450
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010 Davidlohr Bueso <dave@gnu.org>
+#
+# This file is part of util-linux-ng.
+#
+# 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 2 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.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="partitions probing"
+TS_IMGDIR="$TS_TOPDIR/ts/blkid/images-pt"
+
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+
+if [ ! -x "$TS_CMD_PARTX" ]; then
+       ts_skip "partx disabled"
+fi
+
+mkdir -p $TS_OUTDIR/images-pt
+
+for img in $(ls $TS_IMGDIR/*.img.bz2 | sort); do
+       name=$(basename $img .img.bz2)
+       outimg=$TS_OUTDIR/images-pt/${name}.img
+
+       ts_init_subtest $name
+
+       bunzip2 < $img > $outimg
+
+       $TS_CMD_PARTX $outimg &> $TS_OUTPUT
+       ts_finalize_subtest
+done
+
+ts_finalize