svn commit: r329042 - in projects/zfsd/head: etc/mtree tests/sys/cddl/zfs/tests/mmap tests/sys/cddl/zfs/tests/mmap/mmap_read tests/sys/cddl/zfs/tests/mmap/mmap_write

Alan Somers asomers at FreeBSD.org
Thu Feb 8 21:55:48 UTC 2018


Author: asomers
Date: Thu Feb  8 21:55:46 2018
New Revision: 329042
URL: https://svnweb.freebsd.org/changeset/base/329042

Log:
  Collapse the ZFS mmap tests into a single directory
  
  Sponsored by:	Spectra Logic Corp

Added:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/cleanup.ksh
     - copied unchanged from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/cleanup.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap.cfg
     - copied unchanged from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read.cfg
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read_001_pos.ksh
     - copied unchanged from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read_001_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_test.sh   (contents, props changed)
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write_001_pos.ksh
     - copied unchanged from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/mmap_write_001_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/setup.ksh
     - copied unchanged from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/setup.ksh
Deleted:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/
Modified:
  projects/zfsd/head/etc/mtree/BSD.tests.dist
  projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/Makefile

Modified: projects/zfsd/head/etc/mtree/BSD.tests.dist
==============================================================================
--- projects/zfsd/head/etc/mtree/BSD.tests.dist	Thu Feb  8 21:38:57 2018	(r329041)
+++ projects/zfsd/head/etc/mtree/BSD.tests.dist	Thu Feb  8 21:55:46 2018	(r329042)
@@ -596,10 +596,6 @@
                     migration
                     ..
                     mmap
-                        mmap_read
-                        ..
-                        mmap_write
-                        ..
                     ..
                     mount
                     ..

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/Makefile
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/Makefile	Thu Feb  8 21:38:57 2018	(r329041)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/Makefile	Thu Feb  8 21:55:46 2018	(r329042)
@@ -2,9 +2,16 @@
 
 .include <src.opts.mk>
 
+PACKAGE=tests
 TESTSDIR=${TESTSBASE}/sys/cddl/zfs/tests/mmap
+FILESDIR=${TESTSDIR}
 
