1#!/bin/ksh -p 2# 3# This file and its contents are supplied under the terms of the 4# Common Development and Distribution License ("CDDL"), version 1.0. 5# You may only use this file in accordance with the terms of version 6# 1.0 of the CDDL. 7# 8# A full copy of the text of the CDDL should have accompanied this 9# source. A copy of the CDDL is also available via the Internet at 10# http://www.illumos.org/license/CDDL. 11# 12 13# 14# Copyright 2018, loli10K <ezomori.nozomu@gmail.com>. All rights reserved. 15# 16 17. $STF_SUITE/include/libtest.shlib 18 19# 20# DESCRIPTION: 21# 'zpool create -t <tempname>' can create a pool with the specified temporary 22# name. The pool should be present in the namespace as <tempname> until exported 23# 24# STRATEGY: 25# 1. Create a pool with '-t' option 26# 2. Verify the pool is created with the specified temporary name 27# 28 29verify_runnable "global" 30 31function cleanup 32{ 33 destroy_pool $TESTPOOL 34 destroy_pool $TEMPPOOL 35 36} 37 38log_assert "'zpool create -t <tempname>' can create a pool with the specified" \ 39 " temporary name." 40log_onexit cleanup 41 42TEMPPOOL="tempname.$$" 43typeset poolprops=('comment=text' 'listsnapshots=on' 'autoexpand=on' 44 'autoreplace=on' 'delegation=off' 'failmode=continue') 45typeset fsprops=('canmount=off' 'mountpoint=none' 'utf8only=on' 46 'casesensitivity=mixed' 'version=1' 'normalization=formKD') 47 48for poolprop in "${poolprops[@]}"; do 49 for fsprop in "${fsprops[@]}"; do 50 # 1. Create a pool with '-t' option 51 log_must zpool create -t $TEMPPOOL \ 52 -O $fsprop -o $poolprop $TESTPOOL $DISKS 53 # 2. Verify the pool is created with the specified temporary name 54 log_must poolexists $TEMPPOOL 55 log_mustnot poolexists $TESTPOOL 56 propname="$(awk -F= '{print $1}' <<< $fsprop)" 57 propval="$(awk -F= '{print $2}' <<< $fsprop)" 58 log_must test "$(get_prop $propname $TEMPPOOL)" == "$propval" 59 propname="$(awk -F= '{print $1}' <<< $poolprop)" 60 propval="$(awk -F= '{print $2}' <<< $poolprop)" 61 log_must test "$(get_pool_prop $propname $TEMPPOOL)" == "$propval" 62 # Cleanup 63 destroy_pool $TEMPPOOL 64 done 65done 66 67log_pass "'zpool create -t <tempname>' successfully creates pools with" \ 68 " temporary names" 69