Print this page
NEX-3974 Remove timing issues so the robot can run consistently
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
4206 history_003_pos relies on exact size of history log and entries
4207 history_008_pos depends on obsolete internal history log message
4208 Typo in zfs_main.c: "posxiuser"
4209 Populate zfstest with the remainder of the STF tests
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Eric Diven <eric.diven@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/cache/cache.kshlib
+++ new/usr/src/test/zfs-tests/tests/functional/cache/cache.kshlib
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 26
27 27 #
28 28 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
29 +# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
29 30 #
30 31
31 32 . $STF_SUITE/include/libtest.shlib
32 33
33 34 function cleanup
34 35 {
35 36 if datasetexists $TESTPOOL ; then
36 - log_must zpool destroy -f $TESTPOOL
37 + log_must destroy_pool $TESTPOOL
37 38 fi
38 39 if datasetexists $TESTPOOL2 ; then
39 - log_must zpool destroy -f $TESTPOOL2
40 + log_must destroy_pool $TESTPOOL2
40 41 fi
41 42 }
42 43
43 44 #
44 45 # Try zpool status/iostat for given pool
45 46 #
46 47 # $1 pool
47 48 #
48 49 function display_status
49 50 {
50 51 typeset pool=$1
51 52
52 53 typeset -i ret=0
53 54 zpool status -xv $pool > /dev/null 2>&1
54 55 ret=$?
55 56
56 57 zpool iostat > /dev/null 2>&1
57 58 ((ret |= $?))
58 59
59 60 typeset mntpnt=$(get_prop mountpoint $pool)
60 61 dd if=/dev/random of=$mntpnt/testfile.$$ &
61 62 typeset pid=$!
62 63
63 64 zpool iostat -v 1 3 > /dev/null
64 65 ((ret |= $?))
65 66
66 67 kill -9 $pid
67 68
68 69 return $ret
69 70 }
70 71
71 72 #
72 73 # Verify the given cache device have correct type and status
73 74 #
74 75 # $1 pool name
75 76 # $2 device name
76 77 # $3 device status
77 78 # $4 device type
78 79 #
79 80 function verify_cache_device
80 81 {
81 82 typeset pool=$1
82 83 typeset device=$2
83 84 typeset status=$3
84 85 typeset type=$4
85 86
86 87 if [[ -z $pool || -z $device || -z $status ]]; then
87 88 log_fail "Usage: verify_cache_device <pool> <device> " \
88 89 "<status> [type]"
89 90 fi
90 91
91 92 #
92 93 # Get all the cache devices and status table like below
93 94 #
94 95 # mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
95 96 #
96 97 set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
97 98 /\tcache/ {start=1}
98 99 /\tmirror/ || /\tspares/ || /^$/ {start=0}
99 100 (start==1) && /\t (\/|[a-zA-Z])/ \
100 101 {print "stripe:" $1 " " $2}
101 102 (start==1) && /\t (\/|[a-zA-Z])/ \
102 103 {print "mirror:" $1 " " $2}
103 104 # When hotspare is replacing
104 105 (start==1) && /\t (\/|[a-zA-Z])/ \
105 106 {print "mirror:" $1 " " $2}'
106 107 )
107 108
108 109 typeset -i i=0
109 110 typeset find=0
110 111 while (( i < ${#dev_stat_tab[@]} )); do
111 112 typeset dev=${dev_stat_tab[$i]}
112 113 typeset stat=${dev_stat_tab[((i+1))]}
113 114
114 115 case $dev in
115 116 stripe:$device)
116 117 if [[ "$type" == 'mirror' ]]; then
117 118 log_note "Unexpected type: mirror"
118 119 return 1
119 120 else
120 121 if [[ $stat != $status ]]; then
121 122 log_note "Status($stat) " \
122 123 "!= Expected stat($status)"
123 124 return 1
124 125 fi
125 126 return 0
126 127 fi
127 128 ;;
128 129 mirror:$device)
129 130 if [[ -z "$type" || $type == 'stripe' ]]; then
130 131 log_note "Unexpected type: stripe"
131 132 return 1
132 133 else
133 134 if [[ $stat != $status ]]; then
134 135 log_note "Status($stat) " \
135 136 "!= Expected stat($status)"
136 137 return 1
137 138 fi
138 139 return 0
139 140 fi
140 141 ;;
141 142 esac
142 143 ((i += 2))
143 144 done
144 145
145 146 log_note "Can not find device: $device"
146 147 return 1
147 148 }
148 149
149 150 function verify_cache_support
150 151 {
151 152 zpool upgrade -v | grep "Cache devices" > /dev/null 2>&1
152 153 return $?
153 154 }
|
↓ open down ↓ |
104 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX