changeset 21428:bbdf6d2b20bb

11201 zfs test zpool_create_020_pos leaves a directory behind Reviewed by: John Kennedy <john.kennedy@delphix.com> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
author Kody Kantor <kody@kkantor.com>
date Wed, 05 Jun 2019 14:43:28 +0000
parents dfcb8f75275b
children 01a16a874588
files usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh	Wed Jun 05 15:36:43 2019 -0400
+++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh	Wed Jun 05 14:43:28 2019 +0000
@@ -27,6 +27,7 @@
 
 #
 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+# Copyright 2019 Joyent, Inc.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -49,12 +50,14 @@
 	if poolexists $TESTPOOL ; then
                 destroy_pool $TESTPOOL
         fi
-	if [ -d ${TESTPOOL}.root ]
+	if [ -d $TESTPOOL_DIR ]
 	then
-		log_must rmdir ${TESTPOOL}.root
+		log_must rmdir $TESTPOOL_DIR
 	fi
 }
 
+TESTPOOL_DIR=/${TESTPOOL}.root
+
 log_onexit cleanup
 
 log_assert "zpool create -R works as expected"
@@ -65,17 +68,17 @@
 	disk=$DISK0
 fi
 
-log_must mkdir /${TESTPOOL}.root
-log_must zpool create -R /${TESTPOOL}.root $TESTPOOL $disk
-if [ ! -d /${TESTPOOL}.root ]
+log_must mkdir $TESTPOOL_DIR
+log_must zpool create -R $TESTPOOL_DIR $TESTPOOL $disk
+if [ ! -d $TESTPOOL_DIR ]
 then
-	log_fail "Mountpoint was not create when using zpool with -R flag!"
+	log_fail "Mountpoint was not created when using zpool with -R flag!"
 fi
 
 FS=$(zfs list $TESTPOOL)
 if [ -z "$FS" ]
 then
-	log_fail "Mounted filesystem at /${TESTPOOL}.root isn't ZFS!"
+	log_fail "Mounted filesystem at $TESTPOOL_DIR isn't ZFS!"
 fi
 
 log_must zpool get all $TESTPOOL
@@ -89,7 +92,7 @@
 fi
 
 # check that the root = /mountpoint property is set correctly
-grep "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" /tmp/values.$$ > /dev/null 2>&1
+grep "$TESTPOOL[ ]*altroot[ ]*$TESTPOOL_DIR" /tmp/values.$$ > /dev/null 2>&1
 if [ $? -ne 0 ]
 then
 	log_fail "zpool property root was not found in pool output."