svn commit: r292363 - projects/zfsd/head/tests/sys/cddl/zfs/tests/cache

Alan Somers asomers at FreeBSD.org
Wed Dec 16 20:48:15 UTC 2015


Author: asomers
Date: Wed Dec 16 20:48:13 2015
New Revision: 292363
URL: https://svnweb.freebsd.org/changeset/base/292363

Log:
  Fix cache_009_pos test on sm4u-2.
  
  	- Fix issues with verify_cache_device():
  	- Don't assume the device name is at most 3 characters long.
  	- While here, clean up the awk script so it is more legible.
  	- cleanup: Dump the final pool configurations if they exist, for all
  	  tests in this suite.
  
  Submitted by:	Will
  Sponsored by:	Spectra Logic Corp

Modified:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib	Wed Dec 16 20:45:28 2015	(r292362)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib	Wed Dec 16 20:48:13 2015	(r292363)
@@ -30,6 +30,9 @@
 
 function cleanup
 {
+	log_note "Final pool configurations:"
+	poolexists $TESTPOOL && log_must $ZPOOL status -v $TESTPOOL
+	poolexists $TESTPOOL2 && log_must $ZPOOL status -v $TESTPOOL2
 	destroy_pool $TESTPOOL
 	destroy_pool $TESTPOOL2
 }
@@ -104,24 +107,33 @@ function verify_cache_device
 				function parse_name(status)
 				{
 					if (status == "OFFLINE")
-						return substr($7,6,3)
+						return substr($7,6)
 					else if (status == "UNAVAIL")
-						return substr($7,6,3)
+						return substr($7,6)
 					else
 						return $1
 				}
 
-				BEGIN {start=0} \
-				/\tcache/ {start=1}
-				/\tmirror/ || /\tspares/ || /^$/ {start=0}
-				(start==1) && /\t  (\/|[0-9a-zA-Z])/ \
-					{print "stripe:" parse_name($2) " " $2}
-				(start==1) && /\t    (\/|[a-zA-Z])/ \
-					{print "mirror:" parse_name($2) " " $2}
+				BEGIN {in_cache=0}
+				/\tcache/ {in_cache=1}
+				/\tlog/ || /\tspares/ || /^$/ {in_cache=0}
+
+				# Skip if not in a cache section
+				(in_cache==0) { next; }
+
+				/\t  (\/|[0-9a-zA-Z])/ {
+					print "stripe:" parse_name($2) " " $2;
+				}
+
+				/\t    (\/|[a-zA-Z])/ {
+					print "mirror:" parse_name($2) " " $2;
+				}
+
 				# When hotspare is replacing
-				(start==1) && /\t      (\/|[a-zA-Z])/ \
-					{print "mirror:" parse_name($2) " " $2}'
-			     )
+				/\t      (\/|[a-zA-Z])/ {
+					print "mirror:" parse_name($2) " " $2;
+				}
+	')
 
 	typeset -i i=0
 	typeset find=0


More information about the svn-src-projects mailing list