Module Name:    src
Committed By:   christos
Date:           Fri Dec  4 17:15:21 UTC 2015

Modified Files:
        src/tests/sbin/gpt: Makefile t_gpt.sh
Added Files:
        src/tests/sbin/gpt: gpt.2part.show.label

Log Message:
Add label change tests


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/gpt/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/sbin/gpt/gpt.2part.show.label
cvs rdiff -u -r1.5 -r1.6 src/tests/sbin/gpt/t_gpt.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/sbin/gpt/Makefile
diff -u src/tests/sbin/gpt/Makefile:1.4 src/tests/sbin/gpt/Makefile:1.5
--- src/tests/sbin/gpt/Makefile:1.4	Fri Dec  4 11:59:39 2015
+++ src/tests/sbin/gpt/Makefile	Fri Dec  4 12:15:21 2015
@@ -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 @@ TESTSDIR=	${TESTSBASE}/sbin/gpt
 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>

Index: src/tests/sbin/gpt/t_gpt.sh
diff -u src/tests/sbin/gpt/t_gpt.sh:1.5 src/tests/sbin/gpt/t_gpt.sh:1.6
--- src/tests/sbin/gpt/t_gpt.sh:1.5	Fri Dec  4 11:59:39 2015
+++ src/tests/sbin/gpt/t_gpt.sh	Fri Dec  4 12:15:21 2015
@@ -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 @@ partresmsg() {
 	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 @@ resize_2part_body() {
 	    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
 }

Added files:

Index: src/tests/sbin/gpt/gpt.2part.show.label
diff -u /dev/null src/tests/sbin/gpt/gpt.2part.show.label:1.1
--- /dev/null	Fri Dec  4 12:15:21 2015
+++ src/tests/sbin/gpt/gpt.2part.show.label	Fri Dec  4 12:15:21 2015
@@ -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

Reply via email to