-TESTS_SUBDIRS+=	mmap_read
-TESTS_SUBDIRS+=	mmap_write
+ATF_TESTS_KSH93+=	mmap_test
+
+${PACKAGE}FILES+=	cleanup.ksh
+${PACKAGE}FILES+=	mmap.cfg
+${PACKAGE}FILES+=	mmap_read_001_pos.ksh
+${PACKAGE}FILES+=	mmap_write_001_pos.ksh
+${PACKAGE}FILES+=	setup.ksh
 
 .include <bsd.test.mk>

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/cleanup.ksh (from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/cleanup.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/cleanup.ksh	Thu Feb  8 21:55:46 2018	(r329042, copy of r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/cleanup.ksh)
@@ -0,0 +1,32 @@
+#!/usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)cleanup.ksh	1.2	07/01/09 SMI"
+#
+
+. $STF_SUITE/include/libtest.kshlib
+
+default_cleanup

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap.cfg (from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read.cfg)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap.cfg	Thu Feb  8 21:55:46 2018	(r329042, copy of r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read.cfg)
@@ -0,0 +1,30 @@
+# vim: filetype=sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)mmap_read.cfg	1.3	08/08/15 SMI"
+#
+
+export TESTFILE=testfile${TESTCASE_ID}

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read_001_pos.ksh (from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read_001_pos.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read_001_pos.ksh	Thu Feb  8 21:55:46 2018	(r329042, copy of r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read_001_pos.ksh)
@@ -0,0 +1,67 @@
+#!/usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)mmap_read_001_pos.ksh	1.3	09/01/12 SMI"
+#
+. $STF_SUITE/include/libtest.kshlib
+
+###########################################################################
+#
+# __stc_assertion_start
+#
+# ID: read_mmap_001_pos
+#
+# DESCRIPTION:
+# read()s from mmap()'ed file contain correct data.
+#
+# STRATEGY:
+# 1. Create a pool & dataset
+# 2. Call readmmap binary
+# 3. unmount this file system
+# 4. Verify the integrity of this pool & dateset
+#
+# TESTABILITY: explicit
+#
+# TEST_AUTOMATION_LEVEL: automated
+#
+# CODING_STATUS: COMPLETED (2005-07-04)
+#
+# __stc_assertion_end
+#
+################################################################################
+
+verify_runnable "global"
+
+log_assert "read()s from mmap()'ed file contain correct data."
+
+log_must $CHMOD 777 $TESTDIR 
+log_must $READMMAP $TESTDIR/$TESTFILE
+log_must $ZFS unmount $TESTPOOL/$TESTFS
+
+typeset dir=$(get_device_dir $DISKS)
+verify_filesys "$TESTPOOL" "$TESTPOOL/$TESTFS" "$dir"
+
+log_pass "read(2) calls from a mmap(2)'ed file succeeded."

Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_test.sh	Thu Feb  8 21:55:46 2018	(r329042)
@@ -0,0 +1,78 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2012 Spectra Logic.  All rights reserved.
+# Use is subject to license terms.
+#
+
+
+atf_test_case mmap_read_001_pos cleanup
+mmap_read_001_pos_head()
+{
+	atf_set "descr" "read()s from mmap()'ed file contain correct data."
+	atf_set "require.progs"  zfs zdb
+}
+mmap_read_001_pos_body()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/mmap.cfg
+
+	verify_disk_count "$DISKS" 1
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/mmap_read_001_pos.ksh || atf_fail "Testcase failed"
+}
+mmap_read_001_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/mmap.cfg
+
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+atf_test_case mmap_write_001_pos cleanup
+mmap_write_001_pos_head()
+{
+	atf_set "descr" "write()s to a file and mmap() that file at the same time does notresult in a deadlock."
+}
+mmap_write_001_pos_body()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/mmap.cfg
+
+	verify_disk_count "$DISKS" 1
+	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
+	ksh93 $(atf_get_srcdir)/mmap_write_001_pos.ksh || atf_fail "Testcase failed"
+}
+mmap_write_001_pos_cleanup()
+{
+	. $(atf_get_srcdir)/../../include/default.cfg
+	. $(atf_get_srcdir)/mmap.cfg
+
+	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
+}
+
+
+atf_init_test_cases()
+{
+
+	atf_add_test_case mmap_read_001_pos
+	atf_add_test_case mmap_write_001_pos
+}

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write_001_pos.ksh (from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/mmap_write_001_pos.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write_001_pos.ksh	Thu Feb  8 21:55:46 2018	(r329042, copy of r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/mmap_write_001_pos.ksh)
@@ -0,0 +1,91 @@
+#!/usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)mmap_write_001_pos.ksh	1.3	07/07/31 SMI"
+#
+. $STF_SUITE/include/libtest.kshlib
+
+# ##########################################################################
+#
+# __stc_assertion_start
+#
+# ID: mmap_write_001_pos
+#
+# DESCRIPTION:
+# Writing to a file and mmaping that file at the
+# same time does not result in a deadlock.
+#
+# STRATEGY:
+# 1. Make sure this test executes on multi-processes system.
+# 2. Call mmapwrite binary.
+# 3. wait 120s and make sure the test file existed.
+#
+# TESTABILITY: explicit
+#
+# TEST_AUTOMATION_LEVEL: automated
+#
+# CODING_STATUS: COMPLETED (2005-07-04)
+#
+# __stc_assertion_end
+#
+################################################################################
+
+verify_runnable "both"
+
+# Default is 120 seconds or 2 minutes
+WAITTIME=${WAITTIME-120}
+
+log_assert "write()s to a file and mmap() that file at the same time does not "\
+	"result in a deadlock."
+
+# Detect and make sure this test must be executed on a multi-process system
+NCPUS=`sysctl -a | awk -F '"' '/cpu count="[0-9+]"/ {print $2; exit}'`
+if [[ $? -ne 0 || -z $NCPUS || $NCPUS -le 1 ]]; then
+	log_unsupported "This test must be executed on a multi-processor system."
+fi
+
+log_must $CHMOD 777 $TESTDIR
+$MMAPWRITE $TESTDIR/$TESTFILE &
+PID_MMAPWRITE=$!
+log_note "$MMAPWRITE $TESTDIR/$TESTFILE pid: $PID_MMAPWRITE"
+log_must $SLEEP 10
+
+typeset -i i=0
+while (( i < $WAITTIME )); do
+	if ! $PS -ef | $PGREP $MMAPWRITE > /dev/null ; then
+		log_must $WAIT $PID_MMAPWRITE
+		break
+	fi
+	$SLEEP 1
+	(( i += 1 ))
+done
+
+if $PS -ef | $PGREP $MMAPWRITE > /dev/null ; then
+	log_must $KILL -9 $PID_MMAPWRITE
+fi
+log_must $LS -l $TESTDIR/$TESTFILE
+
+log_pass "write(2) a mmap(2)'ing file succeeded."

Copied: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/setup.ksh (from r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/setup.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/setup.ksh	Thu Feb  8 21:55:46 2018	(r329042, copy of r329041, projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/setup.ksh)
@@ -0,0 +1,34 @@
+#!/usr/local/bin/ksh93 -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"@(#)setup.ksh	1.2	07/01/09 SMI"
+#
+
+. $STF_SUITE/include/libtest.kshlib
+
+DISK=${DISKS%% *}
+
+default_setup $DISK


More information about the svn-src-projects mailing list