1#!/usr/local/bin/ksh93 -p
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26
27. $STF_SUITE/include/libtest.kshlib
28. $STF_SUITE/tests/cachefile/cachefile.kshlib
29
30################################################################################
31#
32# __stc_assertion_start
33#
34# ID: cachefile_002_pos
35#
36# DESCRIPTION:
37#
38# Importing a pool with "cachefile" set doesn't update zpool.cache
39#
40# STRATEGY:
41# 1. Create a pool with the cachefile property set
42# 2. Verify the pool doesn't have an entry in zpool.cache
43# 3. Export the pool
44# 4. Import the pool
45# 5. Verify the pool does have an entry in zpool.cache
46# 6. Export the pool
47# 7. Import the pool -o cachefile=<cachefile>
48# 8. Verify the pool doesn't have an entry in zpool.cache
49#
50# TESTABILITY: explicit
51#
52# TEST_AUTOMATION_LEVEL: automated
53#
54# CODING_STATUS: COMPLETED (2007-09-05)
55#
56# __stc_assertion_end
57#
58################################################################################
59
60function cleanup
61{
62	destroy_pool $TESTPOOL
63}
64
65verify_runnable "global"
66
67log_assert "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
68log_onexit cleanup
69
70log_must $ZPOOL create -o cachefile=none $TESTPOOL $DISKS
71typeset DEVICEDIR=$(get_device_dir $DISKS)
72log_mustnot pool_in_cache $TESTPOOL
73
74log_must $ZPOOL export $TESTPOOL
75log_must $ZPOOL import -d $DEVICEDIR $TESTPOOL
76log_must pool_in_cache $TESTPOOL
77
78log_must $ZPOOL export $TESTPOOL
79log_must $ZPOOL import -o cachefile=none -d $DEVICEDIR $TESTPOOL
80log_mustnot pool_in_cache $TESTPOOL
81
82log_must $ZPOOL export $TESTPOOL
83log_must $ZPOOL import -o cachefile=$CPATH -d $DEVICEDIR $TESTPOOL
84log_must pool_in_cache $TESTPOOL
85
86log_pass "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
87
88