Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added mmap_read and mmap_write test script .

  • Loading branch information...
commit 4df13271a0fb743991062bbdae16f1bcf9ba3aec 1 parent d5ab67a
root authored
View
6 ZFS-Test_Suite/include/libtest.kshlib
@@ -371,7 +371,7 @@ function default_cleanup_noexit
# filesystems it contains.
#
# if is_global_zone; then
- log_must $ZFS unmount -a
+# log_must $ZFS unmount -a
exclude=`eval $ECHO \"'(${KEEP})'\"`
ALL_POOLS=$($ZPOOL list -H -o name \
| $GREP -v "$NO_POOLS" \
@@ -1350,7 +1350,7 @@ function verify_filesys # pool filesystem dir
typeset search_path=""
log_note "Calling $ZDB to verify filesystem '$filesys'"
- log_must $ZFS umount -a
+# log_must $ZFS unmount -a
log_must $ZPOOL export $pool
if [[ -n $dirs ]] ; then
@@ -1365,7 +1365,7 @@ function verify_filesys # pool filesystem dir
log_must $ZPOOL import -a
- $ZFS mount -a
+# $ZFS mount -a //temp change
$ZDB -cudi $filesys > $zdbout 2>&1
if [[ $? != 0 ]]; then
log_note "Output: $ZDB -cudi $filesys"
View
42 ZFS-Test_Suite/tests/functional/mmap/Makefile
@@ -0,0 +1,42 @@
+#
+# 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 "@(#)Makefile 1.2 07/01/09 SMI"
+#
+
+STF_BUILD_SUBDIRS=mmap_read mmap_write
+STF_EXECUTE_SUBDIRS=mmap_read mmap_write
+
+STF_ROOT_SETUP=
+STF_ROOT_CLEANUP=
+
+STF_ROOT_CHECKENV=
+STF_ENVFILES=
+
+STF_INCLUDES=
+
+STF_DONTBUILDMODES=true
+
+include $(STF_TOOLS)/Makefiles/Makefile.master
View
45 ZFS-Test_Suite/tests/functional/mmap/mmap_read/Makefile
@@ -0,0 +1,45 @@
+#
+# 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 "@(#)Makefile 1.2 07/01/09 SMI"
+#
+STF_USER_CONFIGURE=
+STF_ROOT_CONFIGURE=
+
+STF_ROOT_SETUP=setup
+STF_USER_SETUP=
+
+STF_ROOT_CLEANUP=cleanup
+STF_USER_CLEANUP=
+
+STF_ROOT_TESTCASES=mmap_read_001_pos
+STF_USER_TESTCASES=
+
+STF_ENVFILES=mmap_read.cfg
+STF_INCLUDES=
+
+STF_DONTBUILDMODES=true
+
+include $(STF_TOOLS)/Makefiles/Makefile.master
View
23 ZFS-Test_Suite/tests/functional/mmap/mmap_read/README
@@ -0,0 +1,23 @@
+Steps to Run the mmap_read script:-
+
+1) First Run the setup.sh script
+
+ Usage to run setup.sh is
+
+ $ ./setup.sh $diskname1
+
+ ( eg . $] ./setup.sh sda )
+
+
+2) Second run the mmap_read_001_pos.ksh script
+
+ $ cd ../mmap_write
+ $ ./mmap_write_001_pos.ksh
+ $ cd -
+ $ ./mmap_read_001_pos.ksh
+
+3) Lastly run the cleanup.sh script
+
+ $ ./cleanup.sh
+
+
View
35 ZFS-Test_Suite/tests/functional/mmap/mmap_read/cleanup.ksh
@@ -0,0 +1,35 @@
+#!/bin/ksh -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
+. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/commands.cfg
+. $STF_SUITE/tests/functional/mmap/mmap_read/mmap_read.cfg
+
+default_cleanup
View
29 ZFS-Test_Suite/tests/functional/mmap/mmap_read/mmap_read.cfg
@@ -0,0 +1,29 @@
+#
+# 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$$
View
70 ZFS-Test_Suite/tests/functional/mmap/mmap_read/mmap_read_001_pos.ksh
@@ -0,0 +1,70 @@
+#!/bin/ksh -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
+. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/commands.cfg
+. $STF_SUITE/tests/functional/mmap/mmap_read/mmap_read.cfg
+
+###########################################################################
+#
+# __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
+./$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."
View
BIN  ZFS-Test_Suite/tests/functional/mmap/mmap_read/readmmap
Binary file not shown
View
38 ZFS-Test_Suite/tests/functional/mmap/mmap_read/setup.ksh
@@ -0,0 +1,38 @@
+#!/bin/ksh -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
+. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/commands.cfg
+. $STF_SUITE/tests/functional/mmap/mmap_read/mmap_read.cfg
+
+DISK=$@
+#DISK=${DISKS%% *}
+
+default_setup "$DISK"
View
45 ZFS-Test_Suite/tests/functional/mmap/mmap_write/Makefile
@@ -0,0 +1,45 @@
+#
+# 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 "@(#)Makefile 1.2 07/01/09 SMI"
+#
+STF_USER_CONFIGURE=
+STF_ROOT_CONFIGURE=
+
+STF_ROOT_SETUP=setup
+STF_USER_SETUP=
+
+STF_ROOT_CLEANUP=cleanup
+STF_USER_CLEANUP=
+
+STF_ROOT_TESTCASES=mmap_write_001_pos
+STF_USER_TESTCASES=
+
+STF_ENVFILES=mmap_write.cfg
+STF_INCLUDES=
+
+STF_DONTBUILDMODES=true
+
+include $(STF_TOOLS)/Makefiles/Makefile.master
View
18 ZFS-Test_Suite/tests/functional/mmap/mmap_write/README
@@ -0,0 +1,18 @@
+Steps to Run the mmap_write script:-
+
+1) First Run the setup.sh script
+
+ Usage to run setup.sh is
+
+ $ ./setup.sh $diskname1
+
+ ( eg . $] ./setup.sh sda )
+
+
+2) Second run the mmap_write_001_pos.ksh script
+
+ $ ./mmap_write_001_pos.ksh
+
+3) Lastly run the cleanup.sh script
+
+ $ ./cleanup.sh
View
34 ZFS-Test_Suite/tests/functional/mmap/mmap_write/cleanup.ksh
@@ -0,0 +1,34 @@
+#!/bin/ksh -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
+. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/commands.cfg
+. $STF_SUITE/tests/functional/mmap/mmap_write/mmap_write.cfg
+
+default_cleanup
View
29 ZFS-Test_Suite/tests/functional/mmap/mmap_write/mmap_write.cfg
@@ -0,0 +1,29 @@
+#
+# 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_write.cfg 1.3 08/08/15 SMI"
+#
+
+#export TESTFILE=testfile$$
View
93 ZFS-Test_Suite/tests/functional/mmap/mmap_write/mmap_write_001_pos.ksh
@@ -0,0 +1,93 @@
+#!/bin/ksh -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
+. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/commands.cfg
+. $STF_SUITE/tests/functional/mmap/mmap_write/mmap_write.cfg
+
+# ##########################################################################
+#
+# __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
+#if (( `$PSRINFO -p` <= 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."
View
BIN  ZFS-Test_Suite/tests/functional/mmap/mmap_write/mmapwrite
Binary file not shown
View
38 ZFS-Test_Suite/tests/functional/mmap/mmap_write/setup.ksh
@@ -0,0 +1,38 @@
+#!/bin/ksh -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
+. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/commands.cfg
+. $STF_SUITE/tests/functional/mmap/mmap_write/mmap_write.cfg
+
+DISK=$@
+#DISK=${DISKS%% *}
+
+default_setup "$DISK"
Please sign in to comment.
Something went wrong with that request. Please try again.