Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/sbin/gpt Add resize test.



details:   https://anonhg.NetBSD.org/src/rev/0a8dfe4552de
branches:  trunk
changeset: 342067:0a8dfe4552de
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 04 16:59:39 2015 +0000

description:
Add resize test.

diffstat:

 tests/sbin/gpt/Makefile |   4 ++--
 tests/sbin/gpt/t_gpt.sh |  31 +++++++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 6 deletions(-)

diffs (92 lines):

diff -r 605840c7c236 -r 0a8dfe4552de tests/sbin/gpt/Makefile
--- a/tests/sbin/gpt/Makefile   Fri Dec 04 16:54:28 2015 +0000
+++ b/tests/sbin/gpt/Makefile   Fri Dec 04 16:59:39 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2015/12/04 01:42:47 christos Exp $
+# $NetBSD: Makefile,v 1.4 2015/12/04 16:59:39 christos Exp $
 
 .include <bsd.own.mk>
 
@@ -8,6 +8,6 @@
 
 FILESDIR=       ${TESTSDIR}
 FILES=          gpt.2part.show.uuid gpt.2part.show.normal gpt.empty.show.normal
-FILES+=                gpt.backup
+FILES+=                gpt.backup gpt.resizedisk.show.normal gpt.resizepart.show.normal
 
 .include <bsd.test.mk>
diff -r 605840c7c236 -r 0a8dfe4552de tests/sbin/gpt/t_gpt.sh
--- a/tests/sbin/gpt/t_gpt.sh   Fri Dec 04 16:54:28 2015 +0000
+++ b/tests/sbin/gpt/t_gpt.sh   Fri Dec 04 16:59:39 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_gpt.sh,v 1.4 2015/12/04 01:42:47 christos Exp $
+# $NetBSD: t_gpt.sh,v 1.5 2015/12/04 16:59:39 christos Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -29,6 +29,7 @@
 #
 
 size=10240
+newsize=20480
 shdr=34
 disk=gpt.disk
 uuid="........-....-....-....-............"
@@ -43,9 +44,9 @@
 prepare_2part() {
        prepare
        atf_check -s exit:0 -o empty -e empty gpt create $disk
-       atf_check -s exit:0 -o match:"$(partmsg 1 34 1024)" -e empty \
+       atf_check -s exit:0 -o match:"$(partaddmsg 1 34 1024)" -e empty \
            gpt add -t efi -s 1024 $disk
-       atf_check -s exit:0 -o match:"$(partmsg 2 1058 9150)" -e empty \
+       atf_check -s exit:0 -o match:"$(partaddmsg 2 1058 9150)" -e empty \
            gpt add $disk
 }
 
@@ -57,10 +58,14 @@
            -e empty gpt show -u $disk
 }
 
-partmsg() {
+partaddmsg() {
        echo "^$disk: Partition $1 added: $uuid $2 $3\$"
 }
 
+partresmsg() {
+       echo "^$disk: Partition $1 resized: $2 $3\$"
+}
+
 recovermsg() {
        echo "^$disk: Recovered $1 GPT [a-z]* from $2\$"
 }
@@ -138,6 +143,23 @@
        check_2part
 }
 
+atf_test_case resize_2part
+resize_2part_head() {
+       atf_set "descr" "Resize a 2 partition disk and partition"
+}
+
+resize_2part_body() {
+       prepare_2part
+       dd conv=notrunc if=/dev/zero of=$disk seek=$newsize count=1
+       atf_check -s exit:0 -o empty -e empty gpt resizedisk $disk
+       atf_check -s exit:0 -o file:"$src/gpt.resizedisk.show.normal" \
+           gpt show $disk
+       atf_check -s exit:0 -o match:"$(partresmsg 2 1058 19390)" \
+           -e empty gpt resize -i 2 $disk
+       atf_check -s exit:0 -o file:"$src/gpt.resizepart.show.normal" \
+           gpt show $disk
+}
+
 atf_init_test_cases() {
        atf_add_test_case create_empty
        atf_add_test_case create_2part
@@ -145,4 +167,5 @@
        atf_add_test_case restore_2part
        atf_add_test_case recover_backup
        atf_add_test_case recover_primary
+       atf_add_test_case resize_2part
 }



Home | Main Index | Thread Index | Old Index