From: Davidlohr Bueso Date: Thu, 9 Dec 2010 21:56:55 +0000 (+0100) Subject: tests: add regression tests X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9894961bf9f63367a13e4fac5652c87ee75c3782;p=util-linux tests: add regression tests Signed-off-by: Davidlohr Bueso Signed-off-by: Karel Zak --- diff --git a/tests/commands.sh.in b/tests/commands.sh.in index 94f6521e..2f3bd04d 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -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 index 00000000..d4be5c59 --- /dev/null +++ b/tests/expected/partx/partx-bsd @@ -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 index 00000000..3242a6cd --- /dev/null +++ b/tests/expected/partx/partx-dos+bsd @@ -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 index 00000000..0a1d491c --- /dev/null +++ b/tests/expected/partx/partx-gpt @@ -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 index 00000000..469d4422 --- /dev/null +++ b/tests/expected/partx/partx-sgi @@ -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 index 00000000..d957f584 --- /dev/null +++ b/tests/expected/partx/partx-sun @@ -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 index 00000000..5b3b450c --- /dev/null +++ b/tests/ts/partx/partx @@ -0,0 +1,45 @@ +#!/bin/bash + +# +# Copyright (C) 2010 Davidlohr Bueso +# +# 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