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 label change tests



details:   https://anonhg.NetBSD.org/src/rev/276f8e18a8cc
branches:  trunk
changeset: 342069:276f8e18a8cc
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 04 17:15:21 2015 +0000

description:
Add label change tests

diffstat:

 tests/sbin/gpt/Makefile             |   7 +++--
 tests/sbin/gpt/gpt.2part.show.label |   8 +++++++
 tests/sbin/gpt/t_gpt.sh             |  39 ++++++++++++++++++++++++++++++++++++-
 3 files changed, 50 insertions(+), 4 deletions(-)

diffs (98 lines):

diff -r 6089ea4d7fa0 -r 276f8e18a8cc tests/sbin/gpt/Makefile
--- a/tests/sbin/gpt/Makefile   Fri Dec 04 16:59:57 2015 +0000
+++ b/tests/sbin/gpt/Makefile   Fri Dec 04 17:15:21 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2015/12/04 16:59:39 christos Exp $
+# $NetBSD: Makefile,v 1.5 2015/12/04 17:15:21 christos Exp $
 
 .include <bsd.own.mk>
 
@@ -7,7 +7,8 @@
 TESTS_SH=      t_gpt
 
 FILESDIR=       ${TESTSDIR}
-FILES=          gpt.2part.show.uuid gpt.2part.show.normal gpt.empty.show.normal
-FILES+=                gpt.backup gpt.resizedisk.show.normal gpt.resizepart.show.normal
+FILES=         gpt.empty.show.normal gpt.backup gpt.removepart.show.normal
+FILES=          gpt.2part.show.uuid gpt.2part.show.normal gpt.2part.show.label
+FILES+=                gpt.resizedisk.show.normal gpt.resizepart.show.normal
 
 .include <bsd.test.mk>
diff -r 6089ea4d7fa0 -r 276f8e18a8cc tests/sbin/gpt/gpt.2part.show.label
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/sbin/gpt/gpt.2part.show.label       Fri Dec 04 17:15:21 2015 +0000
@@ -0,0 +1,8 @@
+  start   size  index  contents
+      0      1         PMBR
+      1      1         Pri GPT header
+      2     32         Pri GPT table
+     34   1024      1  GPT part - potato
+   1058   9150      2  GPT part - tomato
+  10208     32         Sec GPT table
+  10240      1         Sec GPT header
diff -r 6089ea4d7fa0 -r 276f8e18a8cc tests/sbin/gpt/t_gpt.sh
--- a/tests/sbin/gpt/t_gpt.sh   Fri Dec 04 16:59:57 2015 +0000
+++ b/tests/sbin/gpt/t_gpt.sh   Fri Dec 04 17:15:21 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_gpt.sh,v 1.5 2015/12/04 16:59:39 christos Exp $
+# $NetBSD: t_gpt.sh,v 1.6 2015/12/04 17:15:21 christos Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -66,6 +66,14 @@
        echo "^$disk: Partition $1 resized: $2 $3\$"
 }
 
+partremmsg() {
+       echo "^$disk: Partition $1 removed\$"
+}
+
+partlblmsg() {
+       echo "^$disk: Partition $1 label changed\$"
+}
+
 recovermsg() {
        echo "^$disk: Recovered $1 GPT [a-z]* from $2\$"
 }
@@ -160,12 +168,41 @@
            gpt show $disk
 }
 
+atf_test_case remove_2part
+remove_2part_head() {
+       atf_set "descr" "Remove a partition from a 2 partition disk"
+}
+
+remove_2part_body() {
+       prepare_2part
+       atf_check -s exit:0 -o match:"$(partremmsg 1)" -e empty gpt remove \
+           -i 1 $disk
+       atf_check -s exit:0 -o file:"$src/gpt.removepart.show.normal" \
+           gpt show $disk
+}
+
+atf_test_case label_2part
+label_2part_head() {
+       atf_set "descr" "Label partitions in 2 partition disk"
+}
+
+label_2part_body() {
+       prepare_2part
+       atf_check -s exit:0 -o match:"$(partlblmsg 1)" -e empty \
+           gpt label -i 1 -l potato $disk
+       atf_check -s exit:0 -o match:"$(partlblmsg 2)" -e empty \
+           gpt label -i 2 -l tomato $disk
+       atf_check -s exit:0 -o file:"$src/gpt.2part.show.label" gpt show -l $disk
+}
+
 atf_init_test_cases() {
        atf_add_test_case create_empty
        atf_add_test_case create_2part
        atf_add_test_case backup_2part
+       atf_add_test_case remove_2part
        atf_add_test_case restore_2part
        atf_add_test_case recover_backup
        atf_add_test_case recover_primary
        atf_add_test_case resize_2part
+       atf_add_test_case label_2part
 }



Home | Main Index | Thread Index | Old Index