diff options
author | Yuri Pankov <yuri.pankov@nexenta.com> | 2018-04-11 16:16:11 -0400 |
---|---|---|
committer | Gordon Ross <gwr@nexenta.com> | 2018-10-16 08:58:39 -0400 |
commit | 96c8483a3fb53529bbf410957b0ad69cfb5d9229 (patch) | |
tree | 0317ed3be59104682bf93014aa463c4103b5d848 | |
parent | cc543d0f9e35a75cc302a4cb152756d233299564 (diff) | |
download | illumos-joyent-96c8483a3fb53529bbf410957b0ad69cfb5d9229.tar.gz |
7519 Add smbclient tests
Portions contributed by: Gordon Ross <gwr@nexenta.com>
Portions contributed by: Jilin Xpd <jilinxpd@gmail.com>
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Approved by: Garrett D'Amore <garrett@damore.org>
188 files changed, 17449 insertions, 2 deletions
diff --git a/usr/src/pkg/manifests/system-test-smbclient.mf b/usr/src/pkg/manifests/system-test-smbclient.mf new file mode 100644 index 0000000000..e669cda8a7 --- /dev/null +++ b/usr/src/pkg/manifests/system-test-smbclient.mf @@ -0,0 +1,198 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems Inc. All rights reserved. +# + +set name=pkg.fmri value=pkg:/system/test/smbclient@$(PKGVERS) +set name=pkg.description value="SMB Client Test Suite" +set name=pkg.summary \ + value="Functional test suite for the smbutil and smbmount commands" +set name=info.classification \ + value=org.opensolaris.category.2008:Development/System +set name=variant.arch value=$(ARCH) +dir path=opt/smbclient-tests +dir path=opt/smbclient-tests/bin +dir path=opt/smbclient-tests/config +dir path=opt/smbclient-tests/include +dir path=opt/smbclient-tests/runfiles +dir path=opt/smbclient-tests/tests +dir path=opt/smbclient-tests/tests/nsmbrc +dir path=opt/smbclient-tests/tests/performance +dir path=opt/smbclient-tests/tests/performance/filebench +dir path=opt/smbclient-tests/tests/sharectl +dir path=opt/smbclient-tests/tests/smbfs +dir path=opt/smbclient-tests/tests/smbfs/acl +dir path=opt/smbclient-tests/tests/smbfs/cptest +dir path=opt/smbclient-tests/tests/smbfs/create +dir path=opt/smbclient-tests/tests/smbfs/error +dir path=opt/smbclient-tests/tests/smbfs/misc +dir path=opt/smbclient-tests/tests/smbfs/mkdir +dir path=opt/smbclient-tests/tests/smbfs/mmap +dir path=opt/smbclient-tests/tests/smbfs/mvtest +dir path=opt/smbclient-tests/tests/smbfs/xattr +dir path=opt/smbclient-tests/tests/smbmount +dir path=opt/smbclient-tests/tests/smbutil +file path=opt/smbclient-tests/README mode=0444 +file path=opt/smbclient-tests/bin/abort_conn mode=0555 +file path=opt/smbclient-tests/bin/close_wr mode=0555 +file path=opt/smbclient-tests/bin/cp_mmap mode=0555 +file path=opt/smbclient-tests/bin/file_trunc mode=0555 +file path=opt/smbclient-tests/bin/mkfile_mmap mode=0555 +file path=opt/smbclient-tests/bin/no_close mode=0555 +file path=opt/smbclient-tests/bin/passwd.exp mode=0555 +file path=opt/smbclient-tests/bin/prot_mmap mode=0555 +file path=opt/smbclient-tests/bin/runone mode=0555 +file path=opt/smbclient-tests/bin/rw_mmap mode=0555 +file path=opt/smbclient-tests/bin/smbclienttest mode=0555 +file path=opt/smbclient-tests/bin/smbutil.exp mode=0555 +file path=opt/smbclient-tests/config/fileio.prof mode=0444 +file path=opt/smbclient-tests/config/filemacro.prof mode=0444 +file path=opt/smbclient-tests/config/filemicro.prof mode=0444 +file path=opt/smbclient-tests/config/generic.func mode=0444 +file path=opt/smbclient-tests/config/randomread.prof mode=0444 +file path=opt/smbclient-tests/config/seqread.prof mode=0444 +file path=opt/smbclient-tests/include/default_cfg.ksh mode=0444 +file path=opt/smbclient-tests/include/libtest.ksh mode=0444 +file path=opt/smbclient-tests/include/services_common.ksh mode=0444 +file path=opt/smbclient-tests/include/smbmount_common.ksh mode=0444 +file path=opt/smbclient-tests/include/smbutil_common.ksh mode=0444 +file path=opt/smbclient-tests/include/utils_common.ksh mode=0444 +file path=opt/smbclient-tests/include/xattr_common.ksh mode=0444 +file path=opt/smbclient-tests/runfiles/default.run mode=0444 +file path=opt/smbclient-tests/runfiles/just-nsmbrc.run mode=0444 +file path=opt/smbclient-tests/runfiles/just-sharectl.run mode=0444 +file path=opt/smbclient-tests/runfiles/just-smbfs.run mode=0444 +file path=opt/smbclient-tests/runfiles/just-smbmount.run mode=0444 +file path=opt/smbclient-tests/runfiles/just-smbutil.run mode=0444 +file path=opt/smbclient-tests/runfiles/perf-regression.run mode=0444 +file path=opt/smbclient-tests/tests/nsmbrc/tp_nsmbrc_001 mode=0555 +file path=opt/smbclient-tests/tests/nsmbrc/tp_nsmbrc_002 mode=0555 +file path=opt/smbclient-tests/tests/nsmbrc/tp_nsmbrc_003 mode=0555 +file path=opt/smbclient-tests/tests/nsmbrc/tp_nsmbrc_004 mode=0555 +file path=opt/smbclient-tests/tests/nsmbrc/tp_nsmbrc_005 mode=0555 +file path=opt/smbclient-tests/tests/nsmbrc/tp_nsmbrc_006 mode=0555 +file path=opt/smbclient-tests/tests/performance/filebench/tp_filebench_001 \ + mode=0555 +file path=opt/smbclient-tests/tests/performance/filebench/tp_filebench_002 \ + mode=0555 +file path=opt/smbclient-tests/tests/performance/filebench/tp_filebench_003 \ + mode=0555 +file path=opt/smbclient-tests/tests/performance/filebench/tp_filebench_004 \ + mode=0555 +file path=opt/smbclient-tests/tests/performance/filebench/tp_filebench_005 \ + mode=0555 +file path=opt/smbclient-tests/tests/sharectl/tp_sharectl_001 mode=0555 +file path=opt/smbclient-tests/tests/sharectl/tp_sharectl_002 mode=0555 +file path=opt/smbclient-tests/tests/sharectl/tp_sharectl_003 mode=0555 +file path=opt/smbclient-tests/tests/sharectl/tp_sharectl_004 mode=0555 +file path=opt/smbclient-tests/tests/sharectl/tp_sharectl_005 mode=0555 +file path=opt/smbclient-tests/tests/sharectl/tp_sharectl_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/acl/tp_acl_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/acl/tp_acl_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/acl/tp_acl_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/acl/tp_acl_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/acl/tp_acl_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_007 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_008 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/cptest/tp_cptest_009 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_007 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_008 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_009 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_010 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_011 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/create/tp_create_012 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/error/tp_error_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/error/tp_error_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/misc/tp_misc_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/misc/tp_misc_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/misc/tp_misc_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_007 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_008 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_009 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mmap/tp_mmap_010 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_007 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_001 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_002 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_003 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_004 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_005 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_006 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_007 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_008 mode=0555 +file path=opt/smbclient-tests/tests/smbfs/xattr/tp_xattr_009 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_001 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_002 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_003 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_004 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_005 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_006 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_007 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_008 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_009 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_010 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_011 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_012 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_013 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_014 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_015 mode=0555 +file path=opt/smbclient-tests/tests/smbmount/tp_smbmount_016 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_001 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_002 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_003 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_004 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_005 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_006 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_007 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_008 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_009 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_010 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_011 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_012 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_013 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_014 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_015 mode=0555 +file path=opt/smbclient-tests/tests/smbutil/tp_smbutil_016 mode=0555 +license cr_Sun license=cr_Sun +license lic_CDDL license=lic_CDDL +depend fmri=shell/expect type=require +depend fmri=system/test/testrunner type=require diff --git a/usr/src/pkg/manifests/system-test-testrunner.mf b/usr/src/pkg/manifests/system-test-testrunner.mf index b6fbfb6309..2043b84ea6 100644 --- a/usr/src/pkg/manifests/system-test-testrunner.mf +++ b/usr/src/pkg/manifests/system-test-testrunner.mf @@ -29,8 +29,11 @@ dir path=opt/test-runner/stf/contrib/include dir path=opt/test-runner/stf/include file path=opt/test-runner/bin/run mode=0555 file path=opt/test-runner/man/man1/run.1 mode=0444 +file path=opt/test-runner/stf/contrib/include/ctiutils.shlib mode=0555 file path=opt/test-runner/stf/contrib/include/logapi.shlib mode=0555 file path=opt/test-runner/stf/include/stf.shlib mode=0555 license cr_Sun license=cr_Sun license lic_CDDL license=lic_CDDL +license usr/src/test/test-runner/stf/contrib/LICENSE.Artistic \ + license=usr/src/test/test-runner/stf/contrib/LICENSE.Artistic depend fmri=security/sudo type=require diff --git a/usr/src/test/Makefile b/usr/src/test/Makefile index fdc5abc683..9ca989ce57 100644 --- a/usr/src/test/Makefile +++ b/usr/src/test/Makefile @@ -16,6 +16,7 @@ .PARALLEL: $(SUBDIRS) -SUBDIRS = libc-tests crypto-tests os-tests test-runner util-tests zfs-tests +SUBDIRS = libc-tests crypto-tests os-tests test-runner util-tests zfs-tests \ + smbclient-tests include Makefile.com diff --git a/usr/src/test/smbclient-tests/Makefile b/usr/src/test/smbclient-tests/Makefile new file mode 100644 index 0000000000..e677b9638f --- /dev/null +++ b/usr/src/test/smbclient-tests/Makefile @@ -0,0 +1,25 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +.PARALLEL: $(SUBDIRS) + +SUBDIRS= cmd \ + config \ + doc \ + include \ + runfiles \ + tests + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/smbclient-tests/Makefile.com b/usr/src/test/smbclient-tests/Makefile.com new file mode 100644 index 0000000000..c1c21d7a17 --- /dev/null +++ b/usr/src/test/smbclient-tests/Makefile.com @@ -0,0 +1,19 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +ROOTOPTPKG= $(ROOT)/opt/smbclient-tests +ROOTBINDIR= $(ROOTOPTPKG)/bin +ROOTCONFDIR= $(ROOTOPTPKG)/config +ROOTINCDIR= $(ROOTOPTPKG)/include diff --git a/usr/src/test/smbclient-tests/cmd/Makefile b/usr/src/test/smbclient-tests/cmd/Makefile new file mode 100644 index 0000000000..23632142ca --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +.PARALLEL: $(SUBDIRS) + +SUBDIRS= abort_conn \ + close_wr \ + cp_mmap \ + file_trunc \ + mkfile_mmap \ + no_close \ + prot_mmap \ + rw_mmap \ + scripts + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/smbclient-tests/cmd/Makefile.cmd b/usr/src/test/smbclient-tests/cmd/Makefile.cmd new file mode 100644 index 0000000000..13fd47c643 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/Makefile.cmd @@ -0,0 +1,56 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/test/Makefile.com + +OBJS= $(PROG:%=%.o) +SRCS= $(OBJS:%.o=%.c) + +ROOTPROG= $(PROG:%=$(ROOTBINDIR)/%) +$(ROOTPROG) := FILEMODE = 0555 + +CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + +LINTFLAGS += -erroff=E_BAD_FORMAT_STR2 +LINTFLAGS += -erroff=E_NAME_DECL_NOT_USED_DEF2 +LINTFLAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2 + +all: $(PROG) + +$(PROG): $(OBJS) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) + $(POST_PROCESS) + +%.o: %.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + +install: all $(ROOTPROG) + +lint: lint_SRCS + +clobber: clean + -$(RM) $(PROG) + +clean: + -$(RM) $(OBJS) + +$(ROOTPROG): $(ROOTBINDIR) $(PROG) + +$(ROOTBINDIR): + $(INS.dir) + +$(ROOTBINDIR)/%: % + $(INS.file) diff --git a/usr/src/test/smbclient-tests/cmd/abort_conn/Makefile b/usr/src/test/smbclient-tests/cmd/abort_conn/Makefile new file mode 100644 index 0000000000..da3342fa14 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/abort_conn/Makefile @@ -0,0 +1,22 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= abort_conn +LDLIBS += -lsocket + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/abort_conn/abort_conn.c b/usr/src/test/smbclient-tests/cmd/abort_conn/abort_conn.c new file mode 100644 index 0000000000..0213e3212b --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/abort_conn/abort_conn.c @@ -0,0 +1,146 @@ +/* + * 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 2010 Sun Microsystems, Inc. All rights reserved. + */ + +/* + * Test helper to abort TCP connections to some server; + * either all of the, or those to a specified port. + */ + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/sockio.h> +#include <sys/stropts.h> + +#include <inet/tcp.h> +#include <arpa/inet.h> +#include <netinet/in.h> +#include <netdb.h> + +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <zone.h> + +/* + * Abort all connections to the passed address. + */ +static void +tcp_abort_connections(struct sockaddr *rsa) +{ + tcp_ioc_abort_conn_t conn; + struct strioctl ioc; + struct sockaddr *lsa; + int fd; + + (void) memset(&conn, 0, sizeof (conn)); + lsa = (void *)&conn.ac_local; + lsa->sa_family = rsa->sa_family; + (void) memcpy(&conn.ac_remote, rsa, sizeof (*rsa)); + conn.ac_start = TCPS_SYN_SENT; + conn.ac_end = TCPS_CLOSE_WAIT; + conn.ac_zoneid = ALL_ZONES; + + ioc.ic_cmd = TCP_IOC_ABORT_CONN; + ioc.ic_timout = -1; /* infinite timeout */ + ioc.ic_len = sizeof (conn); + ioc.ic_dp = (char *)&conn; + + if ((fd = open("/dev/tcp", O_RDONLY)) < 0) { + (void) fprintf(stderr, "unable to open %s", "/dev/tcp"); + return; + } + + if (ioctl(fd, I_STR, &ioc) < 0) + if (errno != ENOENT) /* ENOENT is not an error */ + perror("ioctl"); + + (void) close(fd); +} + +static void +usage(char *arg0) +{ + (void) fprintf(stderr, "usage: %s [-p <PORT>] <ADDR>\n", arg0); + exit(1); +} + +int +main(int argc, char **argv) +{ + extern char *optarg; + extern int optind, optopt; + struct addrinfo hints, *res, *ai; + char *addr_str = NULL; + char *port_str = NULL; + int errflag = 0; + int c, gaierr; + + while ((c = getopt(argc, argv, "p:")) != -1) { + switch (c) { + case 'p': + port_str = optarg; + break; + case ':': + (void) fprintf(stderr, + "Option -%c requires an operand\n", optopt); + errflag++; + break; + case '?': + (void) fprintf(stderr, + "Unrecognized option: -%c\n", optopt); + errflag++; + break; + } + } + if (errflag) + usage(argv[0]); + if (argc <= optind) { + (void) fprintf(stderr, "No address specified\n"); + usage(argv[0]); + } + addr_str = argv[optind]; + + /* + * Lookup the IP address + */ + (void) memset(&hints, 0, sizeof (hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + gaierr = getaddrinfo(addr_str, port_str, &hints, &res); + if (gaierr != 0) { + (void) fprintf(stderr, "%s: %s\n", addr_str, + gai_strerror(gaierr)); + return (1); + } + + for (ai = res; ai != NULL; ai = ai->ai_next) { + tcp_abort_connections(ai->ai_addr); + } + + return (0); +} diff --git a/usr/src/test/smbclient-tests/cmd/close_wr/Makefile b/usr/src/test/smbclient-tests/cmd/close_wr/Makefile new file mode 100644 index 0000000000..7c180635c7 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/close_wr/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= close_wr + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/close_wr/close_wr.c b/usr/src/test/smbclient-tests/cmd/close_wr/close_wr.c new file mode 100644 index 0000000000..dbe00f66ff --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/close_wr/close_wr.c @@ -0,0 +1,107 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> + * Copyright 2018 Nexenta Systems, Inc. + */ + +/* + * After close file but before munmap it, test if we can still write into + * mapped pages and the dirty pages are eventually synced to file, + * the result should be that we can do it as long as we dont munmap it. + * When userland attempts to close mapped file, smbfs will keep SMB FID + * alive if there are mapped pages(not unmapped yet), so the otW will stay + * open until last ref. to vnode goes away. + * This program tests if smbfs works as we said. + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +int +main(int argc, char **argv) +{ + char *file_addr; + char *p; + size_t filesize; + size_t blksize; + int fid; + int i; + char *c = "?#*%&"; + + if (argc != 2) { + fprintf(stderr, "\tusage:\n\tclose_wr <filename>\n"); + return (1); + } + + /* open test file */ + fid = open(argv[1], O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH); + if (fid == -1) { + fprintf(stderr, "open %s error=%d\n", argv[1], errno); + return (1); + } + + /* extend file */ + filesize = 64 * 1024; + if (ftruncate(fid, filesize) == -1) { + fprintf(stderr, "ftrunc %s error=%d\n", argv[1], errno); + return (1); + } + + /* map file */ + file_addr = mmap(NULL, filesize, + PROT_READ | PROT_WRITE, MAP_SHARED, fid, 0); + if (file_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", argv[1], errno); + return (1); + } + + /* erase file */ + memset(file_addr, 0, filesize); + + /* close file here! */ + if (close(fid) == -1) { + fprintf(stderr, "close %s error=%d\n", argv[1], errno); + return (1); + } + + /* + * write somthing into mapped addr after close file, + * it should be ok before munmap + */ + blksize = filesize / 4; + for (i = 0, p = file_addr; i < 4; i++, p += blksize) { + memset(p, c[i], blksize); + } + + /* sync pages to file */ + if (msync(file_addr, filesize, MS_SYNC) == -1) { + fprintf(stderr, "msync %s error=%d\n", argv[1], errno); + return (1); + } + + /* unmap file */ + if (munmap(file_addr, filesize) == -1) { + fprintf(stderr, "munmap %s error=%d\n", argv[1], errno); + return (1); + } + + return (0); +} diff --git a/usr/src/test/smbclient-tests/cmd/cp_mmap/Makefile b/usr/src/test/smbclient-tests/cmd/cp_mmap/Makefile new file mode 100644 index 0000000000..18369e78e2 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/cp_mmap/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= cp_mmap + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/cp_mmap/cp_mmap.c b/usr/src/test/smbclient-tests/cmd/cp_mmap/cp_mmap.c new file mode 100644 index 0000000000..9ac1ff6659 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/cp_mmap/cp_mmap.c @@ -0,0 +1,194 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> + * Copyright 2018 Nexenta Systems, Inc. + */ + +/* + * Copy a file from src to dest, using mmap to copy the data, + * with either contiguous or discontiguous mappings. + * (Jilin calls discontiguous "discrete" below.) + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <limits.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +void +usage(void) +{ + fprintf(stderr, + "usage: cp_mmap -t {d|c} -f <srcfile> <desfile>\n"); + exit(1); +} + +int +main(int argc, char **argv) +{ + struct stat sb; + char *src_addr, *des_addr; + char *src_file = NULL, *des_file = NULL; + off_t offset; + size_t filesize; + size_t blksize; + size_t pagesize; + size_t len; + size_t numblks; + int src_fid, des_fid; + int mret = 0; + size_t i; + size_t stride; + boolean_t discrete = B_FALSE; /* discontiguous mappings */ + + /* + * parse arguments + * Not getopt because -f has two optargs + */ + if (argc != 6) + usage(); + + for (i = 1; i < argc; ) { + switch (argv[i][1]) { + case 't': /* copy type */ + i++; + discrete = (argv[i][0] == 'd'); + i++; + break; + case 'f': /* src file and des file */ + i++; + src_file = argv[i]; + i++; + des_file = argv[i]; + i++; + break; + default: + usage(); + break; + } + } + + pagesize = sysconf(_SC_PAGESIZE); /* mmap one page each time */ + if (pagesize < 4096) { + fprintf(stderr, "sysconf error=%d\n", errno); + return (1); + } + if (discrete) { + /* + * Use discontiguous mappings, and only mmap + * one page each time + */ + blksize = pagesize; + stride = 3; + } else { + /* will do contiguous mmap */ + blksize = 64 * 1024 * 1024; /* mmap a block each time */ + stride = 1; + } + + /* source file */ + src_fid = open(src_file, O_RDONLY); + if (src_fid == -1) { + fprintf(stderr, "open %s error=%d\n", src_file, errno); + return (1); + } + /* destination file */ + des_fid = open(des_file, O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH); + if (des_fid == -1) { + fprintf(stderr, "open %s error=%d\n", des_file, errno); + mret = 1; + goto exit3; + } + + /* get src file size */ + if (fstat(src_fid, &sb) == -1) { + fprintf(stderr, "fstat %s error=%d\n", src_file, errno); + mret = 1; + goto exit2; + } + filesize = sb.st_size; + if (filesize < pagesize) { + fprintf(stderr, "src file size < %d\n", (int)pagesize); + mret = 1; + goto exit2; + } + + /* extend des file */ + if (ftruncate(des_fid, filesize) == -1) { + fprintf(stderr, "ftrunc %s error=%d\n", des_file, errno); + mret = 1; + goto exit2; + } + + /* copy data */ + numblks = (filesize + blksize - 1) / blksize; + for (i = 0; i < stride * numblks && mret == 0; i += stride) { + + offset = (i % numblks) * blksize; + if (offset + blksize > filesize) + len = filesize - offset; + else + len = blksize; + + /* map file */ + src_addr = mmap(NULL, len, PROT_READ, MAP_SHARED, + src_fid, offset); + if (src_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", src_file, errno); + mret = 1; + break; + } + des_addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, + des_fid, offset); + if (des_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", des_file, errno); + mret = 1; + goto exit1; + } + + /* cp data from src addr to des addr */ + memcpy(des_addr, src_addr, len); + /* sync mapped pages to file */ + if (msync(des_addr, len, MS_SYNC) == -1) { + fprintf(stderr, "msync %s error=%d\n", des_file, errno); + mret = 1; + } + + /* unmap file */ + if (munmap(des_addr, len) == -1) { + fprintf(stderr, "munmap %s error=%d\n", + des_file, errno); + mret = 1; + } + exit1: + if (munmap(src_addr, len) == -1) { + fprintf(stderr, "munmap %s error=%d\n", + src_file, errno); + mret = 1; + } + } + +exit2: + close(des_fid); +exit3: + close(src_fid); + + return (mret); +} diff --git a/usr/src/test/smbclient-tests/cmd/file_trunc/Makefile b/usr/src/test/smbclient-tests/cmd/file_trunc/Makefile new file mode 100644 index 0000000000..4f82770aa0 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/file_trunc/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= file_trunc + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/file_trunc/file_trunc.c b/usr/src/test/smbclient-tests/cmd/file_trunc/file_trunc.c new file mode 100644 index 0000000000..3e6bd8aa1b --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/file_trunc/file_trunc.c @@ -0,0 +1,238 @@ +/* + * 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <limits.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/fcntl.h> +#include <sys/stat.h> +#include <sys/statvfs.h> +#include <sys/errno.h> +#include <sys/time.h> +#include <sys/ioctl.h> +#include <sys/wait.h> +#include <sys/param.h> +#include <string.h> + +#define FSIZE 256*1024*1024 +#define BSIZE 512 + +/* Initialize Globals */ +static long fsize = FSIZE; +static size_t bsize = BSIZE; +static int count = 0; +static int rflag = 0; +static int seed = 0; +static int vflag = 0; +static int errflag = 0; +static off_t offset = 0; +static char *filename = NULL; + +static void usage(char *execname); +static void parse_options(int argc, char *argv[]); +static void do_write(int fd); +static void do_trunc(int fd); + +static void +usage(char *execname) +{ + (void) fprintf(stderr, + "usage: %s [-b blocksize] [-c count] [-f filesize]" + " [-o offset] [-s seed] [-r] [-v] filename\n", execname); + (void) exit(1); +} + +int +main(int argc, char *argv[]) +{ + int i = 0; + int fd = -1; + + parse_options(argc, argv); + + fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); + if (fd < 0) { + perror("open"); + exit(3); + } + + while (i < count) { + (void) do_write(fd); + (void) do_trunc(fd); + + i++; + } + + (void) close(fd); + return (0); +} + +static void +parse_options(int argc, char *argv[]) +{ + int c; + + extern char *optarg; + extern int optind, optopt; + + count = fsize / bsize; + seed = time(NULL); + while ((c = getopt(argc, argv, "b:c:f:o:rs:v")) != -1) { + switch (c) { + case 'b': + bsize = atoi(optarg); + break; + + case 'c': + count = atoi(optarg); + break; + + case 'f': + fsize = atoi(optarg); + break; + + case 'o': + offset = atoi(optarg); + break; + + case 'r': + rflag++; + break; + + case 's': + seed = atoi(optarg); + break; + + case 'v': + vflag++; + break; + + case ':': + (void) fprintf(stderr, + "Option -%c requires an operand\n", optopt); + errflag++; + break; + + case '?': + (void) fprintf(stderr, + "Unrecognized option: -%c\n", optopt); + errflag++; + break; + } + + if (errflag) { + (void) usage(argv[0]); + } + } + if (argc <= optind) { + (void) fprintf(stderr, + "No filename specified\n"); + usage(argv[0]); + } + filename = argv[optind]; + + if (vflag) { + (void) fprintf(stderr, "Seed = %d\n", seed); + } + srandom(seed); +} + +static void +do_write(int fd) +{ + off_t roffset = 0; + char *buf = NULL; + char *rbuf = NULL; + + buf = (char *)calloc(1, bsize); + rbuf = (char *)calloc(1, bsize); + if (buf == NULL || rbuf == NULL) { + perror("malloc"); + exit(4); + } + + roffset = random() % fsize; + if (lseek64(fd, (offset + roffset), SEEK_SET) < 0) { + perror("lseek"); + exit(5); + } + + buf = "SMBFS Test Suite Truncation Test"; + if (write(fd, buf, bsize) < bsize) { + perror("write"); + exit(6); + } + + if (rflag) { + if (lseek64(fd, (offset + roffset), SEEK_SET) < 0) { + perror("lseek"); + exit(7); + } + + if (read(fd, rbuf, bsize) < bsize) { + perror("read"); + exit(8); + } + + if (memcmp(buf, rbuf, bsize) != 0) { + perror("memcmp"); + exit(9); + } + } + if (vflag) { + (void) fprintf(stderr, + "Wrote to offset %jd\n", (intmax_t)(offset + roffset)); + if (rflag) { + (void) fprintf(stderr, + "Read back from offset %jd\n", + (intmax_t)(offset + roffset)); + } + } + + (void) free(buf); + (void) free(rbuf); +} + +static void +do_trunc(int fd) +{ + off_t roffset = 0; + + roffset = random() % fsize; + if (ftruncate64(fd, (offset + roffset)) < 0) { + perror("truncate"); + exit(7); + } + + if (vflag) { + (void) fprintf(stderr, + "Truncated at offset %jd\n", + (intmax_t)(offset + roffset)); + } +} diff --git a/usr/src/test/smbclient-tests/cmd/mkfile_mmap/Makefile b/usr/src/test/smbclient-tests/cmd/mkfile_mmap/Makefile new file mode 100644 index 0000000000..928f625b46 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/mkfile_mmap/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= mkfile_mmap + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c b/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c new file mode 100644 index 0000000000..b11a55cd4f --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c @@ -0,0 +1,175 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> + * Copyright 2018 Nexenta Systems, Inc. + */ + +/* + * Using mmap, make a file and padding it with random chars. + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <time.h> + +void +usage(void) +{ + fprintf(stderr, + "usage: mkfile_mmap -n <size>[b|k|m|g] -f <filename>\n"); + exit(1); +} + +int +main(int argc, char **argv) +{ + char *suffix; + char *filename = NULL; + char *file_addr; + char *p, *q; + off_t offset; + size_t filesize; + size_t blksize; + size_t numblks; + size_t cnt = 1; + size_t mul = 1; + size_t i; + int mret = 0; + int c, fid; + + /* + * parse arguments + */ + while ((c = getopt(argc, argv, "n:f:")) != -1) { + switch (c) { + case 'n': + cnt = (size_t)strtoul(optarg, &suffix, 0); + if (cnt == 0) + goto bad_n_arg; + switch (*suffix) { + case '\0': + case 'b': + mul = 1; + break; + case 'k': + mul = 1024; + break; + case 'm': + mul = (1024 * 1024); + break; + case 'g': + mul = (1024 * 1024 * 1024); + break; + default: + bad_n_arg: + fprintf(stderr, "-n %s: invalid size\n", + optarg); + return (1); + } + cnt = cnt * mul; + break; + + case 'f': /* target file */ + filename = optarg; + break; + + case ':': /* missing optarg */ + fprintf(stderr, + "Option -%c requires an arg\n", optopt); + usage(); + break; + case '?': + fprintf(stderr, + "Unrecognized option: -%c\n", optopt); + usage(); + break; + } + } + + /* open test file */ + fid = open(filename, O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH); + if (fid == -1) { + fprintf(stderr, "open %s error=%d\n", filename, errno); + mret = 1; + goto exit3; + } + + /* extend file */ + filesize = cnt; + if (ftruncate(fid, filesize) == -1) { + fprintf(stderr, "ftrunc %s error=%d\n", filename, errno); + mret = 1; + goto exit2; + } + +#define K 1024 + + blksize = 64 * K * K; + numblks = (filesize + blksize - 1) / blksize; + for (i = 0; i < numblks && mret == 0; i++) { + + offset = i*blksize; + if (offset + blksize > filesize) + blksize = filesize - offset; + + /* map file */ + file_addr = mmap(NULL, blksize, + PROT_READ | PROT_WRITE, MAP_SHARED, fid, offset); + if (file_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", filename, errno); + mret = 1; + break; + } + + /* tag each block (to aid debug) */ + p = file_addr; + q = file_addr + blksize - K; + memset(p, ' ', K); + snprintf(p, K, "\nblk=%d\n\n", i); + p += K; + + /* fill something into mapped addr */ + while (p < q) { + memset(p, ' ', K); + snprintf(p, K, "\noff=0x%x\n\n", + (i * blksize) + (p - file_addr)); + p += K; + } + + /* sync mapped pages to file */ + if (msync(file_addr, blksize, MS_SYNC) == -1) { + fprintf(stderr, "msync %s error=%d\n", filename, errno); + mret = 1; + } + + /* unmap file */ + if (munmap(file_addr, blksize) == -1) { + fprintf(stderr, "unmap %s error=%d\n", filename, errno); + mret = 1; + } + } + + /* close file */ +exit2: + close(fid); +exit3: + return (mret); +} diff --git a/usr/src/test/smbclient-tests/cmd/no_close/Makefile b/usr/src/test/smbclient-tests/cmd/no_close/Makefile new file mode 100644 index 0000000000..907b2feeda --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/no_close/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= no_close + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/no_close/no_close.c b/usr/src/test/smbclient-tests/cmd/no_close/no_close.c new file mode 100644 index 0000000000..8a780c36df --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/no_close/no_close.c @@ -0,0 +1,84 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> + * Copyright 2018 Nexenta Systems, Inc. + */ + +/* + * It doesn't matter if the userland forgets to close the file or + * munmap it, because smbfs will help close it(including otW close) + * and sync the dirty pages to the file. + * This program tests if smbfs works as we said. + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +int +main(int argc, char **argv) +{ + char *file_addr; + off_t offset; + size_t filesize; + size_t blksize; + int fid; + int i; + char *c = "?#*%&"; + + if (argc != 2) { + fprintf(stderr, "\tusage:\n\tno_close <filename>\n"); + return (1); + } + + /* open test file */ + fid = open(argv[1], O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH); + if (fid == -1) { + fprintf(stderr, "open %s error=%d\n", argv[1], errno); + return (1); + } + + /* extend file */ + filesize = 64 * 1024; + if (ftruncate(fid, filesize) == -1) { + fprintf(stderr, "ftrunc %s error=%d\n", argv[1], errno); + return (1); + } + + /* map file */ + file_addr = mmap(NULL, filesize, + PROT_READ | PROT_WRITE, MAP_SHARED, fid, 0); + if (file_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", argv[1], errno); + return (1); + } + + /* write something into mapped addr */ + blksize = filesize / 4; + for (i = 0, offset = 0; i < 4; i++, offset += blksize) { + memset(file_addr + offset, c[i], blksize); + } + memset(file_addr + offset, c[i], filesize - offset); + + /* no msync, munmap, close */ + + _exit(0); + /* NOTREACHED */ +} diff --git a/usr/src/test/smbclient-tests/cmd/prot_mmap/Makefile b/usr/src/test/smbclient-tests/cmd/prot_mmap/Makefile new file mode 100644 index 0000000000..437a0373e5 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/prot_mmap/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= prot_mmap + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/prot_mmap/prot_mmap.c b/usr/src/test/smbclient-tests/cmd/prot_mmap/prot_mmap.c new file mode 100644 index 0000000000..20ff1f2162 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/prot_mmap/prot_mmap.c @@ -0,0 +1,216 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> + * Copyright 2018 Nexenta Systems, Inc. + */ + +/* + * use mmap to copy data from src file to des file, + * with given flags and modes. + * the src & des file should exist and have the same size. + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +void +usage(void) +{ + fprintf(stderr, + "usage: " + "prot_mmap -o <r|w> <r|w>" + " -m <r|w|s|p> <r|w|s|p>" + " -f <srcfile> <desfile>\n"); + exit(1); +} + +int +main(int argc, char **argv) +{ + struct stat sb; + char *src_addr, *des_addr; + char *src_file = NULL, *des_file = NULL; + off_t offset; + size_t filesize; + size_t blksize; + size_t numblks; + size_t i, j; + int src_fid, des_fid; + int mret = 0; + int flags0 = 0, mflags0 = 0, prot0 = 0; /* flags for src file */ + int flags1 = 0, mflags1 = 0, prot1 = 0; /* flags for des file */ + + /* + * parse arguments + * Not getopt because -o -m -f all have 2 optargs each. + */ + if (argc != 10) { + usage(); + } + for (i = 1; i < argc; ) { + switch (argv[i][1]) { + case 'o': /* options for open() */ + i++; + for (j = 0; argv[i][j]; j++) { + if (argv[i][j] == 'r') + flags0 |= O_RDONLY; + else if (argv[i][j] == 'w') + flags0 |= O_WRONLY; + } + if ((flags0 & (O_RDONLY | O_WRONLY)) == + (O_RDONLY | O_WRONLY)) + flags0 = O_RDWR; + i++; + for (j = 0; argv[i][j]; j++) { + if (argv[i][j] == 'r') + flags1 |= O_RDONLY; + else if (argv[i][j] == 'w') + flags1 |= O_WRONLY; + } + if ((flags1 & (O_RDONLY | O_WRONLY)) == + (O_RDONLY | O_WRONLY)) + flags1 = O_RDWR; + i++; + break; + case 'm': /* options for mmap() */ + i++; + for (j = 0; argv[i][j]; j++) { + if (argv[i][j] == 'r') + prot0 |= PROT_READ; + else if (argv[i][j] == 'w') + prot0 |= PROT_WRITE; + else if (argv[i][j] == 's') + mflags0 |= MAP_SHARED; + else if (argv[i][j] == 'p') + mflags0 |= MAP_PRIVATE; + } + i++; + for (j = 0; argv[i][j]; j++) { + if (argv[i][j] == 'r') + prot1 |= PROT_READ; + else if (argv[i][j] == 'w') + prot1 |= PROT_WRITE; + else if (argv[i][j] == 's') + mflags1 |= MAP_SHARED; + else if (argv[i][j] == 'p') + mflags1 |= MAP_PRIVATE; + } + i++; + break; + case 'f': /* src file and des file */ + i++; + src_file = argv[i]; + i++; + des_file = argv[i]; + i++; + } + } + + /* source file */ + src_fid = open(src_file, flags0); + if (src_fid == -1) { + fprintf(stderr, "open %s error=%d\n", src_file, errno); + return (1); + } + /* destination file */ + des_fid = open(des_file, flags1); + if (des_fid == -1) { + fprintf(stderr, "open %s error=%d\n", des_file, errno); + mret = 1; + goto exit3; + } + + /* get file size */ + if (fstat(src_fid, &sb) == -1) { + fprintf(stderr, "fstat %s error=%d\n", src_file, errno); + mret = 1; + goto exit2; + } + filesize = sb.st_size; + if (filesize < 4096) { + fprintf(stderr, "file too small\n"); + mret = 1; + goto exit2; + } + + if (fstat(des_fid, &sb) == -1) { + fprintf(stderr, "fstat %s error=%d\n", des_file, errno); + mret = 1; + goto exit2; + } + if (filesize != sb.st_size) { + fprintf(stderr, "file sizes differ\n"); + mret = 1; + goto exit2; + } + + /* copy data */ + blksize = 64 * 1024 * 1024; + numblks = (filesize + blksize - 1) / blksize; + for (i = 0; i < numblks && mret == 0; i++) { + + offset = (i % numblks) * blksize; + if (offset + blksize > filesize) + blksize = filesize - offset; + + /* map file */ + src_addr = mmap(NULL, blksize, prot0, mflags0, src_fid, offset); + if (src_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", src_file, errno); + mret = 1; + break; + } + des_addr = mmap(NULL, blksize, prot1, mflags1, des_fid, offset); + if (des_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", des_file, errno); + mret = 1; + goto exit1; + } + + /* cp data from src addr to des addr */ + memcpy(des_addr, src_addr, blksize); + /* sync mapped pages to file */ + if (msync(des_addr, blksize, MS_SYNC) == -1) { + fprintf(stderr, "msync %s error=%d\n", des_file, errno); + mret = 1; + } + + /* unmap file */ + if (munmap(des_addr, blksize) == -1) { + fprintf(stderr, "munmap %s error=%d\n", + des_file, errno); + mret = 1; + } +exit1: + if (munmap(src_addr, blksize) == -1) { + fprintf(stderr, "munmap %s error=%d\n", + src_file, errno); + mret = 1; + } + } + + /* close file */ +exit2: + close(des_fid); +exit3: + close(src_fid); + + return (mret); +} diff --git a/usr/src/test/smbclient-tests/cmd/rw_mmap/Makefile b/usr/src/test/smbclient-tests/cmd/rw_mmap/Makefile new file mode 100644 index 0000000000..4a4c198e0c --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/rw_mmap/Makefile @@ -0,0 +1,21 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/cmd/Makefile.cmd +include ../../Makefile.com + +PROG= rw_mmap + +include ../Makefile.cmd diff --git a/usr/src/test/smbclient-tests/cmd/rw_mmap/rw_mmap.c b/usr/src/test/smbclient-tests/cmd/rw_mmap/rw_mmap.c new file mode 100644 index 0000000000..b83b0cf4b4 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/rw_mmap/rw_mmap.c @@ -0,0 +1,217 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> + * Copyright 2018 Nexenta Systems, Inc. + */ + +/* + * Test if file read/write is coherent with mmap, perform 2 tests: + * modify file through mmap, and check the result through file read. + * modify file through file write, and check the result through mmap. + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +void +usage(void) +{ + fprintf(stderr, + "usage: rw_mmap -n <size>[b|k|m|g] -f <filename>\n"); + exit(1); +} + +int +main(int argc, char **argv) +{ + char *suffix; + char *filename = NULL; + char *file_addr; + char *p; + size_t filesize; + ssize_t blksize; + size_t cnt = 1; + size_t mul = 1; + int c, fid; + char *buf; + + /* + * parse arguments + */ + while ((c = getopt(argc, argv, "n:f:")) != -1) { + switch (c) { + case 'n': + cnt = (size_t)strtoul(optarg, &suffix, 0); + if (cnt == 0) + goto bad_n_arg; + switch (*suffix) { + case '\0': + case 'b': + mul = 1; + break; + case 'k': + mul = 1024; + break; + case 'm': + mul = (1024 * 1024); + break; + case 'g': + mul = (1024 * 1024 * 1024); + break; + default: + bad_n_arg: + fprintf(stderr, "-n %s: invalid size\n", + optarg); + return (1); + } + cnt = cnt * mul; + break; + + case 'f': /* target file */ + filename = optarg; + break; + + case ':': /* missing optarg */ + fprintf(stderr, + "Option -%c requires an arg\n", optopt); + usage(); + break; + case '?': + fprintf(stderr, + "Unrecognized option: -%c\n", optopt); + usage(); + break; + } + } + + /* open test file */ + fid = open(filename, O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH); + if (fid == -1) { + fprintf(stderr, "open %s error=%d\n", filename, errno); + return (1); + } + + /* extend file */ + filesize = cnt; + if (ftruncate(fid, filesize) == -1) { + fprintf(stderr, "ftrunc %s error=%d\n", filename, errno); + return (1); + } + + /* map file */ + file_addr = mmap(NULL, filesize, + PROT_READ | PROT_WRITE, MAP_SHARED, fid, 0); + if (file_addr == MAP_FAILED) { + fprintf(stderr, "mmap %s error=%d\n", filename, errno); + return (1); + } + + blksize = 4096; + buf = malloc(blksize); + if (buf == NULL) { + fprintf(stderr, "malloc failed\n"); + return (1); + } + + /* verify fread and mmap see the same data */ + p = file_addr + 2013; /* not aligned to 4KB, on purpose */ + lseek(fid, 2013, SEEK_SET); + while (p < file_addr + filesize) { + blksize = read(fid, buf, blksize); + if (blksize < 0) { + perror(filename); + return (1); + } + if (blksize == 0) + break; + if (memcmp(buf, p, blksize) != 0) { + fprintf(stderr, "memcmp failed 1\n"); + return (1); + } + p += blksize; + } + + /* modify file through mmap, verify fread can see the change */ + blksize = 4096; + p = file_addr + 2013; /* not aligned to 4KB */ + lseek(fid, 2013, SEEK_SET); + c = 'a'; + while (p < file_addr + filesize) { + if (p + blksize > file_addr + filesize) + blksize = file_addr + filesize - p; + memset(p, c++, blksize); + blksize = read(fid, buf, blksize); + if (blksize < 0) { + perror(filename); + return (1); + } + if (blksize == 0) + break; + if (memcmp(buf, p, blksize) != 0) { + fprintf(stderr, "memcmp failed 2\n"); + return (1); + } + p += blksize; + } + + /* modify file through fwrite, verify mmap can see the change */ + blksize = 4096; + p = file_addr + 2013; /* not aligned to 4KB */ + lseek(fid, 2013, SEEK_SET); + c = 'Z'; + while (p < file_addr + filesize) { + if (p + blksize > file_addr + filesize) + blksize = file_addr + filesize - p; + memset(buf, c--, blksize); + blksize = write(fid, buf, blksize); + if (blksize < 0) { + perror(filename); + return (1); + } + if (blksize == 0) + break; + if (memcmp(buf, p, blksize) != 0) { + fprintf(stderr, "memcmp failed 3\n"); + return (1); + } + p += blksize; + } + + /* sync pages to file */ + if (msync(file_addr, filesize, MS_SYNC) == -1) { + fprintf(stderr, "msync %s error=%d\n", filename, errno); + return (1); + } + + /* unmap file */ + if (munmap(file_addr, filesize) == -1) { + fprintf(stderr, "munmap %s error=%d\n", filename, errno); + return (1); + } + + /* close file */ + if (close(fid) == -1) { + fprintf(stderr, "close %s error=%d\n", filename, errno); + return (1); + } + + return (0); +} diff --git a/usr/src/test/smbclient-tests/cmd/scripts/Makefile b/usr/src/test/smbclient-tests/cmd/scripts/Makefile new file mode 100644 index 0000000000..cc019bfcc1 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/scripts/Makefile @@ -0,0 +1,40 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../Makefile.com + +PROGS= passwd.exp \ + runone \ + smbclienttest \ + smbutil.exp + +ROOTPROGS= $(PROGS:%=$(ROOTBINDIR)/%) +$(ROOTPROGS) := FILEMODE = 0555 + +all lint clean clobber: + +install: $(ROOTPROGS) + +$(ROOTPROGS): $(ROOTBINDIR) + +$(ROOTBINDIR): + $(INS.dir) + +$(ROOTBINDIR)/%: % + $(INS.file) + +$(ROOTBINDIR)/%: %.ksh + $(INS.rename) diff --git a/usr/src/test/smbclient-tests/cmd/scripts/passwd.exp b/usr/src/test/smbclient-tests/cmd/scripts/passwd.exp new file mode 100644 index 0000000000..9c86b1aa3e --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/scripts/passwd.exp @@ -0,0 +1,70 @@ +# +# 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. +# + +# +# NAME +# passwd.exp +# +# DESCRIPTION +# The Expect script will change the passwd of a user +# + + +set timeout 5 +set name [lindex $argv 0] +set passwd [lindex $argv 1] + +spawn passwd $name +expect { + timeout { + send "\r" + send_error "\n passwd is time out\n" + exit 1 + } + + "User unknown:" { + send_error "\n User $name doesn't exist\n" + exit 1 + } + + "New Password" { + send "$passwd\r" + sleep 2 + expect { + timeout { + send "\r" + send_error "\n passwd is time out\n" + exit 1 + } + "Re-enter new Password:" { + send "$passwd\r" + sleep 2 + } + } + } +} + +send_user "\n" +exit 0 diff --git a/usr/src/test/smbclient-tests/cmd/scripts/runone.ksh b/usr/src/test/smbclient-tests/cmd/scripts/runone.ksh new file mode 100644 index 0000000000..6cbc4a1c0a --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/scripts/runone.ksh @@ -0,0 +1,34 @@ +#!/usr/bin/ksh + +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# Simple script to run one test, for debug. Usage: +# SRV=myserver runone smbfs/mmap/tp_mmap_005 +# +# Note: creates/destroys temporary files in the CWD. + +export STF_SUITE="/opt/smbclient-tests" +export STF_TOOLS="/opt/test-runner/stf" + +PATH=/usr/bin:/usr/sbin:/sbin:$STF_SUITE/bin:$PATH +export PATH + +[[ -n "$SRV" ]] || { echo "$0 SRV=... required"; exit 1; } + +[[ -x $STF_SUITE/tests/$1 ]] && exec ksh -x $STF_SUITE/tests/$1 +exec ksh -x $1 +echo "$1: not found" diff --git a/usr/src/test/smbclient-tests/cmd/scripts/smbclienttest.ksh b/usr/src/test/smbclient-tests/cmd/scripts/smbclienttest.ksh new file mode 100644 index 0000000000..68f3ce371c --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/scripts/smbclienttest.ksh @@ -0,0 +1,63 @@ +#!/usr/bin/ksh + +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +# +# Define necessary environments and config variables here +# prior to invoking the test runner +# + +export STF_SUITE="/opt/smbclient-tests" +export STF_TOOLS="/opt/test-runner/stf" +runner="/opt/test-runner/bin/run" + +runfile=$STF_SUITE/runfiles/default.run + +PATH=/usr/bin:/usr/sbin:/sbin:$STF_SUITE/bin:$PATH +export PATH + +while getopts 'c:fqs:' c; do + case $c in + 'c') + runfile=$OPTARG + ;; + 'f') + export STC_QUICK=1 + ;; + 'q') + quiet='-q' + ;; + 's') + export SRV=$OPTARG + ;; + esac +done +shift $((OPTIND - 1)) + +. $STF_SUITE/include/default_cfg.ksh + +[[ -n "$SRV" ]] || { echo "$0 -s SERVER required"; exit 1; } + +# Allow relative runfiles for convenience. +if [[ ! -r "$runfile" && -r "$STF_SUITE/runfiles/$runfile" ]] +then + runfile="$STF_SUITE/runfiles/$runfile" +fi +[[ -r $runfile ]] || { echo "$0 Cannot read file: $runfile"; exit 1; } + +$runner $quiet -c $runfile + +exit $? diff --git a/usr/src/test/smbclient-tests/cmd/scripts/smbutil.exp b/usr/src/test/smbclient-tests/cmd/scripts/smbutil.exp new file mode 100644 index 0000000000..dd339db2f8 --- /dev/null +++ b/usr/src/test/smbclient-tests/cmd/scripts/smbutil.exp @@ -0,0 +1,52 @@ +# +# 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. +# + +# +# NAME +# smbutil.exp +# +# DESCRIPTION +# The Expect script will create the key chains by smbutil login +# + +set timeout 5 +set name [lindex $argv 0] +set passwd [lindex $argv 1] + +spawn smbutil login $name +expect { + timeout { + send "\r" + send_error "\n passwd is time out\n" + exit 1 + } + "Password for" { + send "$passwd\r" + sleep 2 + } +} + +send_user "\n" +exit 0 diff --git a/usr/src/test/smbclient-tests/config/Makefile b/usr/src/test/smbclient-tests/config/Makefile new file mode 100644 index 0000000000..0c71f1ba6d --- /dev/null +++ b/usr/src/test/smbclient-tests/config/Makefile @@ -0,0 +1,40 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../Makefile.com + +CONFS= \ + fileio.prof \ + filemacro.prof \ + filemicro.prof \ + generic.func \ + randomread.prof \ + seqread.prof + +ROOTCONFS= $(CONFS:%=$(ROOTCONFDIR)/%) +$(ROOTCONFS) := FILEMODE = 0444 + +all lint clean clobber: + +install: $(ROOTCONFS) + +$(ROOTCONFS): $(ROOTCONFDIR) + +$(ROOTCONFDIR): + $(INS.dir) + +$(ROOTCONFDIR)/%: % + $(INS.file) diff --git a/usr/src/test/smbclient-tests/config/fileio.prof b/usr/src/test/smbclient-tests/config/fileio.prof new file mode 100644 index 0000000000..3002a95915 --- /dev/null +++ b/usr/src/test/smbclient-tests/config/fileio.prof @@ -0,0 +1,124 @@ +# +# 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. +# + +DEFAULTS { + runtime = 120; + dir = /var/tmp/smbclnt/mnt; + stats = /tmp; + filesystem = tmpfs; + description = "fileio tmpfs"; + filesize = 5g; +} + +CONFIG randomread2k { + function = generic; + personality = randomread; + nthreads = 16; + iosize = 2k; +} + +CONFIG randomread8k { + function = generic; + personality = randomread; + nthreads = 16; + iosize = 8k; +} + +CONFIG randomread1m { + function = generic; + personality = randomread; + nthreads = 16; + iosize = 1m; +} + +CONFIG randomwrite2k { + function = generic; + personality = randomwrite; + nthreads = 16; + iosize = 2k; +} + +CONFIG randomwrite8k { + function = generic; + personality = randomwrite; + nthreads = 16; + iosize = 8k; +} + +CONFIG randomwrite1m { + function = generic; + personality = randomwrite; + nthreads = 16; + iosize = 1m; +} + +CONFIG singlestreamread1m { + function = generic; + personality = singlestreamread; + iosize = 1m; +} + +CONFIG singlestreamreaddirect1m { + function = generic; + personality = singlestreamreaddirect; + iosize = 1m; +} + +CONFIG singlestreamwrite1m { + function = generic; + personality = singlestreamwrite; + iosize = 1m; +} + +CONFIG singlestreamwritedirect1m { + function = generic; + personality = singlestreamwritedirect; + iosize = 1m; +} + +CONFIG multistreamread1m { + function = generic; + personality = multistreamread; + iosize = 1m; +} + +CONFIG multistreamreaddirect1m { + function = generic; + personality = multistreamreaddirect; + iosize = 1m; +} + +CONFIG multistreamwrite1m { + function = generic; + personality = multistreamwrite; + iosize = 1m; +} + +CONFIG multistreamwritedirect1m { + function = generic; + personality = multistreamwritedirect; + iosize = 1m; +} + diff --git a/usr/src/test/smbclient-tests/config/filemacro.prof b/usr/src/test/smbclient-tests/config/filemacro.prof new file mode 100644 index 0000000000..fcf8431081 --- /dev/null +++ b/usr/src/test/smbclient-tests/config/filemacro.prof @@ -0,0 +1,128 @@ +# +# 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. +# + +DEFAULTS { + runtime = 120; + dir = /var/tmp/smbclnt/mnt; + stats = /tmp; + filesystem = tmpfs; + description = "filemacro tmpfs"; +} + +CONFIG fileserver { + function = generic; + personality = fileserver; + nfiles = 20000; + meandirwidth = 20; + filesize = 2k; + nthreads = 100; + meaniosize = 16k; +} + +CONFIG varmail { + personality = varmail; + function = generic; + nfiles = 20000; + meandirwidth = 1000000; + filesize = 1k; + nthreads = 16; + meaniosize = 16k; +} + +CONFIG webproxy { + personality = webproxy; + function = generic; + nfiles = 20000; + meandirwidth = 1000000; + filesize = 1k; + nthreads = 100; + meaniosize = 16k; +} + +CONFIG webserver { + personality = webserver; + function = generic; + nfiles = 20000; + meandirwidth = 20; + filesize = 1k; + nthreads = 100; +} + +CONFIG large_db_oltp_2k_cached { + personality = oltp; + function = generic; + cached = 1; + directio = 0; + iosize = 2k; + nshadows = 200; + ndbwriters = 10; + usermode = 20000; + filesize = 1g; + memperthread = 1m; + workingset = 0; +} + +CONFIG large_db_oltp_2k_uncached { + personality = oltp; + function = generic; + cached = 0; + directio = 1; + iosize = 2k; + nshadows = 200; + ndbwriters = 10; + usermode = 20000; + filesize = 1g; + memperthread = 1m; + workingset = 0; +} + +CONFIG large_db_oltp_8k_cached { + personality = oltp; + function = generic; + cached = 1; + directio = 0; + iosize = 8k; + nshadows = 200; + ndbwriters = 10; + usermode = 20000; + filesize = 1g; + memperthread = 1m; + workingset = 0; +} + +CONFIG large_db_oltp_8k_uncached { + personality = oltp; + function = generic; + cached = 0; + directio = 1; + iosize = 8k; + nshadows = 200; + ndbwriters = 10; + usermode = 20000; + filesize = 1g; + memperthread = 1m; + workingset = 0; +} + diff --git a/usr/src/test/smbclient-tests/config/filemicro.prof b/usr/src/test/smbclient-tests/config/filemicro.prof new file mode 100644 index 0000000000..145bed44e7 --- /dev/null +++ b/usr/src/test/smbclient-tests/config/filemicro.prof @@ -0,0 +1,142 @@ +# +# 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. +# + +DEFAULTS { + runtime = 60; + dir = /var/tmp/smbclnt/mnt; + stats = /tmp; + filesystem = tmpfs; + description = "filemicro tmpfs"; +} + +CONFIG createandalloc { + function = generic; + personality = filemicro_create; +} + +CONFIG createandallocsync { + function = generic; + personality = filemicro_create; + sync = true; +} + +CONFIG createallocfsync { + function = generic; + personality = filemicro_writefsync; +} + +CONFIG createallocappend { + function = generic; + personality = filemicro_createrand; +} + +CONFIG randread2k { + function = generic; + personality = filemicro_rread; +} + +CONFIG randread2kcached { + function = generic; + personality = filemicro_rread; + cached = true; +} + +CONFIG randwrite2ksync { + function = generic; + personality = filemicro_rwrite; + sync = true; +} + +CONFIG randwrite2ksync4thread { + function = generic; + personality = filemicro_rwrite; + nthreads = 4; + sync = true; +} + +CONFIG randwrite8kfsynccached { + function = generic; + personality = filemicro_rwritefsync; + cached = true; +} + +CONFIG seqread32k { + function = generic; + personality = filemicro_seqread; + iosize = 32k; + filesize = 100m; +} + +CONFIG seqread32kcached { + function = generic; + personality = filemicro_seqread; + iosize = 32k; + filesize = 100m; + cached = true; +} + +CONFIG seqwrite32k { + function = generic; + personality = filemicro_seqwrite; + iosize = 32k; +} + +CONFIG seqwrite32kdsync { + function = generic; + personality = filemicro_seqwrite; + iosize = 32k; + sync = true; +} + +CONFIG seqwriterand8k { + function = generic; + personality = filemicro_seqwriterand; +} + +CONFIG unlink1g { + function = generic; + personality = filemicro_delete; + nthreads = 1; +} + +CONFIG createfiles { + function = generic; + personality = filemicro_createfiles; +} + +CONFIG rwritedsync { + function = generic; + personality = filemicro_rwritedsync; +} + +CONFIG filemicro_seqwriterandvargam { + function = generic; + personality = filemicro_seqwriterandvargam; +} + +CONFIG filemicro_seqwriterandvartab { + function = generic; + personality = filemicro_seqwriterandvartab; +} diff --git a/usr/src/test/smbclient-tests/config/generic.func b/usr/src/test/smbclient-tests/config/generic.func new file mode 100644 index 0000000000..db5bc07279 --- /dev/null +++ b/usr/src/test/smbclient-tests/config/generic.func @@ -0,0 +1,68 @@ +# +# 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. +# + +sub pre_run { + # Initialize filebench to appropriate personality, create files + # and processes + op_init(); + + # The op_load command automatically creates files + op_load(conf_reqval("personality")); + + # Flush the FS cache + op_command("system \"" . get_FILEBENCH() . "/scripts/fs_flush " . conf_reqval("filesystem") . " " . conf_reqval("dir") . "\""); + + # Initialise statistics and argument arrays + @ext_stats=(); + @file_stats=(); + @arg_stats=(); +} + +sub post_run { + my $statsbase = get_STATSBASE(); + # Shutdown processes and quit filebench + op_quit(); + # Create a html summary of the run + system ("cd $statsbase; " . get_FILEBENCH() . "/scripts/filebench_compare $statsbase") +} + +sub bm_run { + my $runtime = conf_reqval("runtime"); + my $fs = get_CONFNAME(); + + # The following array must not contain empty values ! This causes the + # statistics scripts to miss arguments ! + # Clear, run the benchmark, snap statistics + # This command will also run external statistics (supplied in an array) + # if desired + # Statistics automatically dumped into directory matching stats + # profile variable + # <stats>/<hostname>-<date-time>/<personality> + + # create processes and start run, then collect statistics + op_stats($runtime,"stats.$fs",@ext_stats,@file_stats,@arg_stats); +} + +1; diff --git a/usr/src/test/smbclient-tests/config/randomread.prof b/usr/src/test/smbclient-tests/config/randomread.prof new file mode 100644 index 0000000000..0f35394299 --- /dev/null +++ b/usr/src/test/smbclient-tests/config/randomread.prof @@ -0,0 +1,40 @@ +# +# 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. +# + +DEFAULTS { + runtime = 60; + dir = /var/tmp/smbclnt/mnt; + stats = /tmp; + filesystem = tmpfs; + description = "randomread tmpfs"; +} + +CONFIG randomread2k { + function = generic; + personality = randomread; + filesize = 160m; + iosize = 2k; + nthreads = 1; +} diff --git a/usr/src/test/smbclient-tests/config/seqread.prof b/usr/src/test/smbclient-tests/config/seqread.prof new file mode 100644 index 0000000000..c91e33eeec --- /dev/null +++ b/usr/src/test/smbclient-tests/config/seqread.prof @@ -0,0 +1,40 @@ +# +# 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. +# + +DEFAULTS { + runtime = 120; + dir = /var/tmp/smbclnt/mnt; + stats = /tmp; + filesystem = tmpfs; + description = "seqread tmpfs"; +} + +CONFIG seqread1m { + function = generic; + personality = multistreamread; + filesize = 40m; + iosize = 1m; + nthreads = 1; +} diff --git a/usr/src/test/smbclient-tests/doc/Makefile b/usr/src/test/smbclient-tests/doc/Makefile new file mode 100644 index 0000000000..f6bf067141 --- /dev/null +++ b/usr/src/test/smbclient-tests/doc/Makefile @@ -0,0 +1,34 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../Makefile.com + +DOCS= README + +ROOTDOCS= $(DOCS:%=$(ROOTOPTPKG)/%) +$(ROOTDOCS) := FILEMODE = 0444 + +all: $(DOCS) + +install: $(ROOTOPTPKG) $(ROOTDOCS) + +clean lint clobber: + +$(ROOTOPTPKG): + $(INS.dir) + +$(ROOTOPTPKG)/%: % + $(INS.file) diff --git a/usr/src/test/smbclient-tests/doc/README b/usr/src/test/smbclient-tests/doc/README new file mode 100644 index 0000000000..705dd93e14 --- /dev/null +++ b/usr/src/test/smbclient-tests/doc/README @@ -0,0 +1,144 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + + +Contents: + +1. Introduction +2. How to configure SMB client +3. How to configure native SMB server +4. How to configure Windows 2003/2008 server (manual) +5. How to run the tests +6. How to get test result and logs + + +1. Introduction + +This test suite is designed for SMB client testing. It needs +two machines (a test client and a SMB server) and the test suite runs +on the client machine. + +Server machine can be one of the following systems: + + 1. Native SMB Server + 2. Windows 2003 + 3. Windows 2008 + +User must run the test suite as an ordinary user (not root) +and that user must be able to "sudo" without a password. + +This testsuite also uses filebench, a framework of file system +workloads for measuring and comparing file system performance. +This testsuite uses the default configuration of filebench. + + +2. How to configure SMB client + + - Install the "expect" package + + # pkg install shell/expect + + - Install the "Test Runner" package + + # pkg install system/test/testrunner + + - Create test directory, owned by whoever will run these tests. + + # mkdir /var/tmp/smbclnt + # chown $USER /var/tmp/smbclnt + + - Create additional test users: smbusera, smbuserb, smbuserc + + # useradd -u 20100 -g 1 -d /export/home/smbusera smbusera + # useradd -u 20101 -g 1 -d /export/home/smbuserb smbuserb + # useradd -u 20102 -g 1 -d /export/home/smbuserc smbuserc + + Set passwords on those accounts, i.e. + + # echo A_nex_123 | passwd smbusera + # echo B_nex_123 | passwd smbuserb + # echo C_nex_123 | passwd smbuserc + + Make sure those account names and passwords agree with the + variable settings in ../include/default_cfg.ksh + The accounts, UIDs, and passwords can be whatever you like, + but must be consistent with default_cfg.ksh + +3. How to configure native SMB server + + - Do as described in step 4 (windows server) + + +4. How to configure Windows 2003/2008 server (manual) + + - Create test users (listed names and passwords are the default + ones, check config/config file to see/change them) + - Create user smbusera and use "A_nex_123" as its password + - Create user smbuserb and use "B_nex_123" as its password + - Create user smbuserc and use "C_nex_123" as its password + + - Create test directories + - Create three windows share directories in a partition which has + more than 4G free space. The directory names are public, + a_share and b_share. + + - Set permissions + - Assign read/write permission for the "public" share directory + to the following users: smbusera, smbuserb, smbuserc + - Assign read/write permission for the "a_share" share directory + to the following user: smbusera. + - Assign read/write permission for the "b_share" share directory + to the following user: smbuserb. + + - Disable firewall + + +5. How to run the tests + + - Prerequisites: configure client and server (see above). + + - Install an "exepct" package, i.e. with IPS + pkg install shell/expect + + - Export the environment variables: + + # export SRV=servername + + - To run the all test cases, use the following command + + # /opt/smbclient-tests/bin/smbclienttest + + - To run a single test case, create a custom "run file" + based on: /opt/smbclient-tests/runfiles/default.run + and specify that run file via: + + # /opt/smbclient-tests/bin/smbclienttest -c custom.run + + +6. How to get the test result and logs + +Test results are saved in a directory under /var/tmp, e.g. +/var/tmp/test_results/{date_stamp} diff --git a/usr/src/test/smbclient-tests/include/Makefile b/usr/src/test/smbclient-tests/include/Makefile new file mode 100644 index 0000000000..120b2ee89c --- /dev/null +++ b/usr/src/test/smbclient-tests/include/Makefile @@ -0,0 +1,41 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../Makefile.com + +INCS= \ + default_cfg.ksh \ + libtest.ksh \ + services_common.ksh \ + smbmount_common.ksh \ + smbutil_common.ksh \ + utils_common.ksh \ + xattr_common.ksh + +ROOTINCS= $(INCS:%=$(ROOTINCDIR)/%) +$(ROOTINCS) := FILEMODE = 0444 + +all lint clean clobber: + +install: $(ROOTINCS) + +$(ROOTINCS): $(ROOTINCDIR) + +$(ROOTINCDIR): + $(INS.dir) + +$(ROOTINCDIR)/%: % + $(INS.file) diff --git a/usr/src/test/smbclient-tests/include/default_cfg.ksh b/usr/src/test/smbclient-tests/include/default_cfg.ksh new file mode 100644 index 0000000000..71961cbc50 --- /dev/null +++ b/usr/src/test/smbclient-tests/include/default_cfg.ksh @@ -0,0 +1,74 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +# testdir base +export TESTDS=smbclnt +export TBASEDIR=/var/tmp/$TESTDS +export TMNT=$TBASEDIR/mnt +export TMNT2=$TBASEDIR/mnt2 +export TDIR=$TBASEDIR/test + +# Users for SMB client authentication testing +# Share names (public, a_share, b_share) are hard-coded in the tests. +export AUSER=smbusera +export AUSERUID=20100 +export APASS=A_nex_123 +export BUSER=smbuserb +export BUSERUID=20101 +export BPASS=B_nex_123 +export TUSER=smbuserc +export TUSERUID=20102 +export TPASS=C_nex_123 + +# Should replace this in the few tests that use $TUSER1 +export TUSER1=$BUSER + +# User groups +export SMBGRP=smbgrp +export SMBGRPGID=2000 +export SMBGRP1=smbgrp1 +export SMBGRP1GID=2001 + +# Share group name +export SHAREGRP=smbclient + +# expect tools +export EXPECT=${EXPECT:-"/usr/bin/expect"} + +# utility for set password for cifs user on the server side +export PASSWDEXP=${PASSWDEXP:-"${STF_SUITE}/bin/passwd.exp"} + +# utility for create the keychain for the cifs user +export SMBUTILEXP=${STF_SUITE}/bin/smbutil.exp + +# utility to truncate the file +export FILETRUNC=${STF_SUITE}/bin/file_trunc + +# large data file (read-only) used for copy tests, etc. +export REFFILE=/usr/lib/libc.so.1 + +# avoid testruner timeouts (set by smbclienttest -f) +# export STC_QUICK=1 diff --git a/usr/src/test/smbclient-tests/include/libtest.ksh b/usr/src/test/smbclient-tests/include/libtest.ksh new file mode 100644 index 0000000000..c3fe16be4a --- /dev/null +++ b/usr/src/test/smbclient-tests/include/libtest.ksh @@ -0,0 +1,39 @@ +#!/usr/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. +# + +# +# common includes for smbclint-tests +# + +. ${STF_SUITE}/include/default_cfg.ksh + +. ${STF_SUITE}/include/services_common.ksh +. ${STF_SUITE}/include/smbutil_common.ksh +. ${STF_SUITE}/include/utils_common.ksh +. ${STF_SUITE}/include/smbmount_common.ksh +. ${STF_SUITE}/include/xattr_common.ksh + +. ${STF_TOOLS}/contrib/include/ctiutils.shlib diff --git a/usr/src/test/smbclient-tests/include/services_common.ksh b/usr/src/test/smbclient-tests/include/services_common.ksh new file mode 100644 index 0000000000..9caeed4491 --- /dev/null +++ b/usr/src/test/smbclient-tests/include/services_common.ksh @@ -0,0 +1,86 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# NAME +# service_enable +# +# DESCRIPTION +# Enable service +# +# RETURN +# 0 - enabled service +# 1 - failed to enable service +# +service_enable () { + smf=$1 + + status=$(svcprop -p restarter/state $smf) + if [[ $status == "online" ]]; then + cti_report "service '$smf' is already enabled" + return 0 + fi + + svcadm enable -rs $smf +} + +# +# NAME +# service_disable +# +# DESCRIPTION +# Disable service +# +# RETURN +# 0 - disabled service +# 1 - failed to disable service +# +service_disable () { + smf=$1 + + status=$(svcprop -p restarter/state $smf) + if [[ $status == "disabled" ]]; then + cti_report "PASS: service '$smf' is already disabled" + return 0 + fi + svcadm disable -s $smf +} + +# +# NAME +# service_restart +# +# DESCRIPTION +# Restart service +# +# RETURN +# 0 - restarted service +# 1 - failed to restart service +# +service_restart () { + smf=$1 + + svcadm restart $smf +} diff --git a/usr/src/test/smbclient-tests/include/smbmount_common.ksh b/usr/src/test/smbclient-tests/include/smbmount_common.ksh new file mode 100644 index 0000000000..6e68bfdb6e --- /dev/null +++ b/usr/src/test/smbclient-tests/include/smbmount_common.ksh @@ -0,0 +1,148 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# NAME +# smbmount_init +# +# DESCRIPTION +# Create mount point for smbfs +# +# RETURN +# 0 - create successfully +# 1 - create failed +# +smbmount_init() { + rm -rf $1 + cti_execute_cmd "mkdir $1" + if [[ $? != 0 ]]; then + cti_unresolved "UNRESOLVED: mkdir $1 failed" + exit 1 + else + cti_report "PASS: mkdir $1 successfully" + fi + return 0 +} + +# +# NAME +# testdir_init +# +# DESCRIPTION +# Create the test directory for smbfs testing +# +# RETURN +# 0 - create successfully +# 1 - create failed +# +testdir_init() { + rm -rf $1 + cti_execute_cmd "mkdir $1" + if [[ $? != 0 ]]; then + cti_unresolved "UNRESOLVED: mkdir $1 failed" + exit 1 + else + cti_report "PASS: mkdir $1 successfully" + fi + return 0 +} + +# +# NAME +# smbmount_getmntopts +# +# DESCRIPTION +# Get the mount options string for the passed mount point, +# (i.e. remote/read/write/setuid/devices/intr/xattr/dev=...) +# which is copied to stdout for use by the caller. +# +# RETURN +# 0 - the mount is found, and is an smbfs mount +# 1 - any problem (no stdout in error cases) +# +smbmount_getmntopts() { + typeset res on mp tp mtype opts rest + /usr/sbin/mount -v | + while read res on mp tp mtype opts rest + do + if [[ "$mp" == "$1" ]] ; then + if [[ $mtype != smbfs ]] ; then + echo "$1: not an smbfs mount" >&2 + return 1 + fi + echo "$opts" + return 0 + fi + done + echo "$1: no such mount point" >&2 + return 1 +} + +# +# NAME +# smbmount_check +# +# DESCRIPTION +# verify the passed dir is an smbfs mount +# +# RETURN +# 0 - it is an smbfs mount (successful) +# 1 - it is not... (fail) +# +smbmount_check() { + cti_execute FAIL smbmount_getmntopts "$1" + return $? +} + +# +# NAME +# smbmount_clean +# +# DESCRIPTION +# umount the smbfs and cleanup the mount point +# +# RETURN +# 0 - umount and cleanup successfully +# 1 - umount or cleanup failed +# +smbmount_clean() { + + # is it mounted? + smbmount_getmntopts "$1" >/dev/null 2>&1 + if [[ $? == 0 ]]; then + cti_execute_cmd sudo -n "umount -f $1" + if [[ $? != 0 ]]; then + cti_report "umount -f $1 failed" + exit 1 + fi + fi + + rm -rf $1 + if [[ $? != 0 ]]; then + cti_report "rm -rf $1 failed" + exit 1 + fi + return 0 +} diff --git a/usr/src/test/smbclient-tests/include/smbutil_common.ksh b/usr/src/test/smbclient-tests/include/smbutil_common.ksh new file mode 100644 index 0000000000..dfcce2d5f3 --- /dev/null +++ b/usr/src/test/smbclient-tests/include/smbutil_common.ksh @@ -0,0 +1,90 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# NAME +# parse_status_output +# +# DESCRIPTION +# Parse the output of the smbutil status, and print the +# workgroup and the server +# +# RETURN +# no return +# + +parse_status_output() { + typeset w_tag a_tag Workgroup Server + w_tag=0 + s_tag=0 + while getopts w:s: opt + do + case $opt in + w) + w_tag=1 + output="$OPTARG";; + s) + s_tag=1 + output="$OPTARG";; + esac + done + if [[ w_tag == 1 ]]; then + Workgroup=$(cat $output|grep Workgroup \ + |awk -F: '{print $2}') + echo $Workgroup + else + Server=$(cat $output|grep Server \ + |awk -F: '{print $2}') + echo $Server + fi +} + +# +# NAME +# parse_view_output +# +# DESCRIPTION +# Parse the output of the smbutil view, and print the shares +# +# RETURN +# 0 - success +# +parse_view_output() { + typeset share str + share=$1 + stdout=$2 + str=$(cat $stdout |grep -v -- "---"|grep $share) + name=$(echo $str |awk '{print $1}') + type=$(echo $str |awk '{print $2}') + if [[ "$name" != "$share" ]]; then + cti_fail "FAIL: share name should be $share" + return 1 + fi + if [[ "$type" != "disk" ]]; then + cti_fail "FAIL: share type is $type, should be disk" + return 1 + fi + return 0 +} diff --git a/usr/src/test/smbclient-tests/include/utils_common.ksh b/usr/src/test/smbclient-tests/include/utils_common.ksh new file mode 100644 index 0000000000..8fd81e8dcf --- /dev/null +++ b/usr/src/test/smbclient-tests/include/utils_common.ksh @@ -0,0 +1,110 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# NAME +# print_test_case +# +# DESCRIPTION +# Print the test case name to the results formated to fit with +# 60 characters. +# +# RETURN +# no return +# +print_test_case() { + cti_report "=======================================================" + cti_report "Test case $*" + cti_report "=======================================================" +} + + +# +# NAME +# do_nothing +# +# DESCRIPTION +# Didn't do anything on the system +# +# RETURN +# no return +# +do_nothing() { + cti_report "do nothing" +} + +# +# NAME +# no_tested +# +# DESCRIPTION +# Determine if need to trun the test case +# +# RETURN +# 0 - the test case will run +# 1 - the test case will not run +# +no_tested() { + cti_result NOTINUSE +} + +# +# NAME +# server_name +# +# DESCRIPTION +# Function used to sync with client and server +# +# RETURN +# 0 - sync successfully +# 1 - sync failed +# +server_name() { + if [[ -z $SRV ]]; then + cti_report "SRV not set" + cti_result UNRESOLVED + return 1 + fi + server=$SRV + echo $server + return 0 +} + +# +# NAME +# file_size +# +# DESCRIPTION +# Print the file size +# +# RETURN +# no return +# +file_size() { + typeset file=$1 + typeset -a arr + set -A arr x$(ls -l $file 2>/dev/null || echo 0 0 0 0 0); + echo "${arr[4]}" +} diff --git a/usr/src/test/smbclient-tests/include/xattr_common.ksh b/usr/src/test/smbclient-tests/include/xattr_common.ksh new file mode 100644 index 0000000000..2099bcb889 --- /dev/null +++ b/usr/src/test/smbclient-tests/include/xattr_common.ksh @@ -0,0 +1,193 @@ +# +# 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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# a function that takes a file, then creates and verifies +# an xattr on that file. The xattr_contents is the file +# that should appear in the xattr namespace. + +function create_xattr +{ # filename xattr_name xattr_contents + typeset FILE=$1 + typeset XATTR_NAME=$2 + typeset XATTR_CONTENTS=$3 + + # read any empty xattr dir on that file + cti_execute_cmd "runat $FILE ls" + + # create the xattr + cti_execute FAIL "runat $FILE cp $XATTR_CONTENTS $XATTR_NAME" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function create_xattr: "\ + "create xattr-of-$FILE failed unexpectedly" + return + fi + + verify_xattr $FILE $XATTR_NAME $XATTR_CONTENTS +} + +# a function that compares the a single xattr between two files +# and checks to see if their contents are identical + +function compare_xattrs +{ # filename1 filename2 xattr_name + typeset FILE1=$1 + typeset FILE2=$2 + typeset XATTR_NAME=$3 + + cti_execute_cmd "runat $FILE1 cat $XATTR_NAME > /tmp/file1.$$" + cti_execute_cmd "runat $FILE2 cat $XATTR_NAME > /tmp/file2.$$" + cti_execute_cmd "diff /tmp/file1.$$ /tmp/file2.$$ \ + >> /tmp/diffout.$$ 2>&1" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function compare_xattrs: "\ + "compare xattr-of-$FILE1 with xattr-of-$FILE2 "\ + "failed unexpectedly" + cti_report "diff xattrs-of-$FILE1 xattrs-of-$FILE2 "\ + "printed you can see the file /tmp/diffout.$$" + return + else + cti_report "PASS:In function compare_xattrs: "\ + "compare xattr-of-$FILE1 with xattr-of-$FILE2 "\ + "succeeded as expected" + fi + + cti_execute_cmd "rm /tmp/file1.$$ /tmp/file2.$$" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function compare_xattrs: "\ + "rm temp file: /tmp/file1.$$ /tmp/file2.$$ "\ + "failed unexpectedly" + return + else + cti_report "PASS:In function compare_xattrs: "\ + "rm temp file: /tmp/file1.$$ /tmp/file2.$$ "\ + "succeeded as expected" + fi +} + +# verify xattr exists and has content matching xattr_contents + +function verify_xattr +{ # filename xattr_name xattr_contents + typeset FILE=$1 + typeset XATTR_NAME=$2 + typeset XATTR_CONTENTS=$3 + + cti_execute_cmd "runat $FILE diff $XATTR_NAME $XATTR_CONTENTS" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function verify_xattr: "\ + "verify xattr-of-$FILE failed unexpectedly" + return + fi +} + +function delete_xattr +{ # filename xattr_name + typeset FILE=$1 + typeset XATTR_NAME=$2 + + # delete the xattr + cti_execute_cmd "runat $FILE rm $XATTR_NAME" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function delete_xattr: "\ + "delete xattr-of-$FILE failed unexpectedly" + return + else + cti_report "PASS:In function delete_xattr: "\ + "delete xattr-of-$FILE succeeded as expected" + fi + + # make sure it's gone (ls should fail) + cti_execute PASS "runat $FILE ls $XATTR_NAME" + if [[ $? == 0 ]]; then + cti_fail "FAIL:In function delete_xattr: "\ + "$FILE has xattr named $XATTR_NAME unexpectedly" + return + else + cti_report "PASS:In function delete_xattr: "\ + "$FILE does not have xattr named "\ + "$XATTR_NAME as expected" + fi + +} + +# not sure about this : really this should be testing write/append + +function verify_write_xattr +{ # filename xattr_name + typeset FILE=$1 + typeset XATTR_NAME=$2 + + cti_execute_cmd "runat $FILE dd if=/etc/passwd of=$XATTR_NAME" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function verify_write_xattr: "\ + "create xattr-of-$FILE named $XATTR_NAME "\ + "failed unexpectedly" + return + else + cti_report "PASS:In function verify_write_xattr: "\ + "create xattr-of-$FILE named $XATTR_NAME succeeded" + fi + + cti_execute_cmd "runat $FILE cat $XATTR_NAME \ + > /tmp/$XATTR_NAME.$$ 2>&1" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function verify_write_xattr: "\ + "cat xattr-of-$FILE named $XATTR_NAME "\ + "failed unexpectedly" + return + else + cti_report "PASS:In function verify_write_xattr: "\ + "cat xattr-of-$FILE named $XATTR_NAME succeeded" + fi + + cti_execute_cmd "dd if=/etc/passwd of=/tmp/passwd_dd.$$" + cti_execute_cmd "diff /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$" + if [[ $? != 0 ]]; then + cti_fail "FAIL:In function verify_write_xattr: "\ + "diff xattr-of-$FILE named $XATTR_NAME failed" + return + else + cti_report "PASS:In function verify_write_xattr: "\ + "diff xattr-of-$FILE named $XATTR_NAME succeeded" + fi + + cti_execute_cmd "rm /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$" +} + +# this function is to create the expected output + +function create_expected_output +{ # expected_output_file contents_of_the_output + typeset FILE=$1 + shift + if [[ -e $FILE ]]; then + cti_execute_cmd "rm $FILE" + fi + + for line in $@ + do + cti_execute_cmd "echo $line >> $FILE" + done + } diff --git a/usr/src/test/smbclient-tests/runfiles/Makefile b/usr/src/test/smbclient-tests/runfiles/Makefile new file mode 100644 index 0000000000..31ade81fdc --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/Makefile @@ -0,0 +1,44 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +include $(SRC)/Makefile.master + +SRCS = default.run \ + just-nsmbrc.run \ + just-sharectl.run \ + just-smbfs.run \ + just-smbmount.run \ + just-smbutil.run \ + perf-regression.run + +ROOTOPTPKG = $(ROOT)/opt/smbclient-tests +RUNFILES = $(ROOTOPTPKG)/runfiles + +CMDS = $(SRCS:%=$(RUNFILES)/%) +$(CMDS) := FILEMODE = 0444 + +all: $(SRCS) + +install: $(CMDS) + +clean lint clobber: + +$(CMDS): $(RUNFILES) $(SRCS) + +$(RUNFILES): + $(INS.dir) + +$(RUNFILES)/%: % + $(INS.file) diff --git a/usr/src/test/smbclient-tests/runfiles/default.run b/usr/src/test/smbclient-tests/runfiles/default.run new file mode 100644 index 0000000000..7c88af2836 --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/default.run @@ -0,0 +1,85 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = +verbose = False +quiet = False +timeout = 60 +post = +outputdir = /var/tmp/test_results +user = + +[/opt/smbclient-tests/tests/nsmbrc] +tests = ['tp_nsmbrc_001', 'tp_nsmbrc_002', 'tp_nsmbrc_003', 'tp_nsmbrc_004', + 'tp_nsmbrc_005', 'tp_nsmbrc_006'] + +[/opt/smbclient-tests/tests/sharectl] +tests = ['tp_sharectl_001', 'tp_sharectl_002', 'tp_sharectl_003', + 'tp_sharectl_004', 'tp_sharectl_005', 'tp_sharectl_006'] +user = root + +[/opt/smbclient-tests/tests/smbfs/acl] +tests = ['tp_acl_001', 'tp_acl_002', 'tp_acl_003', 'tp_acl_004', 'tp_acl_005'] + +[/opt/smbclient-tests/tests/smbfs/cptest] +tests = ['tp_cptest_001', 'tp_cptest_002', 'tp_cptest_003', 'tp_cptest_004', + 'tp_cptest_005', 'tp_cptest_006', 'tp_cptest_007', 'tp_cptest_008', + 'tp_cptest_009'] +timeout = 600 + +[/opt/smbclient-tests/tests/smbfs/create] +tests = ['tp_create_001', 'tp_create_002', 'tp_create_003', 'tp_create_004', + 'tp_create_005', 'tp_create_006', 'tp_create_007', 'tp_create_008', + 'tp_create_009', 'tp_create_010', 'tp_create_011', 'tp_create_012'] +timeout = 300 + +[/opt/smbclient-tests/tests/smbfs/error] +tests = ['tp_error_001', 'tp_error_002'] + +[/opt/smbclient-tests/tests/smbfs/misc] +tests = ['tp_misc_001', 'tp_misc_002', 'tp_misc_003'] + +[/opt/smbclient-tests/tests/smbfs/mkdir] +tests = ['tp_mkdir_001', 'tp_mkdir_002', 'tp_mkdir_003', 'tp_mkdir_004', + 'tp_mkdir_005', 'tp_mkdir_006'] + +[/opt/smbclient-tests/tests/smbfs/mmap] +tests = ['tp_mmap_001', 'tp_mmap_002', 'tp_mmap_003', 'tp_mmap_004', + 'tp_mmap_005', 'tp_mmap_006', 'tp_mmap_007', 'tp_mmap_008', + 'tp_mmap_009', 'tp_mmap_010'] + +[/opt/smbclient-tests/tests/smbfs/mvtest] +tests = ['tp_mvtest_001', 'tp_mvtest_002', 'tp_mvtest_003', 'tp_mvtest_004', + 'tp_mvtest_005', 'tp_mvtest_006', 'tp_mvtest_007'] + +[/opt/smbclient-tests/tests/smbfs/xattr] +tests = ['tp_xattr_001', 'tp_xattr_002', 'tp_xattr_003', 'tp_xattr_004', + 'tp_xattr_005', 'tp_xattr_006', 'tp_xattr_007', 'tp_xattr_008', + 'tp_xattr_009'] + +[/opt/smbclient-tests/tests/smbmount] +tests = ['tp_smbmount_001', 'tp_smbmount_002', 'tp_smbmount_003', + 'tp_smbmount_004', 'tp_smbmount_005', 'tp_smbmount_006', + 'tp_smbmount_007', 'tp_smbmount_008', 'tp_smbmount_009', + 'tp_smbmount_010', 'tp_smbmount_011', 'tp_smbmount_012', + 'tp_smbmount_013', 'tp_smbmount_014', 'tp_smbmount_015', + 'tp_smbmount_016'] + +[/opt/smbclient-tests/tests/smbutil] +tests = ['tp_smbutil_001', 'tp_smbutil_002', 'tp_smbutil_003', 'tp_smbutil_004', + 'tp_smbutil_005', 'tp_smbutil_006', 'tp_smbutil_007', 'tp_smbutil_008', + 'tp_smbutil_009', 'tp_smbutil_010', 'tp_smbutil_011', 'tp_smbutil_012', + 'tp_smbutil_013', 'tp_smbutil_014', 'tp_smbutil_015', 'tp_smbutil_016'] diff --git a/usr/src/test/smbclient-tests/runfiles/just-nsmbrc.run b/usr/src/test/smbclient-tests/runfiles/just-nsmbrc.run new file mode 100644 index 0000000000..aea325bd88 --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/just-nsmbrc.run @@ -0,0 +1,27 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = +verbose = False +quiet = False +timeout = 60 +post = +outputdir = /var/tmp/test_results +user = + +[/opt/smbclient-tests/tests/nsmbrc] +tests = ['tp_nsmbrc_001', 'tp_nsmbrc_002', 'tp_nsmbrc_003', 'tp_nsmbrc_004', + 'tp_nsmbrc_005', 'tp_nsmbrc_006'] diff --git a/usr/src/test/smbclient-tests/runfiles/just-sharectl.run b/usr/src/test/smbclient-tests/runfiles/just-sharectl.run new file mode 100644 index 0000000000..9a21e63ca7 --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/just-sharectl.run @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = +verbose = False +quiet = False +timeout = 60 +post = +outputdir = /var/tmp/test_results +user = + +[/opt/smbclient-tests/tests/sharectl] +tests = ['tp_sharectl_001', 'tp_sharectl_002', 'tp_sharectl_003', + 'tp_sharectl_004', 'tp_sharectl_005', 'tp_sharectl_006'] +user = root diff --git a/usr/src/test/smbclient-tests/runfiles/just-smbfs.run b/usr/src/test/smbclient-tests/runfiles/just-smbfs.run new file mode 100644 index 0000000000..8c553e4707 --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/just-smbfs.run @@ -0,0 +1,62 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = +verbose = False +quiet = False +timeout = 60 +post = +outputdir = /var/tmp/test_results +user = + +[/opt/smbclient-tests/tests/smbfs/acl] +tests = ['tp_acl_001', 'tp_acl_002', 'tp_acl_003', 'tp_acl_004', 'tp_acl_005'] + +[/opt/smbclient-tests/tests/smbfs/cptest] +tests = ['tp_cptest_001', 'tp_cptest_002', 'tp_cptest_003', 'tp_cptest_004', + 'tp_cptest_005', 'tp_cptest_006', 'tp_cptest_007', 'tp_cptest_008', + 'tp_cptest_009'] +timeout = 600 + +[/opt/smbclient-tests/tests/smbfs/create] +tests = ['tp_create_001', 'tp_create_002', 'tp_create_003', 'tp_create_004', + 'tp_create_005', 'tp_create_006', 'tp_create_007', 'tp_create_008', + 'tp_create_009', 'tp_create_010', 'tp_create_011', 'tp_create_012'] +timeout = 300 + +[/opt/smbclient-tests/tests/smbfs/error] +tests = ['tp_error_001', 'tp_error_002'] + +[/opt/smbclient-tests/tests/smbfs/misc] +tests = ['tp_misc_001', 'tp_misc_002', 'tp_misc_003'] + +[/opt/smbclient-tests/tests/smbfs/mkdir] +tests = ['tp_mkdir_001', 'tp_mkdir_002', 'tp_mkdir_003', 'tp_mkdir_004', + 'tp_mkdir_005', 'tp_mkdir_006'] + +[/opt/smbclient-tests/tests/smbfs/mmap] +tests = ['tp_mmap_001', 'tp_mmap_002', 'tp_mmap_003', 'tp_mmap_004', + 'tp_mmap_005', 'tp_mmap_006', 'tp_mmap_007', 'tp_mmap_008', + 'tp_mmap_009', 'tp_mmap_010'] + +[/opt/smbclient-tests/tests/smbfs/mvtest] +tests = ['tp_mvtest_001', 'tp_mvtest_002', 'tp_mvtest_003', 'tp_mvtest_004', + 'tp_mvtest_005', 'tp_mvtest_006', 'tp_mvtest_007'] + +[/opt/smbclient-tests/tests/smbfs/xattr] +tests = ['tp_xattr_001', 'tp_xattr_002', 'tp_xattr_003', 'tp_xattr_004', + 'tp_xattr_005', 'tp_xattr_006', 'tp_xattr_007', 'tp_xattr_008', + 'tp_xattr_009'] diff --git a/usr/src/test/smbclient-tests/runfiles/just-smbmount.run b/usr/src/test/smbclient-tests/runfiles/just-smbmount.run new file mode 100644 index 0000000000..cfccfa876d --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/just-smbmount.run @@ -0,0 +1,31 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = +verbose = False +quiet = False +timeout = 60 +post = +outputdir = /var/tmp/test_results +user = + +[/opt/smbclient-tests/tests/smbmount] +tests = ['tp_smbmount_001', 'tp_smbmount_002', 'tp_smbmount_003', + 'tp_smbmount_004', 'tp_smbmount_005', 'tp_smbmount_006', + 'tp_smbmount_007', 'tp_smbmount_008', 'tp_smbmount_009', + 'tp_smbmount_010', 'tp_smbmount_011', 'tp_smbmount_012', + 'tp_smbmount_013', 'tp_smbmount_014', 'tp_smbmount_015', + 'tp_smbmount_016'] diff --git a/usr/src/test/smbclient-tests/runfiles/just-smbutil.run b/usr/src/test/smbclient-tests/runfiles/just-smbutil.run new file mode 100644 index 0000000000..60ef07fcc8 --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/just-smbutil.run @@ -0,0 +1,29 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = +verbose = False +quiet = False +timeout = 60 +post = +outputdir = /var/tmp/test_results +user = + +[/opt/smbclient-tests/tests/smbutil] +tests = ['tp_smbutil_001', 'tp_smbutil_002', 'tp_smbutil_003', 'tp_smbutil_004', + 'tp_smbutil_005', 'tp_smbutil_006', 'tp_smbutil_007', 'tp_smbutil_008', + 'tp_smbutil_009', 'tp_smbutil_010', 'tp_smbutil_011', 'tp_smbutil_012', + 'tp_smbutil_013', 'tp_smbutil_014', 'tp_smbutil_015', 'tp_smbutil_016'] diff --git a/usr/src/test/smbclient-tests/runfiles/perf-regression.run b/usr/src/test/smbclient-tests/runfiles/perf-regression.run new file mode 100644 index 0000000000..7ceddfc2b5 --- /dev/null +++ b/usr/src/test/smbclient-tests/runfiles/perf-regression.run @@ -0,0 +1,26 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2015, 2016 by Delphix. All rights reserved. +# + +[DEFAULT] +pre = setup +quiet = False +pre_user = root +timeout = 0 +post = cleanup +outputdir = /var/tmp/test_results + +[/opt/smbclient-tests/tests/performance/filebench] +tests = ['tp_filebench_001', 'tp_filebench_002', 'tp_filebench_003', + 'tp_filebench_004', 'tp_filebench_005'] diff --git a/usr/src/test/smbclient-tests/tests/Makefile b/usr/src/test/smbclient-tests/tests/Makefile new file mode 100644 index 0000000000..bc4504e17c --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/Makefile @@ -0,0 +1,26 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +.PARALLEL: $(SUBDIRS) + +SUBDIRS= \ + nsmbrc \ + performance \ + sharectl \ + smbfs \ + smbmount \ + smbutil + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/smbclient-tests/tests/Makefile.tests b/usr/src/test/smbclient-tests/tests/Makefile.tests new file mode 100644 index 0000000000..1958953c9e --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/Makefile.tests @@ -0,0 +1,27 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +ROOTTESTS= $(TESTS:%=$(ROOTTESTDIR)/%) +$(ROOTTESTS) := FILEMODE = 0555 + +all lint clean clobber: + +install: $(ROOTTESTDIR) $(ROOTTESTS) + +$(ROOTTESTDIR): + $(INS.dir) + +$(ROOTTESTDIR)/%: %.ksh + $(INS.rename) diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/Makefile b/usr/src/test/smbclient-tests/tests/nsmbrc/Makefile new file mode 100644 index 0000000000..0ce698a0fd --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/Makefile @@ -0,0 +1,29 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/nsmbrc + +TESTS= \ + tp_nsmbrc_001 \ + tp_nsmbrc_002 \ + tp_nsmbrc_003 \ + tp_nsmbrc_004 \ + tp_nsmbrc_005 \ + tp_nsmbrc_006 + +include ../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_001.ksh b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_001.ksh new file mode 100644 index 0000000000..0fe3454037 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_001.ksh @@ -0,0 +1,78 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# ID:nsmbrc001 +# +# DESCRIPTION: +# Verify minauth can work in default +# +# STRATEGY: +# 1. create a .nsmbrc file include default section +# minauth=kerberos +# 2. run "smbutil view user@server and get the failure" +# 3. create a .nsmbrc file include server section minauth=kerberos +# 4. run "smbutil view user@server and get the failure" +# + +. $STF_SUITE/include/libtest.ksh + +set -x + +tc_id="nsmbrc001" +tc_desc="Verify minauth can work in default" +print_test_case $tc_id" - "$tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cti_execute_cmd "rm -f ~/.nsmbrc" +echo "[default] +minauth=kerberos" > ~/.nsmbrc + +# kill any existing session first +cti_execute_cmd "smbutil discon //$TUSER@$server" +sleep 1 + +# this should fail +cmd="smbutil view -N //$TUSER:$TPASS@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_execute_cmd "echo '::nsmb_vc' |sudo -n mdb -k" + cti_fail "FAIL: can pass authentication by minauth=kerberos" + return +else + cti_report "PASS: can't pass authentication by minauth=kerberos" +fi + +cti_execute_cmd "rm -f ~/.nsmbrc" + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_002.ksh b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_002.ksh new file mode 100644 index 0000000000..a3f7e85ce9 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_002.ksh @@ -0,0 +1,94 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# ID:nsmbrc002 +# +# DESCRIPTION: +# Verify password can work +# +# STRATEGY: +# 1. create a .nsmbrc file +# 2. run "smbutil view //$TUSER@server" +# 3. password works fine +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="nsmbrc002" +tc_desc="Verify password can work in nsmbrc" +print_test_case $tc_id" - "$tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cti_execute_cmd "rm -f ~/.nsmbrc" +pass=$(smbutil crypt $TPASS) +echo "[default]" > ~/.nsmbrc +echo "password=$pass" >> ~/.nsmbrc +cti_execute_cmd chmod 600 ~/.nsmbrc + +# kill any existing session first +cti_execute_cmd "smbutil discon //$TUSER@$server" +sleep 1 + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: password property in default section doesn't work" + return +else + cti_report "PASS: password property in default section works" +fi + + +SERVER=$(echo $server | tr "[:lower:]" "[:upper:]") +echo "[$SERVER]" > ~/.nsmbrc +echo "addr=$server" >> ~/.nsmbrc +echo "password=$pass" >> ~/.nsmbrc +cti_execute_cmd chmod 600 ~/.nsmbrc + +# kill any existing session first +cti_execute_cmd "smbutil discon //$TUSER@$server" +sleep 1 + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: password property in SERVER section doesn't work" + return +else + cti_report "PASS: password property in SERVER section works" +fi + +cti_execute_cmd "rm -f ~/.nsmbrc" + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_003.ksh b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_003.ksh new file mode 100644 index 0000000000..9fe2a3b872 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_003.ksh @@ -0,0 +1,110 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# ID:nsmbrc003 +# +# DESCRIPTION: +# Verify password can work +# +# STRATEGY: +# 1. create a .nsmbrc file +# 2. run "smbutil logoutall" +# 3. run "mount -F smbfs //$TUSER@$server/public $TMNT" +# 4. smbutil and mount can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="nsmbrc003" +tc_desc=" Verify password can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +smbmount_clean $TMNT +smbmount_init $TMNT + +server=$(server_name) || return + +cti_execute_cmd "rm -f ~/.nsmbrc" +pass=$(smbutil crypt $TPASS) +SERVER=$(echo $server | tr "[:lower:]" "[:upper:]") +echo "[$SERVER:$TUSER]" > ~/.nsmbrc +echo "addr=$server" >> ~/.nsmbrc +echo "password=$pass" >> ~/.nsmbrc +cti_execute_cmd "chmod 600 ~/.nsmbrc" + +smbutil logout -a + +# get rid of our connections +cti_execute_cmd "smbutil discon //$TUSER@$server" +cti_execute_cmd "smbutil discon //$TUSER1@$server" +sleep 1 + +cti_report "expect failure with $TUSER1" +cmd="smbutil view -N //$TUSER1@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: $SERVER:$TUSER works for $TUSER1" + return +else + cti_report "PASS: $SERVER:$TUSER does't work for $TUSER1" +fi + +cti_report "expect success with $TUSER" +cmd="truss -f -o smbutil.to smbutil view -N //$TUSER@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_pass "PASS: $SERVER:$TUSER works for $TUSER" +else + cti_fail "FAIL: $SERVER:$TUSER does't work for $TUSER" + return +fi + +cmd="mount -F smbfs //$TUSER@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $SERVER:$TUSER does't work for $TUSER" + return +else + cti_report "PASS: $SERVER:$TUSER works for $TUSER" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -f ~/.nsmbrc" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_004.ksh b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_004.ksh new file mode 100644 index 0000000000..6536decf77 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_004.ksh @@ -0,0 +1,77 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# ID:nsmbrc004 +# +# DESCRIPTION: +# Verify minauth can work on SERVER section +# +# STRATEGY: +# 1. create a .nsmbrc file +# 2. run "smbutil view //$TUSER:$TPASS@$server" +# 3. smbutil can get right messages +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="nsmbrc004" +tc_desc=" Verify minauth can work on SERVER section" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cti_execute_cmd "rm -f ~/.nsmbrc" + +SERVER=$(echo $server | tr "[:lower:]" "[:upper:]") +echo "[$SERVER]" > ~/.nsmbrc +echo "addr=$server" >> ~/.nsmbrc +echo "minauth=kerberos" >> ~/.nsmbrc + +# get rid of our connection +cti_execute_cmd "smbutil discon //$TUSER@$server" +sleep 1 + +cti_report "expect failure next" +cmd="smbutil view //$TUSER:$TPASS@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_execute_cmd "echo '::nsmb_vc' |sudo -n mdb -k" + cti_fail "FAIL: minauth property in SERVER section doesn't work" + return +else + cti_report "PASS: minauth property in SERVER section works" +fi + +cti_execute_cmd "rm -f ~/.nsmbrc" + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_005.ksh b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_005.ksh new file mode 100644 index 0000000000..e98512f733 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_005.ksh @@ -0,0 +1,95 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# ID:nsmbrc001 +# +# DESCRIPTION: +# Verify user and domain can work +# +# STRATEGY: +# 1. create a .nsmbrc file +# 2. run "smbutil view //$server" +# 3. run "mount -F smbfs //$server/public $TMNT" +# 4. smbutil and mount can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="nsmbrc005" +tc_desc=" Verify user and domain in user section can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cti_execute_cmd "rm -f ~/.nsmbrc" +smbmount_clean $TMNT +smbmount_init $TMNT + +pass=$(smbutil crypt $TPASS) +echo "[default]" > ~/.nsmbrc +echo "password=$pass" >> ~/.nsmbrc +echo "user=$TUSER" >> ~/.nsmbrc +echo "domain=mydomain" >> ~/.nsmbrc +cti_execute_cmd chmod 600 ~/.nsmbrc + +cmd="smbutil view //$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: user and domain property in default section doesn't work" + return +else + cti_report "PASS: user and domain property in default section works" + +fi + +cmd="mount -F smbfs //$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: user and domain property in default section doesn't work" \ + "for smb mount" + return +else + cti_report "PASS: user and domain properity in default section works for" \ + "smbmount" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -f ~/.nsmbrc" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_006.ksh b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_006.ksh new file mode 100644 index 0000000000..f2d2520aa4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_006.ksh @@ -0,0 +1,97 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# + +# +# ID:nsmbrc006 +# +# DESCRIPTION: +# Verify user and domain can work in .nsmbrc +# +# STRATEGY: +# 1. create a .nsmbrc file +# 2. run "smbutil view //$server" +# 3. run "mount -F smbfs //$server/public $TMNT" +# 4. smbutil and mount can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="nsmbrc006" +tc_desc=" Verify user and domain in sever section can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cti_execute_cmd "rm -f ~/.nsmbrc" +smbmount_clean $TMNT +smbmount_init $TMNT + +pass=$(smbutil crypt $TPASS) +SERVER=$(echo $server | tr "[:lower:]" "[:upper:]") +echo "[$SERVER]" > ~/.nsmbrc +echo "password=$pass" >> ~/.nsmbrc +echo "user=$TUSER" >> ~/.nsmbrc +echo "domain=mydomain" >> ~/.nsmbrc +cti_execute_cmd chmod 600 ~/.nsmbrc + +cmd="smbutil view //$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: user and domain properties in default SERVER section" \ + "don't work" + return +else + cti_report "PASS: user and domain properties in default SERVER section" \ + "work" +fi + +cmd="mount -F smbfs //$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: user and domain properties in default SERVER section" \ + "don't work" + return +else + cti_report "PASS: user and domain properties in default SERVER section" \ + "work" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -f ~/.nsmbrc" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/performance/Makefile b/usr/src/test/smbclient-tests/tests/performance/Makefile new file mode 100644 index 0000000000..32ffd0ce18 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/Makefile @@ -0,0 +1,21 @@ +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +.PARALLEL: $(SUBDIRS) + +SUBDIRS= filebench + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/smbclient-tests/tests/performance/filebench/Makefile b/usr/src/test/smbclient-tests/tests/performance/filebench/Makefile new file mode 100644 index 0000000000..750db70746 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/filebench/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/performance/filebench + +TESTS= \ + tp_filebench_001 \ + tp_filebench_002 \ + tp_filebench_003 \ + tp_filebench_004 \ + tp_filebench_005 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_001.ksh b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_001.ksh new file mode 100644 index 0000000000..3b362a6e9f --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_001.ksh @@ -0,0 +1,89 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: filebench_001 +# +# DESCRIPTION: +# Verify filebench fileio testing on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. run fileio filebench can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="filebench_001" +tc_desc=" Verify filebench on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT +sleep 3 + +cmd="ls -l $filebenchdir/filebench" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_report "FAIL: There is no filebench package, please install it." + cti_untested $tc_id + return +fi + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd + +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share \"public\" " + return +else + cti_report "PASS: smbmount mount the share successfully" +fi + + +rm -rf $TMNT/* + +#run fileio filebench +cti_execute_cmd $filebenchdir/filebench ${STF_SUITE}/config/fileio +if [[ $? != 0 ]]; then + cti_fail "FAIL: filebench fileio failed" + return +else + cti_report "PASS: filebench fileio successfully" +fi + +cti_execute_cmd rm -rf $TMNT/* +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_002.ksh b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_002.ksh new file mode 100644 index 0000000000..ebe2c07088 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_002.ksh @@ -0,0 +1,89 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: filebench_002 +# +# DESCRIPTION: +# Verify filebench filemacro on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. run filebench filemacro can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="filebench_002" +tc_desc=" Verify filebench on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT +sleep 3 + +cmd="ls -l $filebenchdir/filebench" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_report "FAIL: There is no filebench package, please install it." + cti_untested $tc_id + return +fi + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd + +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share \"public\" " + return +else + cti_report "PASS: smbmount mount the share successfully" +fi + + +rm -rf $TMNT/* + +#run fileio filebench +cti_execute_cmd $filebenchdir/filebench ${STF_SUITE}/config/filemacro +if [[ $? != 0 ]]; then + cti_fail "FAIL: filebench filemacro failed" + return +else + cti_report "PASS: filebench filemacro successfully" +fi + +cti_execute_cmd rm -rf $TMNT/* +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_003.ksh b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_003.ksh new file mode 100644 index 0000000000..daa2d421b1 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_003.ksh @@ -0,0 +1,89 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: filebench_003 +# +# DESCRIPTION: +# Verify filebench filemicro on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. filebench filemicro can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="filebench_003" +tc_desc=" Verify filebench on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT +sleep 3 + +cmd="ls -l $filebenchdir/filebench" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_report "FAIL: There is no filebench package, please install it." + cti_untested $tc_id + return +fi + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd + +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share \"public\" " + return +else + cti_report "PASS: smbmount mount the share successfully" +fi + + +rm -rf $TMNT/* + +#run fileio filebench +cti_execute_cmd $filebenchdir/filebench ${STF_SUITE}/config/filemicro +if [[ $? != 0 ]]; then + cti_fail "FAIL: filebench filemicro failed" + return +else + cti_report "PASS: filebench filemicro successfully" +fi + +cti_execute_cmd rm -rf $TMNT/* +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_004.ksh b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_004.ksh new file mode 100644 index 0000000000..faeb74a25b --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_004.ksh @@ -0,0 +1,89 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: filebench_004 +# +# DESCRIPTION: +# Verify filebench on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. filebench randomread can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="filebench_004" +tc_desc=" Verify filebench on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT +sleep 3 + +cmd="ls -l $filebenchdir/filebench" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_report "FAIL: There is no filebench package, please install it." + cti_untested $tc_id + return +fi + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd + +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share \"public\" " + return +else + cti_report "PASS: smbmount mount the share successfully" +fi + + +rm -rf $TMNT/* + +#run fileio filebench +cti_execute_cmd $filebenchdir/filebench ${STF_SUITE}/config/randomread +if [[ $? != 0 ]]; then + cti_fail "FAIL: filebench randomread failed" + return +else + cti_report "PASS: filebench randomread successfully" +fi + +cti_execute_cmd rm -rf $TMNT/* +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_005.ksh b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_005.ksh new file mode 100644 index 0000000000..dcc0446a9b --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/performance/filebench/tp_filebench_005.ksh @@ -0,0 +1,88 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: filebench_005 +# +# DESCRIPTION: +# Verify filebench fileio testing on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. run filebench seqread can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="filebench_005" +tc_desc=" Verify filebench on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT +sleep 3 + +cmd="ls -l $filebenchdir/filebench" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_report "FAIL: There is no filebench package, please install it." + cti_untested $tc_id + return +fi + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd + +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share \"public\" " + return +else + cti_report "PASS: smbmount mount the share successfully" +fi + +rm -rf $TMNT/* + +#run fileio filebench +cti_execute_cmd $filebenchdir/filebench ${STF_SUITE}/config/seqread +if [[ $? != 0 ]]; then + cti_fail "FAIL: filebench fileio failed" + return +else + cti_report "PASS: filebench fileio successfully" +fi + +cti_execute_cmd rm -rf $TMNT/* +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/sharectl/Makefile b/usr/src/test/smbclient-tests/tests/sharectl/Makefile new file mode 100644 index 0000000000..866e782869 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/Makefile @@ -0,0 +1,29 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/sharectl + +TESTS= \ + tp_sharectl_001 \ + tp_sharectl_002 \ + tp_sharectl_003 \ + tp_sharectl_004 \ + tp_sharectl_005 \ + tp_sharectl_006 + +include ../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_001.ksh b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_001.ksh new file mode 100644 index 0000000000..8de5320f45 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_001.ksh @@ -0,0 +1,82 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: sharectl_001 +# +# DESCRIPTION: +# Verify minauth can work in default +# +# STRATEGY: +# 1. run "sharectl set -p section=default -p minauth=kerberos smbfs" +# 2. run "smbutil view //$TUSER:$TPASS@$server" +# 3. sharectl and smbutil can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="sharectl001" +tc_desc=" Verify minauth can work in default" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cmd="sharectl set -p section=default -p minauth=kerberos smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set minauth in default section failed" + return +else + cti_report "succeed: sharectl set minauth in default section succeeded" +fi + +# this should fail +cmd="smbutil view //$TUSER:$TPASS@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil view succeeded for the minauth=kerberos" + sharectl delsect default smbfs + return +else + cti_report "PASS: smbutil view failed for the minath=kerberos" +fi + +cmd="sharectl delsect default smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl delsect default smbfs failed" + sharectl delsect default smbfs + return +else + cti_report "PASS: sharectl delsect default smbfs succeeded" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_002.ksh b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_002.ksh new file mode 100644 index 0000000000..32264e3ee3 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_002.ksh @@ -0,0 +1,116 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: sharectl_002 +# +# DESCRIPTION: +# Verify password can work +# +# STRATEGY: +# 1. run "sharectl set -p section=default -p password=$pass smbfs" +# 2. run "smbutil view //$TUSER@$server" +# 3. sharectl and smbutil can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="sharectl002" +tc_desc=" Verify password can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +SERVER=$(echo $server|tr "[:lower:]" "[:upper:]") +pass=$(smbutil crypt $TPASS) + +cmd="sharectl set -p section=default -p password=\$pass smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set password in default section failed" + return +else + cti_report "PASS: sharectl set password in default section succeeded" +fi + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view failed for default password" + return +else + cti_report "PASS: smbutil view succeeded for default password" +fi + +sharectl delsect default smbfs + +cmd="sharectl set -p section=$SERVER -p password=\$pass smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set password in $SERVER section failed" + return +else + cti_report "PASS: sharectl set password in $SERVER section succeed" +fi + +cmd="sharectl set -p section=$SERVER -p addr=$server smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set addr in $SERVER section failed" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: sharectl set addr in $SERVER section succeeded" +fi + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view failed for SERVER password" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: smbutil view succeeded for SERVER password" +fi + +cmd="smbutil view //$TUSER1@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view failed by $TUSER1 for SERVER password" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: smbutil view succeeded by $TUSER1 for SERVER password" +fi + +sharectl delsect $SERVER smbfs + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_003.ksh b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_003.ksh new file mode 100644 index 0000000000..cc0944c0fa --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_003.ksh @@ -0,0 +1,118 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: sharectl_003 +# +# DESCRIPTION: +# Verify password can work +# +# STRATEGY: +# 1. run "sharectl set -p section=$SERVER:$TUSER -p password=$pass smbfs" +# 2. run "sharectl set -p section=$SERVER:$TUSER -p addr=$server smbfs" +# 3. run "smbutil view //$TUSER1@$server" +# 4. run "mount -F smbfs //$TUSER@$server/public $TMNT" +# 3. sharectl, smbutil and mount can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="sharectl003" +tc_desc="Verify password can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +smbmount_clean $TMNT +smbmount_init $TMNT + +rm -rf ~root/.nsmbrc + +server=$(server_name) || return + +pass=$(smbutil crypt $TPASS) +SERVER=$(echo $server|tr "[:lower:]" "[:upper:]") + +cmd="sharectl set -p section=$SERVER:$TUSER -p password=\$pass smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set password in $SERVER section failed" + return +else + cti_report "PASS: sharectl set password in $SERVER section succeeded" +fi + +cmd="sharectl set -p section=$SERVER:$TUSER -p addr=$server smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set addr in $SERVER section failed" + sharectl delsect $SERVER:$TUSER smbfs + return +else + cti_report "PASS: sharectl set addr in $SERVER section succeeded" +fi + +smbutil logout -a + +# get rid of our connection first +cti_execute_cmd "smbutil discon //$TUSER1@$server" +sleep 1 + +cti_report "expect failure next" +cmd="smbutil view -N //$TUSER1@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil view succeeded for SERVER password by $TUSER1" + sharectl delsect $SERVER:$TUSER smbfs + return +else + cti_report "PASS: smbutil view ffailed for SERVER password by $TUSER1" +fi + +cmd="mount -F smbfs //$TUSER@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share by $TUSER" + sharectl delsect $SERVER:$TUSER smbfs + return +else + cti_report "PASS: smbmount can mount the public share by $TUSER" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + sharectl delsect $SERVER:$TUSER smbfs + return +fi + +smbmount_clean $TMNT +sharectl delsect $SERVER:$TUSER smbfs + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_004.ksh b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_004.ksh new file mode 100644 index 0000000000..459323296d --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_004.ksh @@ -0,0 +1,81 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: sharectl_004 +# +# DESCRIPTION: +# Verify minauth can work on user section +# +# STRATEGY: +# 1. run "sharectl set -p section=default -p minauth=kerberos smbfs" +# 2. run "smbutil view //$TUSER:$TPASS@$server" +# 3. sharectl and smbutil can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="sharectl004" +tc_desc="Verify minauth can work on user section" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +SERVER=$(echo $server|tr "[:lower:]" "[:upper:]") + +cmd="sharectl set -p section=$SERVER -p minauth=kerberos smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set password in SERVER section failed" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: sharectl set password in SERVER section succeeded" +fi + +# get rid of our connection first +cti_execute_cmd "smbutil discon //$TUSER:$TPASS@$server" +sleep 1 + +cti_report "expect failure next" +cmd="smbutil view //$TUSER:$TPASS@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil view succeeded for the minauth=kerberos" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: smbutil view failed for the minauth=kerberos" +fi + +sharectl delsect $SERVER smbfs + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_005.ksh b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_005.ksh new file mode 100644 index 0000000000..e38c182044 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_005.ksh @@ -0,0 +1,115 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: sharectl_005 +# +# DESCRIPTION: +# Verify user and domain work in sharctl "default" section +# +# STRATEGY: +# 1. run "sharectl set -p section=default -p password=$pass smbfs" +# 2. run "sharectl set -p section=default -p user=$TUSER smbfs" +# 3. run "sharectl set -p section=default -p domain=mydomain smbf" +# 2. run "mount -F smbfs //$server/public $TMNT" +# 3. sharectl and mount can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="sharectl005" +tc_desc="Test user and domain in sharctl [default] section." +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +smbmount_clean $TMNT +smbmount_init $TMNT + +pass=$(smbutil crypt $TPASS) +cmd="sharectl set -p section=default -p password=\$pass smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set password in default section failed" + return +else + cti_report "PASS: sharectl set password in default section succeeded" +fi +cmd="sharectl set -p section=default -p user=$TUSER smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "sharectl set user in default section failed" + sharectl delsect default smbfs + return +else + cti_report "PASS: sharectl set user in default section succeeded" +fi +cmd="sharectl set -p section=default -p domain=mydomain smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "sharectl set domain in default section failed" + sharectl delsect default smbfs + return +else + cti_report "PASS sharectl set domain in default section succeeded" +fi + +cmd="smbutil view //$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view failed for user and domain properity" + sharectl delsect default smbfs + return +else + cti_report "PASS: smbutil view suceeded for user and domain properity" +fi + +cmd="mount -F smbfs //$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + sharectl delsect default smbfs + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + sharectl delsect default smbfs + smbmount_clean $TMNT + return +fi + +smbmount_clean $TMNT +sharectl delsect default smbfs + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_006.ksh b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_006.ksh new file mode 100644 index 0000000000..5063053e75 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/sharectl/tp_sharectl_006.ksh @@ -0,0 +1,122 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: sharectl_006 +# +# DESCRIPTION: +# Verify user and domain can work in sharectl "$SERVER" section +# +# STRATEGY: +# 1. run "sharectl set -p section=$SERVER -p password=$pass smbfs" +# 2. run "sharectl set -p section=$SERVER -p user=$TUSER smbfs" +# 3. run "sharectl set -p section=$SERVER -p domain=mydomain smbfs" +# 4. run "smbutil view //$server" +# 5. run "mount -F smbfs //$server/public $TMNT" +# 3. sharectl, smbutil and mount can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="sharectl006" +tc_desc="Test user and domain in sharectl [server] section." +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +smbmount_clean $TMNT +smbmount_init $TMNT + +pass=$(smbutil crypt $TPASS) +SERVER=$(echo $server|tr "[:lower:]" "[:upper:]") + +cmd="sharectl set -p section=$SERVER -p password=\$pass smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set password in SERVER section failed" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: sharectl set password in SERVER section succeeded" +fi + +cmd="sharectl set -p section=$SERVER -p user=$TUSER smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set user in SERVER section failed" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: sharectl set user in SERVER section succeeded" +fi + +cmd="sharectl set -p section=$SERVER -p domain=mydomain smbfs" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: sharectl set user in SERVER section failed" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: sharectl set user in SERVER section succeeded" +fi + +cmd="smbutil view //$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view failed for user and domain properity" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: smbutil view succeeded for user and domain properity" +fi + +cmd="mount -F smbfs //$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + sharectl delsect $SERVER smbfs + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + sharectl delsect $SERVER smbfs + return +fi + +smbmount_clean $TMNT +sharectl delsect $SERVER smbfs + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/Makefile new file mode 100644 index 0000000000..2776ed34ba --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/Makefile @@ -0,0 +1,29 @@ +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +.PARALLEL: $(SUBDIRS) + +SUBDIRS= acl \ + cptest \ + create \ + error \ + misc \ + mkdir \ + mmap \ + mvtest \ + xattr + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/smbclient-tests/tests/smbfs/acl/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/acl/Makefile new file mode 100644 index 0000000000..4655c06357 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/acl/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/acl + +TESTS= \ + tp_acl_001 \ + tp_acl_002 \ + tp_acl_003 \ + tp_acl_004 \ + tp_acl_005 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_001.ksh new file mode 100644 index 0000000000..f528f113c9 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_001.ksh @@ -0,0 +1,118 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: acl_001 +# +# DESCRIPTION: +# Read ACLs in an smbfs mount using "ls" +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. try "ls -V" etc. +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="acl001" +tc_desc="Verify we can view ACLs with ls" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# Require that the mount supports ACLs +smbmount_getmntopts $TMNT |grep /acl/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no ACLs in this mount)" + return +fi + +# create a file +cmd="cp /etc/passwd $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi + +# verify "ls -l" shows a plus sign +cmd="ls -l $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +read mode junk < cti_stdout +case "$mode" in +*+) + cti_report "PASS: have plus sign" + ;; +*) + cti_fail "FAIL: no plus sign" + smbmount_clean $TMNT + return +esac + +# verify "ls -V" shows an ACL +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +cnt=$(wc -l < cti_stdout) +if [[ "$cnt" -lt 2 ]] ; then + cti_fail "FAIL: no ACEs found" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm $TMNT/$tc_id" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_002.ksh new file mode 100644 index 0000000000..561044b786 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_002.ksh @@ -0,0 +1,137 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: acl_002 +# +# DESCRIPTION: +# Copy ACLs to/from and smbfs mount with cpio +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create a file, make sure it has an ACL +# 3. cpio -oP -O archive.cpio +# 4. remove the file +# 5. cpio -iP -I archive.cpio +# 6. verify extracted ACL matches original +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="acl002" +tc_desc="Verify we can save/restore ACLs with cpio" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# Require that the mount supports ACLs +smbmount_getmntopts $TMNT |grep /acl/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no ACLs in this mount)" + return +fi + +# create a file, make sure it has an ACL +cmd="cp /etc/passwd $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +tail +2 cti_stdout > acl_save + +# 3. cpio -oP -O archive.cpio +cmd="echo $tc_id | \ + ( cd $TMNT ; cpio -ocP -O $TDIR/$tc_id.cpio )" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi + +# 4. remove the file +cti_execute_cmd "rm -f $TMNT/$tc_id" + +# 5. cpio -iP -I archive.cpio +cmd="( cd $TMNT ; cpio -icP -I $TDIR/$tc_id.cpio )" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi + +# 6. verify extracted ACL matches original +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +tail +2 cti_stdout > acl_test + +cmd="diff acl_save acl_test" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm $TDIR/$tc_id.cpio" +cti_execute_cmd "rm $TMNT/$tc_id" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_003.ksh new file mode 100644 index 0000000000..4068ac6cc3 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_003.ksh @@ -0,0 +1,128 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: acl_003 +# +# DESCRIPTION: +# Verify we can modify an ACL (add everyone ACE) +# +# STRATEGY: +# 1. run "mount -F smbfs ..." +# 2. create a file, make sure it has an ACL +# 3. chmod A+everyone@:rxaRcs::allow file +# 4. verify everyone line is there +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="acl003" +tc_desc="Verify we can modify an ACL (add everyone ACE)" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# Require that the mount supports ACLs +smbmount_getmntopts $TMNT |grep /acl/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no ACLs in this mount)" + return +fi + +# create a file, make sure it has an ACL +cmd="cp /etc/passwd $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +tail +2 cti_stdout > acl_save + +# 3. chmod A+everyone@:rxaRcs::allow file +cmd="chmod A+everyone@:rxaRcs::allow $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi + +# 4. verify everyone line is there +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +fi +tail +2 cti_stdout > acl_test + +# The new ACL should be different, and should contain "everyone@" +cmd="diff acl_save acl_test" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: ACL should have changed" + smbmount_clean $TMNT + return +fi + +grep ' everyone@:' acl_test >/dev/null +if [[ $? != 0 ]]; then + cti_fail "FAIL: did not find new ACE" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm $TMNT/$tc_id" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_004.ksh new file mode 100644 index 0000000000..9fe17edc30 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_004.ksh @@ -0,0 +1,180 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: acl_004 +# +# DESCRIPTION: +# Verify we can modify an ACL (add $TUSER1) +# +# STRATEGY: +# 1. run "mount -F smbfs //$TUSER@..." $TMNT +# 2. run "mount -F smbfs //$TUSER1@..." $TMNT2 +# 3. create a file, as $TUSER +# 4. create file2, as $TUSER1 and get owner UID +# 5. chmod A+user:$TUSER1@:rxaRcs::allow file +# 6. verify $TUSER1 ACE is there +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="acl004" +tc_desc="Verify we can modify an ACL (add user ACE)" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +smbmount_clean $TMNT +smbmount_clean $TMNT2 + +smbmount_init $TMNT +smbmount_init $TMNT2 + +# 1. run "mount -F smbfs //$TUSER@..." $TMNT + +cmd="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# Require that the mount supports ACLs +smbmount_getmntopts $TMNT |grep /acl/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no ACLs in this mount)" + return +fi + +# 2. run "mount -F smbfs //$TUSER1@..." $TMNT2 + +cmd="mount -F smbfs -oacl //$TUSER1:$TPASS@$server/public $TMNT2" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +else + cti_report "PASS: $cmd" +fi + +# 3. create a file, as $TUSER + +cmd="cp /etc/passwd $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +tail +2 cti_stdout > acl_save + +# 4. create a file, as $TUSER1 and get owner UID + +cmd="touch $TMNT2/${tc_id}B" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +cmd="ls -V $TMNT/${tc_id}B" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +# Get the ephemereal UID and GID for $TUSER1 +read mode cnt uid gid junk < cti_stdout +cti_execute_cmd "rm $TMNT2/${tc_id}B" + +# 5. chmod A+user:$TUSER1@:rxaRcs::allow file + +cmd="chmod A+user:${uid}:rxaRcs::allow $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +# 6. verify $TUSER1 ACE is there + +cmd="ls -V $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +tail +2 cti_stdout > acl_test + +# The new ACL should be different... +cmd="diff acl_save acl_test" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: ACL should have changed" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +# The new ACL should contain $uid +grep " user:${uid}:" acl_test >/dev/null +if [[ $? != 0 ]]; then + cti_fail "FAIL: did not find new ACE" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +cti_execute_cmd "rm $TMNT/$tc_id" +smbmount_clean $TMNT +smbmount_clean $TMNT2 + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_005.ksh new file mode 100644 index 0000000000..c9c68121f8 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/acl/tp_acl_005.ksh @@ -0,0 +1,191 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: acl_005 +# +# DESCRIPTION: +# Verify we can take ownership (chown) +# +# STRATEGY: +# 1. run "mount -F smbfs //$TUSER@..." $TMNT +# 2. run "mount -F smbfs //$TUSER1@..." $TMNT2 +# 3. create file2, as $TUSER1 and get owner UID +# 4. create a file as $TUSER +# 5. give $TUSER1 full control +# 6. chown UID $TMNT2/file +# 7. verify $TUSER1 owns it +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="acl005" +tc_desc="Verify we can take ownership (chown)" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +smbmount_clean $TMNT +smbmount_clean $TMNT2 + +smbmount_init $TMNT +smbmount_init $TMNT2 + +# 1. run "mount -F smbfs //$TUSER@..." $TMNT + +cmd="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# Require that the mount supports ACLs +smbmount_getmntopts $TMNT |grep /acl/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no ACLs in this mount)" + return +fi + +# 2. run "mount -F smbfs //$TUSER1@..." $TMNT2 + +cmd="mount -F smbfs -oacl //$TUSER1:$TPASS@$server/public $TMNT2" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + return +else + cti_report "PASS: $cmd" +fi + +# 3. create a file2 as $TUSER1 and get owner UID + +cmd="touch $TMNT2/${tc_id}B" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +cmd="ls -l $TMNT/${tc_id}B" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +# Get the ephemereal UID and GID for $TUSER1 +read mode cnt uid gid junk < cti_stdout +cti_execute_cmd "rm $TMNT2/${tc_id}B" + +# 4. create a file, as $TUSER + +cmd="cp /etc/passwd $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +cmd="ls -l $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +cp cti_stdout out_save + +# 5. give $TUSER1 full control +cmd="chmod A+user:${uid}:rwxpdDaARWcCos::allow $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +# 6. chown UID $TMNT2/file + +cmd="sudo -n chown ${uid} $TMNT2/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +# 6. verify $TUSER1 owns it + +cmd="ls -l $TMNT2/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi +cp cti_stdout out_test + +# The new owner should be different... +cmd="diff out_save out_test" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: owner should have changed" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +# The new owner should contain $uid +grep " $uid " out_test >/dev/null +if [[ $? != 0 ]]; then + cti_fail "FAIL: did not find $uid" + smbmount_clean $TMNT + smbmount_clean $TMNT2 + return +fi + +cti_execute_cmd "rm $TMNT/$tc_id" +smbmount_clean $TMNT +smbmount_clean $TMNT2 + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/cptest/Makefile new file mode 100644 index 0000000000..b2c94b6d59 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/Makefile @@ -0,0 +1,32 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/cptest + +TESTS= \ + tp_cptest_001 \ + tp_cptest_002 \ + tp_cptest_003 \ + tp_cptest_004 \ + tp_cptest_005 \ + tp_cptest_006 \ + tp_cptest_007 \ + tp_cptest_008 \ + tp_cptest_009 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_001.ksh new file mode 100644 index 0000000000..56c3bbc25e --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_001.ksh @@ -0,0 +1,106 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_001 +# +# DESCRIPTION: +# Verify cifs client can cp files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest001" +tc_desc="Verify can cp files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "cp /usr/bin/ls $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp /usr/bin/ls test_file failed" + return +else + cti_report "PASS: cp /usr/bin/ls test_file successfully" +fi + +cti_execute_cmd "cmp -s /usr/bin/ls $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff /usr/bin/ls test_file failed" + return +else + cti_report "PASS: diff /usr/bin/ls test_file succeeded" +fi + +cti_execute_cmd "cp $TMNT/test_file $TDIR/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp test_file $TDIR/test_file failed" + return +else + cti_report "PASS: cp test_file $TDIR/test_file succeeded" +fi + +cti_execute_cmd "diff /usr/bin/ls $TDIR/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff /usr/bin/ls $TDIR/test_file failed" + return +else + cti_report "PASS: diff /usr/bin/ls $TDIR/test_file succeeded" +fi + +cti_execute_cmd "rm $TMNT/test_file $TDIR/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: rm test_file $TDIR/test_file failed" + return +else + cti_report "PASS: rm test_file $TDIR/test_file succeeded" +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_002.ksh new file mode 100644 index 0000000000..120ff3b4a4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_002.ksh @@ -0,0 +1,102 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_002 +# +# DESCRIPTION: +# Verify cifs client can create and cp 300M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest002" +tc_desc="Verify can cp files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "cp $REFFILE $TDIR/test_file" +cti_execute_cmd "cp $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $TDIR/test_file to test_file failed" + return +else + cti_report "PASS: cp $TDIR/test_file to test_file succeeded" +fi + +cti_execute_cmd "cmp -s $TMNT/test_file $TDIR/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff test_file $TDIR/test_file failed" + return +else + cti_report "PASS: diff test_file $TDIR/test_file succeed" +fi + +cti_execute_cmd "cp $TMNT/test_file $TDIR/test_file_cp " +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp test_file $TDIR/test_file_cp failed" + return +else + cti_report "PASS: cp test_file $TDIR/test_file_cp succeeded" +fi + +cmd="cmp -s $TDIR/test_file $TDIR/test_file_cp" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff $TDIR/test_file $TDIR/test_file_cp failed" + return +else + cti_report "PASS: diff $TDIR/test_file $TDIR/test_file_cp" \ + "succeeded" +fi + +cti_execute_cmd "rm -rf $TMNT/test_file $TDIR/*" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_003.ksh new file mode 100644 index 0000000000..2217f51eed --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_003.ksh @@ -0,0 +1,106 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_003 +# +# DESCRIPTION: +# Verify can create and cp 150M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest003" +tc_desc=" Verify can cp files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=150m +if [[ -n "$STC_QUICK" ]] ; then + size=5m + # will report SKIP below +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "smbmount can't mount the public share" + return +else + cti_report "smbmount can mount the public share" +fi + +cti_execute_cmd "mkfile $size $TDIR/test_file" + +cti_execute_cmd "cp $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $TDIR/test_file to test_file failed" + return +else + cti_report "PASS: cp $TDIR/test_file to test_file succeeded" +fi + +cti_execute_cmd "cmp -s $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff test_file $TDIR/test_file failed" + return +else + cti_report "PASS: diff test_file $TDIR/test_file succeeded" +fi + +cti_execute_cmd "rm $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: rm test_file test_file_server failed" + return +else + cti_report "PASS: rm test_file test_file_server succeeded" +fi + +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT + +if [[ -n "$STC_QUICK" ]] ; then + # Did only 10m test, so report SKIP + cti_notinuse "${tc_id}: Copied 5m OK (shortened for STC_QUICK)" + return +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_004.ksh new file mode 100644 index 0000000000..753a7361a9 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_004.ksh @@ -0,0 +1,107 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_004 +# +# DESCRIPTION: +# Verify can create and cp 3G file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest004" +tc_desc="Verify can cp 3g files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# This test is largely redundant with create/tp_create_009 +# so we could probably just delete this test. +size=3g +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "smbmount can't mount the public share" + return +else + cti_report "smbmount can mount the public share" +fi + +cti_execute_cmd "mkfile $size $TDIR/test_file" +cti_execute FAIL "sum $TDIR/test_file" +read sum1 cnt1 junk < cti_stdout + +# cp file to server +cti_execute_cmd "cp $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $TDIR/test_file to test_file failed" + return +else + cti_report "PASS: cp $TDIR/test_file to test_file succeeded" +fi + +# compare (which reads the remote file) +cti_execute FAIL "sum $TMNT/test_file" +read sum2 cnt2 junk < cti_stdout +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: first sum of the files are different" + return +else + cti_report "PASS: first sums of the files are same" +fi + +cti_execute_cmd "rm $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "rm the test_file failed" + return +else + cti_report "rm the test_file successfully" +fi + +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_005.ksh new file mode 100644 index 0000000000..ec76c5751d --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_005.ksh @@ -0,0 +1,115 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_005 +# +# DESCRIPTION: +# Verify can cp dir between server and client side +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp -r can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest005" +tc_desc="Verify can cp dir between server and client side" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) ||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# mkdir on the local +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "mkdir $TDIR/test_dir" + +# make sure no left over dir in the way, or the cp -r +# will make a subdir, and fail our later rmdir +cti_execute_cmd "rm -rf $TMNT/test_dir" + +# cp to server +cti_execute_cmd "cp -r $TDIR/test_dir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $TDIR/test_dir to server failed" + return +else + cti_report "PASS: cp $TDIR/test_dir to server succeeded" +fi + +if [[ ! -d "$TMNT/test_dir" ]]; then + cti_fail "FAIL: test_dir doesn't exist on server" + return +else + cti_report "PASS: test_dir exists on server" +fi + +# cp dir from the server to local +cti_execute_cmd "cp -r $TMNT/test_dir $TDIR/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp test_dir to $TDIR/test_dir_cp failed" + return +else + cti_report "PASS: cp test_dir to $TDIR/test_dir_cp succeeded" +fi + +if [[ ! -d "$TDIR/test_dir_cp" ]]; then + cti_fail "FAIL: $TDIR/test_dir_cp doesn't exist" + return +else + cti_report "PASS: $TDIR/test_dir_cp exists" +fi + +cti_execute_cmd "rmdir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: rm test_dir failed" + return +else + cti_report "PASS: rm test_dir succeeded" +fi + +cti_execute_cmd "rm -f $TDIR/*" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_006.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_006.ksh new file mode 100644 index 0000000000..144b9b1068 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_006.ksh @@ -0,0 +1,117 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_006 +# +# DESCRIPTION: +# Verify can cp muti dir/files between server and client +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest006" +tc_desc=" Verify can cp muti dir/files between server and client" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +tdir=/kernel/misc +server=$(server_name)|| return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" +cti_execute_cmd "rm -rf $TDIR/*" + +# create mutil file/dirs on the local +cti_execute_cmd "cp -rf $tdir $TDIR/test_dir" + +# copy to server +cti_execute_cmd "cp -rf $TDIR/test_dir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $TDIR/test_dir to server failed" + return +else + cti_report "PASS: cp $TDIR/test_dir to server succeeded" +fi + +# diff the local and server +cti_execute_cmd "diff -r $TDIR/test_dir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: $TDIR/test_dir is different with server's copy" + return +else + cti_report "PASS: $TDIR/test_dir is same with server's copy" +fi + + +# cp mutil dirs from the server to local +cti_execute_cmd "cp -rf $TMNT/test_dir $TDIR/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp test_dir to $TDIR/test_dir_cp failed" + return +else + cti_report "PASS: cp test_dir to $TDIR/test_dir_cp succeeded" +fi + +# diff the server to local +cti_execute_cmd "diff -r $TMNT/test_dir $TDIR/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail "FAIL: $TDIR/test_dir is different with server's copy" + return +else + cti_report "PASS: $TDIR/test_dir is the same with server's copy" +fi + +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_007.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_007.ksh new file mode 100644 index 0000000000..f819e4aef2 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_007.ksh @@ -0,0 +1,124 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_007 +# +# DESCRIPTION: +# Verify can cp muti dir/files between server and local +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest007" +tc_desc=" Verify can cp muti dir/files between server and local" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +tdir=/kernel/misc +server=$(server_name)|| return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" +cti_execute_cmd "rm -rf $TDIR/*" + +# create mutil file/dirs on the server +cti_execute_cmd "cp -rf $tdir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $tdir to test_dir failed" + return +else + cti_report "PASS: cp $tdir to test_dir succeeded" +fi + +# cp to local +cti_execute_cmd "cp -rf $TMNT/test_dir $TDIR/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp to the local dir:$TDIR/test_dir failed" + return +else + cti_report "PASS: cp to the local dir:$TDIR/test_dir failed" +fi + +# diff the server to local +cti_execute_cmd "diff -r $TMNT/test_dir $TDIR/test_dir" +if [[ $? != 0 ]]; then + cti_fail " $TDIR/test_dir is different with server's copy" + return +else + cti_report " $TDIR/test_dir is the same with server's copy" +fi + +# cp muti dir/files from the local to server +cti_execute_cmd "cp -rf $TDIR/test_dir $TMNT/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail "cp $TDIR/test_dir to test_dir_cp failed" + return +else + cti_report "cp $TDIR/test_dir to test_dir_cp succeeded" +fi + +# diff the server and local +cti_execute_cmd "diff -r $TDIR/test_dir $TMNT/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail " $TDIR/test_dir is different with server's copy" \ + "test_dir_cp" + return +else + cti_report " $TDIR/test_dir is the same with server's copy" \ + "test_dir_cp" +fi + +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_008.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_008.ksh new file mode 100644 index 0000000000..c02327c2ae --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_008.ksh @@ -0,0 +1,104 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_008 +# +# DESCRIPTION: +# Verify can cp muti dir/files between server and server on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest008" +tc_desc=" Verify can cp muti dir/files between server and local" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +# This test is less interesting - pick something small. +tdir=/kernel/sys +server=$(server_name)|| return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# create mutil file/dirs on the server +cti_execute_cmd "cp -rf $tdir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $tdir to test_dir failed" + return +else + cti_report "PASS: cp $tdir to test_dir succeeded" +fi + +# cp from to server to server +cti_execute_cmd "cp -rf $TMNT/test_dir $TMNT/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp to the server test_dir_cp failed" + return +else + cti_report "PASS: cp to the server test_dir_cp succeeded" +fi + +# diff the server to server +cti_execute_cmd "diff -r $TMNT/test_dir $TMNT/test_dir_cp" +if [[ $? != 0 ]]; then + cti_fail "FAIL: test_dir is different with test_dir_cp" + return +else + cti_report "PASS: test_dir is same to test_dir_cp" +fi + +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_009.ksh b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_009.ksh new file mode 100644 index 0000000000..b8069973c4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/cptest/tp_cptest_009.ksh @@ -0,0 +1,98 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: cptest_009 +# +# DESCRIPTION: +# Verify can create and cp 50M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create, cp and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="cptest009" +tc_desc="Verify can cp files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# cp file + +i=0 +while ((i<10)) +do + cp $REFFILE $TMNT/test_file_cp$i & + ((i=i+1)) +done + +wait +sleep 5 + +i=0 +while ((i<10)) +do + cti_execute_cmd "diff $REFFILE $TMNT/test_file_cp$i" + if [[ $? != 0 ]]; then + cti_fail "FAIL: diff test_file and test_file_cp$i failed" + return + fi + ((i=i+1)) +done + +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/create/Makefile new file mode 100644 index 0000000000..795e701946 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/Makefile @@ -0,0 +1,35 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/create + +TESTS= \ + tp_create_001 \ + tp_create_002 \ + tp_create_003 \ + tp_create_004 \ + tp_create_005 \ + tp_create_006 \ + tp_create_007 \ + tp_create_008 \ + tp_create_009 \ + tp_create_010 \ + tp_create_011 \ + tp_create_012 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_001.ksh new file mode 100644 index 0000000000..fe30ad538f --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_001.ksh @@ -0,0 +1,97 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_001 +# +# DESCRIPTION: +# Verify can create files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. touch and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create001" +tc_desc=" Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# touch file +cti_execute_cmd "touch $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to touch the file" + return +else + cti_report "PASS: touch the file successfully" +fi + +if [[ ! -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should exist, it doesn't exist" + return +else + cti_report "PASS: the file exists, it's right" +fi + +cmd="rm $TMNT/file " +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to rm the file" + return +else + cti_report "PASS: rm the file successfully" +fi + +if [[ -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should not exist, but it exits" + return +else + cti_report "PASS: the file doesn't exist, it's right" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_002.ksh new file mode 100644 index 0000000000..47fffc62fe --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_002.ksh @@ -0,0 +1,99 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_002 +# +# DESCRIPTION: +# Verify can create files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. cp, diff and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create002" +tc_desc=" Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)|| return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to cp the /usr/bin/ls file" + return +else + cti_report "PASS: cp the /usr/bin/ls file successfully" +fi + +cmd="cmp -s /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the /usr/bin/ls file is different with the ls_file file" + return +else + cti_report "PASS: the /usr/bin/ls file is same to the ls_file file" +fi + +cmd="rm -f $TMNT/ls_file" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to rm the ls_file file" + return +else + cti_report "PASS: rm the ls_file file successfully" +fi + +if [[ -f "$TMNT/ls_file" ]]; then + cti_fail "FAIL: the ls_file file shouldn't exist, but it exits" + return +else + cti_report "PASS: the ls_file file doesn't exist, it's right" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_003.ksh new file mode 100644 index 0000000000..386ce56172 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_003.ksh @@ -0,0 +1,107 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_003 +# +# DESCRIPTION: +# Verify can create 30 byte file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. dd can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create003" +tc_desc="Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || rerurn + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# create 30 byte file +cmd="dd if=/dev/zero of=$TMNT/file30 bs=30 count=1" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to dd a 30b file" + return +else + cti_report "PASS: dd a 30b file successfully" +fi + +if [[ ! -f "$TMNT/file30" ]]; then + cti_fail "FAIL: the file file30 shouldn't exist, but it exits" + return +else + cti_report "PASS: the file file30 doesn't exist, it's right" +fi + +size=$(file_size $TMNT/file30) + +if ((size != 30)); then + cti_fail " file size($size) is != 30" + return +fi + +# remove file +cmd="rm $TMNT/file30" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to rm the file30 file" + return +else + cti_report "PASS: rm the file30 file successfully" +fi + +if [[ -f "$TMNT/file30" ]]; then + cti_fail "FAIL: the file30 file shouldn't exist, but it exits" + return +else + cti_report "PASS: the file30 file does not exist, it's right" +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_004.ksh new file mode 100644 index 0000000000..1da11a1414 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_004.ksh @@ -0,0 +1,101 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_004 +# +# DESCRIPTION: +# Verify can create 50000 byte file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. dd and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create004" +tc_desc=" Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# create 50000 byte file +cmd="dd if=/dev/zero of=$TMNT/file50000 bs=500 count=100" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to dd a 50000b file" + return +else + cti_report "PASS: dd a 50000b file successfully" +fi + +size=$(file_size $TMNT/file50000) +if ((size != 50000)); then + cti_fail "FAIL: the file size($size) is != 50000" + return +else + cti_report "PASS: the file size($size) is 50000, it is right" +fi + + +# remove file +cmd="rm $TMNT/file50000" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to rm the file50000 file" + return +else + cti_report "PASS: rm the file50000 file successfully" +fi + +if [[ -f "$TMNT/file50000" ]]; then + cti_fail "FAIL: the file50000 should not exist, but it exists" + return +else + cti_report "PASS: the file50000 exists, it is right" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_005.ksh new file mode 100644 index 0000000000..71905a823b --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_005.ksh @@ -0,0 +1,125 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_005 +# +# DESCRIPTION: +# Verify can create files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. echo and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create005" +tc_desc="Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +echo "test_test" >$TDIR/file +echo 'test_test' >$TMNT/file +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the file" + return +else + cti_report "PASS: create the file successfully" +fi + +if [[ ! -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should exist, but it doesn't exist" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "diff $TMNT/file $TDIR/file " +if [[ $? != 0 ]]; then + cti_fail "FAIL: the first file is different" + return +else + cti_report "PASS: the first file is same" +fi + +echo "test_test" >> $TDIR/file +echo "test_test" >> $TMNT/file +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the file" + return +else + cti_report "PASS: create the file successfully" +fi + +cti_execute_cmd "diff $TMNT/file $TDIR/file " +if [[ $? != 0 ]]; then + cti_fail "FAIL: the second file is different" + return +else + cti_report "PASS: the second file is same" +fi + +cti_execute_cmd "rm $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to delete the file" + return +else + cti_report "PASS: delete the file successfully" +fi + +if [[ -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should not exist, but it exists" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "rm $TDIR/file" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_006.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_006.ksh new file mode 100644 index 0000000000..2204676d29 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_006.ksh @@ -0,0 +1,128 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_006 +# +# DESCRIPTION: +# Verify can create files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. echo and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create006" +tc_desc=" Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +echo "test_test" >$TDIR/file +# create file +echo 'test_test' >$TMNT/file +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the file" + return +else + cti_report "PASS: create the file successfully" +fi + +if [[ ! -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should exist, but it doestn't exist" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "diff $TMNT/file $TDIR/file " +if [[ $? != 0 ]]; then + cti_fail "FAIL: the first diff is different" + return +else + cti_report "PASS: the first diff is same" +fi + +echo "test_test" >> $TDIR/file +# create file +echo "test_test" >> $TMNT/file +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the file" + return +else + cti_report "PASS: create the file successfully" +fi + +cti_execute_cmd "diff $TMNT/file $TDIR/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: the second diff is different" + return +else + cti_report "PASS: the second diff is same" +fi + + +cti_execute_cmd "rm $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to delete the file" + return +else + cti_report "PASS: delete the file successfully" +fi + +if [[ -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should not exist, but it exists" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "rm $TDIR/file" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_007.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_007.ksh new file mode 100644 index 0000000000..f382500983 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_007.ksh @@ -0,0 +1,102 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_007 +# +# DESCRIPTION: +# Verify can create 200M files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create007" +tc_desc="Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +cti_execute_cmd "mkfile 2m $TDIR/file" +# create file +cti_execute_cmd "mkfile 2m $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the 20m file" + return +else + cti_report "PASS: create the 20m file successfully" +fi + +cti_execute_cmd "cmp -s $TMNT/file $TDIR/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are same" +fi + +cti_execute_cmd "rm $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to delete the file" + return +else + cti_report "PASS: delete the file successfully" +fi + +if [[ -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should not exist, but it exits" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "rm $TDIR/file" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_008.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_008.ksh new file mode 100644 index 0000000000..3fc4391e7c --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_008.ksh @@ -0,0 +1,112 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_008 +# +# DESCRIPTION: +# Verify can create 1500M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create008" +tc_desc="Verify can create 150m files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=150m +if [[ -n "$STC_QUICK" ]] ; then + size=5m +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# create file +cti_execute_cmd "mkfile $size $TDIR/file" +cti_execute_cmd "mkfile $size $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the $size file" + return +else + cti_report "PASS: create the $size file successfully" +fi + +cti_execute_cmd "cmp -s $TMNT/file $TDIR/file " +if [[ $? != 0 ]]; then + cti_fail "FAIL: the first diff is different" + return +else + cti_report "PASS: the first diff is same" +fi + +cti_execute_cmd "rm $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to delete the file" + return +else + cti_report "PASS: delete the file successfully" +fi + +if [[ -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should not exist, but it exists" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "rm $TDIR/file" + +smbmount_clean $TMNT + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: Created 5m file (reduced for STC_QUICK)" + return +fi +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_009.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_009.ksh new file mode 100644 index 0000000000..ada9727341 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_009.ksh @@ -0,0 +1,103 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_009 +# +# DESCRIPTION: +# Verify can create 3G file on the smbfs +# (can go beyond 31-bit offsets) +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create009" +tc_desc="Verify can create 3g files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=3g +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# create file on the server +cmd="dd if=/dev/zero of=$TMNT/file oseek=3071 bs=1024k count=1" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: create $TDIR/test_file to test_file failed" + return +else + cti_report "PASS: create $TDIR/test_file to test_file succeeded" +fi + +size=$(file_size $TMNT/file) +if [[ $size != 3221225472 ]] ; then + cti_fail "FAIL: file size is not 3G" + return +else + cti_report "PASS: file size if 3G" +fi + +cti_execute_cmd "rm $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to delete the file" + return +else + cti_report "PASS: delete the file successfully" +fi + +if [[ -f "$TMNT/file" ]]; then + cti_fail "FAIL: the file should not exist, but it exists" + return +else + cti_report "PASS: the file exists, it is right" +fi + +cti_execute_cmd "rm $TDIR/file " + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_010.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_010.ksh new file mode 100644 index 0000000000..7d5cc27b21 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_010.ksh @@ -0,0 +1,98 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_010 +# +# DESCRIPTION: +# Verify can create and copy 200M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create, cp and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create010" +tc_desc="Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" +cti_execute_cmd "rm -rf $TDIR/*" + +# create file +mkfile 20m $TDIR/file +cti_execute_cmd "cp $TDIR/file $TMNT/file &" +pid1=$! + +sleep 3 +tail -f $TMNT/file >/dev/null 2>&1 & +pid2=$! + +wait $pid1 +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to copy the 20M file" + return +else + cti_report "PASS: copied the 20M file successfully" +fi + +sleep 5 + +cti_execute_cmd "kill -9 $pid2" + +sleep 5 + +cti_execute_cmd "rm $TDIR/file" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_011.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_011.ksh new file mode 100644 index 0000000000..24f0406961 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_011.ksh @@ -0,0 +1,94 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_011 +# +# DESCRIPTION: +# Verify can create tar file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. tar and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create011" +tc_desc="Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +# reference dir for copy (ro) +refdir=/kernel/misc + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +cti_execute_cmd "tar cf $TDIR/kernel.tar $refdir" +cti_execute_cmd "tar cf $TMNT/kernel.tar $refdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: the tar cf command is failed " + return +else + cti_report "PASS: the tar cf command is successful" +fi + +cti_execute_cmd "cmp -s $TMNT/kernel.tar $TDIR/kernel.tar" +if [[ $? != 0 ]]; then + cti_fail "FAIL: the two tar files are different" + return +else + cti_report "PASS: the two tar files are same" +fi + +cti_execute_cmd "rm -rf $TMNT/kernel.tar $TDIR/kernel.tar" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_012.ksh b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_012.ksh new file mode 100644 index 0000000000..c2dd5c7b6a --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/create/tp_create_012.ksh @@ -0,0 +1,94 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: create_012 +# +# DESCRIPTION: +# Verify can create 200M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="create012" +tc_desc="Verify can create files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +if [[ -n "$STC_QUICK" ]] ; then + cti_notinuse "${tc_id}: skipped (STC_QUICK)" + return +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# create file +mkfile 20m $TMNT/file & +pid1=$! + +sleep 3 +tail -f $TMNT/file >/dev/null 2>&1 & +pid2=$! + +wait $pid1 +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the 20M file on the smbfs" + kill -9 $pid2 + return +else + cti_report "PASS: create the 20M file on the smbfs successfully" +fi + +kill -9 $pid2 + +cti_execute_cmd "rm -rf $TMNT/*" +sleep 2 + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/error/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/error/Makefile new file mode 100644 index 0000000000..e72e5a38ab --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/error/Makefile @@ -0,0 +1,25 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/error + +TESTS= \ + tp_error_001 \ + tp_error_002 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/error/tp_error_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/error/tp_error_001.ksh new file mode 100644 index 0000000000..bb4c7fc955 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/error/tp_error_001.ksh @@ -0,0 +1,112 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: error_001 +# +# DESCRIPTION: +# Verify link error on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public $TMNT" on the smb +# 2. touch file and create link +# 3. The "ln -s" can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="error001" +tc_desc=" Verify link error on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "smbmount can't mount the public share" + return +else + cti_report "smbmount can mount the public share" +fi + +# cleanup +cti_execute_cmd "rm -rf $TMNT/*" + +cti_execute_cmd "touch $TMNT/file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: touch file failed on smbfs" + return +else + cti_report "PASS: touch file succeeded on smbfs" +fi + +cti_execute_cmd "(cd $TMNT; ln file file_ln)" +if [[ $? == 0 ]]; then + cti_fail "FAIL: ln file file_ln succeeded on smbfs" + return +else + cti_report "PASS: ln file file_ln failed on smbfs" +fi + +cti_execute_cmd "(cd $TMNT; ln -s file file_ln)" +if [[ $? == 0 ]]; then + cti_fail "ln -s file file_ln succeeded on smbfs" + return +else + cti_report "ln -s file file_ln failed on smbfs" +fi +cti_execute_cmd "rm $TMNT/file" + +cti_execute_cmd "mkdir $TMNT/dir" +if [[ $? != 0 ]]; then + cti_fail "mkdir dir failed on smbfs" + return +else + cti_report "mkdir dir succeeded on smbfs" +fi + +cti_execute_cmd "(cd $TMNT; ln -s dir dir_ln)" +if [[ $? == 0 ]]; then + cti_fail "ln -s dir dir_ln succeeded on smbfs" + return +else + cti_report "ln -s dir dir_ln failed on smbfs" +fi + +cti_execute_cmd "rmdir $TMNT/dir" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/error/tp_error_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/error/tp_error_002.ksh new file mode 100644 index 0000000000..eaf107c57a --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/error/tp_error_002.ksh @@ -0,0 +1,74 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: error_002 +# +# DESCRIPTION: +# Verify mknod error on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public $TMNT" on the smb +# 2. run "mknod file p" command +# 3. The mknod can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="error002" +tc_desc=" Verify mknod error on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "mknod $TMNT/file p" +if [[ $? == 0 ]]; then + cti_fail "FAIL: mknod file succeeded on smbfs" + return +else + cti_report "PASS: mknod file failed on smbfs" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/misc/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/misc/Makefile new file mode 100644 index 0000000000..9480eafd10 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/misc/Makefile @@ -0,0 +1,26 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/misc + +TESTS= \ + tp_misc_001 \ + tp_misc_002 \ + tp_misc_003 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_001.ksh new file mode 100644 index 0000000000..654152d910 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_001.ksh @@ -0,0 +1,77 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: misc_001 +# +# DESCRIPTION: +# Verify can truncate files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. truncate and rm can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="misc001" +tc_desc=" Verify can truncate files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# truncate file +cmd="file_trunc -f 4194304 -b 8192 -c 100 -s 0 -o 10 $TMNT/test_file" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: truncate file failed" + return +else + cti_report "PASS: truncate file succeeded" +fi + +cti_execute_cmd "rm $TMNT/test_file" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_002.ksh new file mode 100644 index 0000000000..295bd5962e --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_002.ksh @@ -0,0 +1,109 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: misc_002 +# +# DESCRIPTION: +# Verify attribute cache invalidation after +# some higher-level directory is renamed. +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir a/b/c/d +# 3. mv a z +# 4. mkdir a +# 5. verify stat of a/b/c shows ENOENT +# (All steps must be completed in less than a few seconds.) +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="misc002" +tc_desc=" Verify attribute cache invalidation under renamed directory" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cmd="mkdir -p $TMNT/a/b/c" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +cmd="mv $TMNT/a $TMNT/z" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +cmd="mkdir $TMNT/a" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +# a should exist, but should have nothing under it. +if [[ -d $TMNT/a/b/c ]] ; then + cti_fail "FAIL: a/b/c/d still exists" + return +fi + +# z should exist, and z/b/c +if [[ ! -d $TMNT/z ]] ; then + cti_fail "FAIL: dir 'z' missing" + return +fi +if [[ ! -d $TMNT/z/b/c ]] ; then + cti_fail "FAIL: dir 'z/b/c/d' missing" + return +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_003.ksh new file mode 100644 index 0000000000..421a5caad8 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/misc/tp_misc_003.ksh @@ -0,0 +1,113 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: misc_003 +# +# DESCRIPTION: +# Verify reconnect after connection to server is lost. +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. create a file +# 3. force the connection to drop +# 4. read the file (from step 2) +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="misc003" +tc_desc=" Verify reconnect after connection loss." +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +# 1. run "mount -F smbfs //server/public /export/mnt" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# 2. create a file + +cmd="touch $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +# 3. force the connection to drop +# (SMB uses port: 445) + +cmd="abort_conn -p 445 $server " +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi +sleep 2 + +# Would be nice to verify the connections are IDLE, +# but it can be tricky to identify which is ours. +# For now, just log the connection states here. +# Our connetion will show state "IDLE". + +cmd="echo '::nsmb_vc' |sudo -n mdb -k" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +# 4. read the file (from step 2) +# This will initiate a reconnect. + +cmd="ls -l $TMNT/$tc_id" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/Makefile new file mode 100644 index 0000000000..ce23418371 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/Makefile @@ -0,0 +1,29 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/mkdir + +TESTS= \ + tp_mkdir_001 \ + tp_mkdir_002 \ + tp_mkdir_003 \ + tp_mkdir_004 \ + tp_mkdir_005 \ + tp_mkdir_006 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_001.ksh new file mode 100644 index 0000000000..5de1f2c0d4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_001.ksh @@ -0,0 +1,84 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mkdir_001 +# +# DESCRIPTION: +# Verify cifs client can create dir on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir and rmdir can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mkdir001" +tc_desc=" Verify can create dir on smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# mkdir +cti_execute_cmd "mkdir $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir testdir failed" + return +else + cti_report "PASS: mkdir testdir succeeded" +fi + +cti_execute_cmd "rmdir $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: rmdir testdir failed" + return +else + cti_report "PASS: rmdir testdir succeeded" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_002.ksh new file mode 100644 index 0000000000..7ec88bc895 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_002.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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mkdir_002 +# +# DESCRIPTION: +# Verify cifs client can create multi-directories on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir and rmdir -p can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mkdir002" +tc_desc=" Verify can create dir on smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS:smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +testdir="dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10" + +# mkdir on server +cti_execute_cmd "(cd $TDIR; mkdir -p $testdir)" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir -p $TDIR failed" + return +else + cti_report "PASS: mkdir -p $TDIR succeeded" +fi + +cti_execute_cmd "(cd $TDIR; rmdir -p $testdir)" +if [[ $? != 0 ]]; then + cti_fail "FAIL: rmdir -p $TDIR failed" + return +else + cti_report "PASS: rmdir -p $TDIR succeeded" +fi + +if [[ -d $TMNT/dir1 ]]; then + cti_fail "FAIL: the dir dir1 exists" + return +else + cti_report "PASS: the dir dir1 doesn't exist" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_003.ksh new file mode 100644 index 0000000000..09c6db9db4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_003.ksh @@ -0,0 +1,112 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mkdir_003 +# +# DESCRIPTION: +# Verify cifs client can create multi dirs on the smbfs mount point +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir and rmdir can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mkdir003" +tc_desc=" Verify can muti dir operation on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# mkdir on smbfs +cti_execute_cmd "mkdir $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir testdir failed" + return +else + cti_report "PASS: mkdir testdir succeeded" +fi + +# list dir +cti_execute_cmd "ls -ld $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: ls -ld testdir failed" + return +else + cti_report "PASS: ls -ld testdir succeeded" +fi + +# access dir +cti_execute_cmd "ls -l $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: ls -l testdir failed" + return +else + cti_report "PASS: ls -l testdir succeeded" +fi + +# negative mkdir case +cti_execute_cmd "mkdir $TMNT/testdir" +if [[ $? == 0 ]]; then + cti_fail "FAIL: 2nd mkdir testdir should fail" + return +else + cti_report "PASS: 2nd mkdir testdir failed" +fi + +# rmdir +cti_execute_cmd "rmdir $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: rmdir testdir failed" + return +else + cti_report "PASS: rmdir testdir succeeded" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_004.ksh new file mode 100644 index 0000000000..834ef6460d --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_004.ksh @@ -0,0 +1,124 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mkdir_004 +# +# DESCRIPTION: +# Verify can muti dir operation on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir and rmdir can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mkdir004" +tc_desc=" Verify can muti dir operation on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can mount the public share" + return +else + cti_report "PASS: smbmount can't mount the public share" +fi + +cpath=$(pwd) +cti_execute_cmd "rm -rf $TMNT/*" + +# create 40 testdir +i=1 +while ((i<40)); do + cti_execute_cmd "mkdir $TMNT/testdir$i" + if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir testdir$i faled" + return + fi + ((i=i+1)) +done + +cti_execute FAIL "ls -la $TMNT" +if [[ $? != 0 ]]; then + cti_fail "FAIL: ls -la failed" + return +else + cti_report "PASS: ls -la succeeded" +fi + +# del the 40 testdir +i=1 +while ((i<40)); do + cti_execute_cmd "rmdir $TMNT/testdir$i" + if [[ $? != 0 ]]; then + cti_fail "FAIL: rmdir testdir$i failed" + return + fi + ((i=i+1)) +done + +# create 40 deep dir +cdir=$(pwd) +i=1 +d=testdir_a1 +while ((i<40)); do + cti_execute_cmd "mkdir $TMNT/$d" + if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir testdir_a$i failed" + return + fi + ((i=i+1)) + d=$d/testdir_a$i +done + +# find on dirs +cti_execute FAIL "find $TMNT" +if [[ $? != 0 ]]; then + cti_fail "FAIL: find . failed" + return +else + cti_report "PASS: find . succeeded" +fi + +# clean up +cti_execute_cmd "rm -rf $TMNT/*" +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_005.ksh new file mode 100644 index 0000000000..fc788576c7 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_005.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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mkdir_005 +# +# DESCRIPTION: +# Verify cifs client can create dir on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir and rmdir can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mkdir005" +tc_desc=" Verify can muti dir operation on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# mkdir on smbfs +cti_execute_cmd "mkdir $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir testdir failed" + return +else + cti_report "PASS: mkdir dir(testdir) succeeded" +fi + +# create file on a exist dir +cti_execute_cmd "cat /usr/bin/ls > $TMNT/testdir" +if [[ $? == 0 ]]; then + cti_fail "FAIL: cat /usr/bin/ls > testdir should failed" + return +else + cti_report "PASS: cat /usr/bin/ls > testdir failed" +fi + +# rmdir +cti_execute_cmd "rmdir $TMNT/testdir" +if [[ $? != 0 ]]; then + cti_fail "rmdir testdir failed " + return +else + cti_report "rmdir testdir succeeded " +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_006.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_006.ksh new file mode 100644 index 0000000000..83f5dc43f8 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mkdir/tp_mkdir_006.ksh @@ -0,0 +1,87 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mkdir_006 +# +# DESCRIPTION: +# Verify can muti dir operation and create tar file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkdir and rmdir can get the right message +# 3. tar can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mkdir006" +tc_desc=" Verify can muti dir operation on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name)||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# mkdir +cti_execute_cmd "mkdir -p $TMNT/testdir01/dir002" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir testdir01/dir02 failed" + return +else + cti_report "PASS: mkdir testdir01/dir02 succeeded" +fi + +# create tar file +cti_execute_cmd "(cd $TMNT; tar cvf test.tar testdir01)" +if [[ $? != 0 ]]; then + cti_fail "FAIL: create tar file failed" + return +else + cti_report "PASS: create tar file succeeded" +fi + +# delete the tar file and directory +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/mmap/Makefile new file mode 100644 index 0000000000..dee1434ddb --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/Makefile @@ -0,0 +1,33 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/mmap + +TESTS= \ + tp_mmap_001 \ + tp_mmap_002 \ + tp_mmap_003 \ + tp_mmap_004 \ + tp_mmap_005 \ + tp_mmap_006 \ + tp_mmap_007 \ + tp_mmap_008 \ + tp_mmap_009 \ + tp_mmap_010 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_001.ksh new file mode 100644 index 0000000000..f33d248899 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_001.ksh @@ -0,0 +1,125 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_001 +# +# DESCRIPTION: +# Verify smbfs-mmap can putpage with block i/o +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in local testdir +# 3. with continuous mmap, cp the file into smbfs +# 4. diff src file and des file +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap001" +tc_desc=" Verify smbfs-mmap can putpage with block i/o" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# Note: size should be prime (see cp_mmap) +size=1123k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp001" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# make a local file + +cmd="mkfile_mmap -n $size -f ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return $? +else + cti_report "PASS: $cmd" +fi + +# continuously mmap and read the local file, then write into the smbfs file + +cmd="cp_mmap -t c -f ${testdir}/${test_file} ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_002.ksh new file mode 100644 index 0000000000..531aac1b10 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_002.ksh @@ -0,0 +1,125 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_002 +# +# DESCRIPTION: +# Verify smbfs-mmap can putpage without block i/o +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in local testdir +# 3. with discrete mmap, cp the file into smbfs +# 4. diff src file and des file +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap002" +tc_desc=" Verify smbfs-mmap can putpage without block i/o" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# Note: size should be prime (see cp_mmap) +size=1123k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp002" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# make a local file + +cmd="mkfile_mmap -n $size -f ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# discontinuously mmap and read the local file, then write into the smbfs file + +cmd="cp_mmap -t d -f ${testdir}/${test_file} ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_003.ksh new file mode 100644 index 0000000000..1693c51d93 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_003.ksh @@ -0,0 +1,125 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_003 +# +# DESCRIPTION: +# Verify smbfs-mmap can getpage with block i/o +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs +# 3. with continuous mmap, cp the file into local dir +# 4. diff src file and des file +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap003" +tc_desc=" Verify smbfs-mmap can getpage with block i/o" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# Note: size should be prime (see cp_mmap) +size=1123k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp003" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# make a smbfs file + +cmd="mkfile_mmap -n $size -f ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# continuously mmap and read the smbfs file, then write into a local file + +cmd="cp_mmap -t c -f ${mnt_point}/${test_file} ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_004.ksh new file mode 100644 index 0000000000..f85ef19eac --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_004.ksh @@ -0,0 +1,125 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_004 +# +# DESCRIPTION: +# Verify smbfs-mmap can getpage without block i/o +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs +# 3. with discrete mmap, cp the file into local dir +# 4. diff src file and des file +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap004" +tc_desc=" Verify smbfs-mmap can getpage without block i/o" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# Note: size should be prime (see cp_mmap) +size=1123k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp004" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# make a smbfs file + +cmd="mkfile_mmap -n $size -f ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# discontinuously mmap and read the smbfs file, then write into a local file + +cmd="cp_mmap -t d -f ${mnt_point}/${test_file} ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_005.ksh new file mode 100644 index 0000000000..5e72acfef0 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_005.ksh @@ -0,0 +1,120 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_005 +# +# DESCRIPTION: +# Verify compatibility between open(O_RDONLY) & +# mmap(PROT_READ|PROT_WRITE, MAP_SHARED) +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs & local dir, with the same size +# 3. open(O_RDONLY) & mmap(PROT_READ|PROT_WRITE, MAP_SHARED) the smbfs file +# 4. read data from the local file and write into the smbfs file +# 4. diff the smbfs file before written & after written +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap005" +tc_desc=" Verify EACCES with open(O_RDONLY) & mmap(rw, s)" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=1111k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp005" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# make a smbfs file +cmd="mkfile_mmap -n $size -f ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# make a local file, with the same size +cmd="mkfile_mmap -n $size -f ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# open(O_RDONLY) & mmap(PROT_READ|PROT_WRITE, MAP_SHARED) the smbfs file, +# verify can not map write-shared on read-only file +cti_report "expect EACCESS next" +cmd="prot_mmap -o r r -m rs rws -f \ + ${testdir}/${test_file} ${mnt_point}/${test_file}" +cti_execute_cmd $cmd +if (($?==0)); then + cti_fail "FAIL: should be EACCES: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_006.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_006.ksh new file mode 100644 index 0000000000..98b876c635 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_006.ksh @@ -0,0 +1,137 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_006 +# +# DESCRIPTION: +# Verify compatibility between open(O_RDWR) & +# mmap(PROT_READ|PROT_WRITE, MAP_SHARED) +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs & local dir, with the same size +# 3. open(O_RDWR) & mmap(PROT_READ|PROT_WRITE, MAP_SHARED) the smbfs file +# 4. read data from the local file and write into the smbfs file +# 4. diff the 2 files +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap006" +tc_desc=" Verify compatibility between open(O_RDWR) & mmap(rw, s)" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=1111k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp006" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# make a smbfs file +cmd="mkfile_mmap -n $size -f ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# make a local file, with the same size +cmd="mkfile_mmap -n $size -f ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# open(O_RDWR) & mmap(PROT_READ|PROT_WRITE, MAP_SHARED) the smbfs file, +# verify if can write it +cmd="prot_mmap -o r rw -m rs rws -f \ + ${testdir}/${test_file} ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +# verify the data has been written back to the smbfs file +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_007.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_007.ksh new file mode 100644 index 0000000000..b2e4aeb2e5 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_007.ksh @@ -0,0 +1,137 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_007 +# +# DESCRIPTION: +# Verify compatibility between open(O_RDWR) & +# mmap(PROT_READ|PROT_WRITE, MAP_PRIVATE) +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs & local dir, with the same size +# 3. open(O_RDWR) & mmap(PROT_READ|PROT_WRITE, MAP_PRIVATE) the smbfs file +# 4. read data from the local file and write into the smbfs file +# 4. diff the smbfs file before written & after written +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap007" +tc_desc=" Verify compatibility between open(O_RDWR) & mmap(rw, p)" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=1111k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp007" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# make a smbfs file +cmd="mkfile_mmap -n $size -f ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# make a local file, with the same size +cmd="mkfile_mmap -n $size -f ${testdir}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# backup the sum before write the smbfs file +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "before sum $sum1 $cnt1" + +# open(O_RDWR) & mmap(PROT_READ|PROT_WRITE, MAP_PRIVATE) the smbfs file, +# verify if can write it +cmd="prot_mmap -o r rw -m rs rwp -f \ + ${testdir}/${test_file} ${mnt_point}/${test_file}" +cti_execute FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# recalc the sum of the smbfs file +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "after sum $sum2 $cnt2" + +# verify the the smbfs file not changed +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the smbfs file changed" + return +else + cti_report "PASS: the smbfs file not changed" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_008.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_008.ksh new file mode 100644 index 0000000000..97f4c9da7c --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_008.ksh @@ -0,0 +1,120 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_008 +# +# DESCRIPTION: +# Verify smbfs will keep the SMB FID alive when +# there are mapped pages associated with it. +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs +# 3. open, mmap & close the file, then write data into the mapped addr +# 4. verify the data successfully written back to smb server +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap008" +tc_desc=" Verify smbfs will keep the SMB FID alive when there are + mapped pages associated with it" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp008" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# open, mmap & close a file in smbfs, then write something into it +cti_execute FAIL "close_wr ${mnt_point}/${test_file}" +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# do the same thing in local file, for comparison +cti_execute FAIL "close_wr ${testdir}/${test_file}" +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_009.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_009.ksh new file mode 100644 index 0000000000..9c140df2f0 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_009.ksh @@ -0,0 +1,121 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_009 +# +# DESCRIPTION: +# Verify smbfs will help sync the dirty pages to the file and close it, including otW close, if the userland does not explicitly do it. +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mkfile in smbfs +# 3. open, mmap the file, then write some data into the mapped addr +# 4. exit without close the file +# 5. verify the data successfully written back to smb server +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap009" +tc_desc=" Verify smbfs will sync the dirty pages to the file and close it, + including otW close, if the userland does not explicitly do it." +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp009" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# open, mmap a file in smbfs, then write something into it, +# exit without msync/munmap/close +cti_execute FAIL "no_close ${mnt_point}/${test_file}" +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# do the same thing in local file, for comparison +cti_execute FAIL "no_close ${testdir}/${test_file}" +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_010.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_010.ksh new file mode 100644 index 0000000000..253268dfd4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mmap/tp_mmap_010.ksh @@ -0,0 +1,123 @@ +#!/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 2018 Nexenta Systems, Inc. All rights reserved. + +# +# mmap test purpose +# +# __stc_assertion_start +# +# ID: mmap_010 +# +# DESCRIPTION: +# Verify file read/write is coherent with mmap. +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. open and mmap a test file +# 3. write something into test file, then check the result through mmap +# 4. memset some parts of mmaped addr, then check the result through +# file read +# 5. close test file +# KEYWORDS: +# +# TESTABILITY: explicit +# +# __stc_assertion_end +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mmap010" +tc_desc=" Verify file read/write is coherent with mmap" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# Note: size should be prime (see cp_mmap) +size=1123k + +server=$(server_name) || return + +testdir=$TDIR +mnt_point=$TMNT + +testdir_init $testdir +smbmount_clean $mnt_point +smbmount_init $mnt_point + +test_file="tmp010" + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $mnt_point" +cti_execute -i '' FAIL $cmd +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# open, mmap a file in smbfs, then perform the 2 tests mentioned above +cti_execute FAIL "rw_mmap -n $size -f ${mnt_point}/${test_file}" +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# do the same thing in local file, for comparison +cti_execute FAIL "rw_mmap -n $size -f ${testdir}/${test_file}" +if (($?!=0)); then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# diff the local file & smbfs file + +cti_execute_cmd "sum ${testdir}/${test_file}" +read sum1 cnt1 junk < cti_stdout +cti_report "local sum $sum1 $cnt1" + +cti_execute_cmd "sum ${mnt_point}/${test_file}" +read sum2 cnt2 junk < cti_stdout +cti_report "smbfs sum $sum2 $cnt2" + +if [[ $sum1 != $sum2 ]] ; then + cti_fail "FAIL: the files are different" + return +else + cti_report "PASS: the files are the same" +fi + +cti_execute_cmd "rm -rf $testdir/*" +cti_execute_cmd "rm -f ${mnt_point}/${test_file}" + +smbmount_clean $mnt_point + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/Makefile new file mode 100644 index 0000000000..277891bfae --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/Makefile @@ -0,0 +1,30 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/mvtest + +TESTS= \ + tp_mvtest_001 \ + tp_mvtest_002 \ + tp_mvtest_003 \ + tp_mvtest_004 \ + tp_mvtest_005 \ + tp_mvtest_006 \ + tp_mvtest_007 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_001.ksh new file mode 100644 index 0000000000..df94ab9738 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_001.ksh @@ -0,0 +1,109 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_001 +# +# DESCRIPTION: +# Verify can mv files on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest001" +tc_desc=" Verify can mv files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "cp /usr/bin/ls $TDIR/test_file" +# mv file to server +cti_execute_cmd "mv $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv $TDIR/test_file test_file failed" + return +else + cti_report "PASS: mv $TDIR/test_file test_file succeeded" +fi + +cti_execute_cmd "cmp -s /usr/bin/ls $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff /usr/bin/ls test_file failed" + return +else + cti_report "PASS: diff /usr/bin/ls test_file succeeded" +fi + +cti_execute_cmd "mv $TMNT/test_file $TDIR/test_file_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_file ${test_file}/test_file_mv failed" + return +else + cti_report "PASS: mv test_file ${test_file}/test_file_mv succeeded" +fi + +# test_file should be gone from server +if [[ -f $TMNT/test_file ]]; then + cti_fail "FAIL: test_file exist" + return +else + cti_report "PASS: test_file doesn't exist" +fi + +cti_execute_cmd "diff /usr/bin/ls $TDIR/test_file_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff /usr/bin/ls $TDIR/test_file failed" + return +else + cti_report "PASS: diff /usr/bin/ls $TDIR/test_file succeeded" +fi + +cti_execute_cmd "rm $TDIR/test_file_mv" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_002.ksh new file mode 100644 index 0000000000..d0aead5607 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_002.ksh @@ -0,0 +1,105 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_002 +# +# DESCRIPTION: +# Verify can mv 300M file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest002" +tc_desc=" Verify can mv large files on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "smbmount can't mount the public share" + return +else + cti_report "smbmount can mount the public share" +fi + +cti_execute_cmd "cp $REFFILE $TDIR/test_file" +cti_execute_cmd "cp $REFFILE $TDIR/test_file_org" +# mv file to server +cti_execute_cmd "mv $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv $TDIR/test_file to test_file failed" + return +else + cti_report "PASS: mv $TDIR/test_file to test_file succeeded" +fi + +cti_execute_cmd "cmp -s $TMNT/test_file $TDIR/test_file_org" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff test_file $TDIR/test_file_org failed" + return +else + cti_report "PASS: diff test_file $TDIR/test_file_org succeeded" +fi + +# mv from the server to local +cti_execute_cmd "mv $TMNT/test_file $TDIR/test_file_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_file $TDIR/test_file_mv failed" + return +else + cti_report "PASS: mv test_file $TDIR/test_file_mv succeeded" +fi + +cti_execute_cmd "cmp -s $TDIR/test_file_org $TDIR/test_file_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff $TDIR/test_file_org $TDIR/test_file_mv" \ + " failed" + return +else + cti_report "PASS: diff $TDIR/test_file_org"\ + " $TDIR/test_file_mv succeeded" +fi + +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_003.ksh new file mode 100644 index 0000000000..4b6ff97ef0 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_003.ksh @@ -0,0 +1,85 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_003 +# +# DESCRIPTION: +# Verify can mv dirs on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest003" +tc_desc=" Verify can mv dirs between server on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# mkdir on server +cti_execute_cmd "mkdir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir test_dir failed" + return +else + cti_report "PASS: mkdir test_dir succeeded" +fi + +cti_execute_cmd "(cd $TMNT; mv test_dir test_dir_mv)" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_dir test_dir_mv failed" + return +else + cti_report "PASS: mv test_dir test_dir_mv succeeded" +fi + + +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_004.ksh new file mode 100644 index 0000000000..53c8138638 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_004.ksh @@ -0,0 +1,88 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_004 +# +# DESCRIPTION: +# Verify can mv 3G file on the smbfs +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest004" +tc_desc=" Verify can mv large file on the smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +size=3g +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +# create file on the server +cmd="dd if=/dev/zero of=$TMNT/test_file oseek=3071 bs=1024k count=1" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: create $TDIR/test_file to test_file failed" + return +else + cti_report "PASS: create $TDIR/test_file to test_file succeeded" +fi + +# mv on server +cti_execute_cmd "(cd $TMNT; mv test_file test_file_mv)" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_file test_file_mv failed" + return +else + cti_report "PASS: mv test_file test_file_mv succeeded" +fi + +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_005.ksh new file mode 100644 index 0000000000..bd9b6a4970 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_005.ksh @@ -0,0 +1,95 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_005 +# +# DESCRIPTION: +# Verify can mv dir between server and client +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest005" +tc_desc=" Verify can mv dir between server and client" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) ||return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can mount the public share" + return +else + cti_report "PASS: smbmount can't mount the public share" +fi + +# mkdir on the local +cti_execute_cmd "mkdir $TDIR/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mkdir $TDIR/test_dir failed" + return +else + cti_report "PASS: mkdir $TDIR/test_dir failed" +fi + + +# mv to server +cti_execute_cmd "mv $TDIR/test_dir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv $TDIR/test_dir to server failed" + return +else + cti_report "PASS: mv $TDIR/test_dir to server succeeded" +fi + +# mv dir from the server to local +cti_execute_cmd "mv $TMNT/test_dir $TDIR/test_dir_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_dir to $TDIR/test_dir_mv failed" + return +else + cti_report "PASS: mv test_dir to $TDIR/test_dir_mv succeeded" +fi + +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_006.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_006.ksh new file mode 100644 index 0000000000..1d8a8b2000 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_006.ksh @@ -0,0 +1,119 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_006 +# +# DESCRIPTION: +# Verify can mv muti dir/files between server and local +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest006" +tc_desc=" Verify can mv muti dir/files between server and local" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +srcdir=/usr/lib/locale/C +server=$(server_name)|| return + +if [[ $? != 0 ]]; then + tet_result UNRESOLVED + return +fi + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" +cti_execute_cmd "rm -rf $TDIR/*" + +# create mutil file/dirs on the local +cti_execute_cmd "cp -rf $srcdir $TDIR/test_dir" +cti_execute_cmd "cp -rf $srcdir $TDIR/test_dir_org" + +# mv to server +cti_execute_cmd "mv $TDIR/test_dir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv $TDIR/test_dir to server failed" + return +else + cti_report "PASS: mv $TDIR/test_dir to server succeeded" +fi + +# diff the local and server +cti_execute_cmd "diff -r $TDIR/test_dir_org $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff -r $TDIR/test_dir_org test_dir failed" + return +else + cti_report "PASS: diff -r $TDIR/test_dir_org test_dir succeeded" +fi + +# mv mutil dirs from the server to local +cti_execute_cmd "mv $TMNT/test_dir $TDIR/test_dir_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_dir to $TDIR/test_dir_mv failed" + return +else + cti_report "PASS: mv test_dir to $TDIR/test_dir_mv succeeded" +fi + +# diff the server to local +cti_execute_cmd "diff -r $TDIR/test_dir_org $TDIR/test_dir_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff -r $TDIR/test_dir_org" \ + " $TDIR/test_dir_mv failed" + return +else + cti_report "PASS: diff -r $TDIR/test_dir_org" \ + " $TDIR/test_dir_mv succeeded" +fi + +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_007.ksh b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_007.ksh new file mode 100644 index 0000000000..5bb861e9ed --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/mvtest/tp_mvtest_007.ksh @@ -0,0 +1,145 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: mvtest_007 +# +# DESCRIPTION: +# Verify can mv muti dir/files between server and local +# +# STRATEGY: +# 1. run "mount -F smbfs //server/public /export/mnt" +# 2. mv and diff can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="mvtest007" +tc_desc=" Verify can mv muti dir/files between server and local" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +srcdir=/usr/lib/locale/C +server=$(server_name)|| return + +if [[ $? != 0 ]]; then + tet_result UNRESOLVED + return +fi + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +# create mutil file/dirs on the server +cti_execute_cmd "cp -rf $srcdir $TMNT/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $srcdir to test_dir failed" + return +else + cti_report "PASS: cp $srcdir to test_dir succeeded" +fi + +# create mutil file/dirs on the server +cti_execute_cmd "cp -rf $srcdir $TMNT/test_dir_org" +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp $srcdir to test_dir_org failed" + return +else + cti_report "PASS: cp $srcdir to test_dir_org succeeded" +fi + +# find . +cti_execute FAIL "(cd $TMNT; find .)" +if [[ $? != 0 ]]; then + cti_fail "FAIL: find failed on smbfs" + return +else + cti_report "PASS: find succeeded on smbfs" +fi + +# mv to local +cti_execute_cmd "mv $TMNT/test_dir $TDIR/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: mv test_dir $TDIR/test_dir failed" + return +else + cti_report "PASS: mv test_dir $TDIR/test_dir succeeded" +fi + +# diff the local and org's +cti_execute_cmd "diff -r $TMNT/test_dir_org $TDIR/test_dir" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff -r test_dir_org $TDIR/test_dir failed" + return +else + cti_report "PASS: diff -r test_dir_org $TDIR/test_dir succeeded" +fi + +# mv muti dir/files from the local to server +cti_execute_cmd "mv $TDIR/test_dir $TMNT/test_dir_mv" +if [[ $? != 0 ]]; then + # This test has errors until we do sysattrs + noise=' preserve extended system attribute' + grep -v "$noise" < cti_stderr > other_stderr + if [[ -s other_stderr ]] ; then + cti_fail "FAIL: $cmd" + return + fi + cti_report "Partial failure from mv local to mount" +else + cti_report "PASS: mv $TDIR/test_dir to test_dir_mv succeeded" +fi + +# diff the server to local +cti_execute_cmd "diff -r $TMNT/test_dir_org $TMNT/test_dir_mv" +if [[ $? != 0 ]]; then + cti_fail "FAIL: diff -r test_dir_org test_dir_mv failed" + return +else + cti_report "PASS: diff -r test_dir_org test_dir_mv succeeded" +fi + +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/Makefile b/usr/src/test/smbclient-tests/tests/smbfs/xattr/Makefile new file mode 100644 index 0000000000..7c2ced118d --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/Makefile @@ -0,0 +1,32 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbfs/xattr + +TESTS= \ + tp_xattr_001 \ + tp_xattr_002 \ + tp_xattr_003 \ + tp_xattr_004 \ + tp_xattr_005 \ + tp_xattr_006 \ + tp_xattr_007 \ + tp_xattr_008 \ + tp_xattr_009 + +include ../../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_001.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_001.ksh new file mode 100644 index 0000000000..6465a18d35 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_001.ksh @@ -0,0 +1,81 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_001 +# +# DESCRIPTION: +# Verify creating,reading and writing xattrs on smbfs works as expected +# +# STRATEGY: +# 1. Create an xattr on a file using runat +# 2. Read an empty xattr directory +# 3. Write the xattr using runat and cat +# 3. Read the xattr using runat +# 4. Delete the xattr +# 5. List the xattr namespace successfully, checking for deletion +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_001 +tc_desc="Verify creating,reading and writing xattrs on smbfs works as expected" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +cti_execute_cmd "touch $TMNT/test_file" +create_xattr $TMNT/test_file passwd /etc/passwd +verify_write_xattr $TMNT/test_file passwd +delete_xattr $TMNT/test_file passwd + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_002.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_002.ksh new file mode 100644 index 0000000000..4a6bfba02e --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_002.ksh @@ -0,0 +1,85 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_002 +# +# DESCRIPTION: +# Verify trying to read a non-existent xattr should fail. +# +# STRATEGY: +# 1. Create a file +# 2. Try to read a non-existent xattr, check that an error is returned. +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_002 +tc_desc="Verify trying to read a non-existent xattr should fail" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# create a file + +cti_execute_cmd "touch $TMNT/test_file" + +# should not find an xattr file +cti_execute_cmd "runat $TMNT/test_file cat not-here.txt" +if [[ $? == 0 ]]; then + cti_fail "FAIL: A read of a non-existent xattr succeeded unexpectedly" + return +else + cti_report "PASS: A read of a non-existent xattr fail as expected" +fi + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_003.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_003.ksh new file mode 100644 index 0000000000..7b52866a01 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_003.ksh @@ -0,0 +1,119 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_003 +# +# DESCRIPTION: +# Verify from local tmpfs with xattrs moved to mount point preserve/omit xattrs +# and from mount point with xattrs moved to local tmpfs preserve/omit xattrs +# +# STRATEGY: +# 1. Create a file, and set an with an xattr +# 2. Move the file to mount point +# 3. Check that mv doesn't have any flags to preserve/omit xattrs - +# they're always moved. +# 4. Do the same in reverse. +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_003 +tc_desc="Verify from local tmpfs with xattrs moved to mount point preserve/omit xattrs\ + and from mount point with xattrs moved to local tmpfs preserve/omit xattrs" + +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +#create a file in local file system with a xattr and then mv it to mount point + +cti_execute_cmd "touch $TDIR/test_file" +create_xattr $TDIR/test_file passwd /etc/passwd +cti_execute_cmd "mv $TDIR/test_file $TMNT/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: can't move the file with xattr from local to mount point unexpectedly +" + return +else + cti_report "PASS: can move the file with xattr from local to mount point as expected" +fi +cti_execute FAIL "runat $TMNT/test_file diff passwd /etc/passwd" +if [[ $? != 0 ]]; then + cti_fail "FAIL: after move the xattr has changed unexpectedly" + return +else + cti_report "PASS: after move the xattr has not changed as expected" +fi +cti_execute_cmd "rm -rf $TDIR/*" +cti_execute_cmd "rm -rf $TMNT/*" + +#create a file in mount point with a xattr and then mv it to local file system + +cti_execute_cmd "touch $TMNT/test_file" +create_xattr $TMNT/test_file passwd /etc/passwd +cti_execute_cmd "mv $TMNT/test_file $TDIR/test_file" +if [[ $? != 0 ]]; then + cti_fail "FAIL: can't move the file with xattr from mount point to local unexpectedly" + return +else + cti_report "PASS: can move the file with xattr from mount point to local as expected" +fi +cti_execute FAIL "runat $TDIR/test_file diff passwd /etc/passwd" +if [[ $? != 0 ]]; then + cti_fail "FAIL: after move the xattr has changed unexpectedly" + return +else + cti_report "PASS: after move the xattr has not changed as expected" +fi + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_004.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_004.ksh new file mode 100644 index 0000000000..599875c765 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_004.ksh @@ -0,0 +1,109 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_004 +# +# DESCRIPTION: +# Verify from local tmpfs with xattrs copied to mount point retain xattr info +# and from mount point with xattrs copied to local tmpfs retain xattr info +# +# STRATEGY: +# 1. Create files in local tmpfs with xattrs +# 2. Copy those files to mount point +# 3. Ensure the xattrs can be retain +# 4. Do the same in reverse. +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_004 +tc_desc="Verify from local tmpfs with xattrs copied to mount point retain xattr info\ + and from mount point with xattrs copied to local tmpfs retain xattr info" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# Create files in local tmpfs, and set some xattrs on them. + +cti_execute_cmd "touch $TDIR/test_file1" +cti_execute_cmd "runat $TDIR/test_file1 cp /etc/passwd ." + +# copy local tmpfs to mount point + +cti_execute_cmd "cp -@ $TDIR/test_file1 $TMNT" + +# ensure the xattr information has been copied correctly + +cti_execute_cmd "runat $TMNT/test_file1 diff passwd /etc/passwd" +if [[ $? != 0 ]]; then + cti_fail "FAIL: file xattr not retain when it copy from local tmpfs to mount point" + return +else + cti_report "PASS: file xattr retain when it copy from local tmpfs to mount point" +fi +# copy mount point to local tmpfs + +cti_execute_cmd "cp -@ $TMNT/test_file1 $TDIR/test_file2" +# ensure the xattr information has been copied correctly + +cti_execute_cmd "runat $TDIR/test_file2 diff passwd /etc/passwd" +if [[ $? != 0 ]]; then + cti_fail "FAIL: file xattr not retain when it copy from mount point to local tmpfs" + return +else + cti_report "PASS: file xattr retain when it copy from mount point to local tmpfs" +fi + +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_005.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_005.ksh new file mode 100644 index 0000000000..db9c02d10d --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_005.ksh @@ -0,0 +1,131 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_005 +# +# DESCRIPTION: +# Verify special . and .. dirs work as expected for xattrs +# +# STRATEGY: +# 1. Create a file and an xattr on that file +# 2. List the . directory, verifying the output +# 3. Verify we're unable to list the ../ directory +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_005 +tc_desc="Verify special . and .. dirs work as expected for xattrs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# create a file, and an xattr on it + +cti_execute_cmd "touch $TMNT/test_file" +create_xattr $TMNT/test_file passwd /etc/passwd + +# listing the directory . should show one file + +OUTPUT=$(runat $TMNT/test_file ls |grep -v SUNWattr_) +if [ "$OUTPUT" != "passwd" ] +then + cti_fail "Listing the . directory doesn't show \"passwd\" as expected." +fi +# list the directory . long form + +cti_execute_cmd "runat $TMNT/test_file ls -a . |grep -v SUNWattr_" +cp cti_stdout output + +# create a file that should be the same as the command above +create_expected_output expected-output . .. passwd +# compare them + +cti_execute_cmd "diff output expected-output" +if [[ $? != 0 ]]; then + cti_fail "FAIL: special . dirs do not work as expected for xattrs" + cti_reportfile output + return +else + cti_report "PASS: special . dirs work as expected for xattrs" +fi + +# list the directory .. expecting one file + +OUTPUT=$(runat $TMNT/test_file ls ..) +if [ $? != 0 ] +then + cti_fail "runat test file ls .. failed with return val =$? unexpectedly" + return +fi + +if [ "$OUTPUT" != ".." ] +then + cti_fail "Listing the .. directory doesn't show \"..\" as expected" + return +fi + +# verify we can't list ../ + +cti_execute_cmd "runat $TMNT/test_file ls ../" +if [[ $? == 0 ]]; then + cti_fail "FAIL: can be able to list the ../ directory unexpectedly" + return +else + cti_report "PASS: unable to list the ../ directory as expected" +fi + +cti_execute_cmd "rm output expected-output" +cti_execute_cmd "rm -rf $TDIR/*" + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_006.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_006.ksh new file mode 100644 index 0000000000..ab4ebb5bef --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_006.ksh @@ -0,0 +1,98 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_006 +# +# DESCRIPTION: +# Verify links between xattr and normal file namespace fail +# +# STRATEGY: +# 1. Create a file and add an xattr to it (to ensure the namespace exists) +# 2. Verify we're unable to create a symbolic link +# 3. Verify we're unable to create a hard link +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_006 +tc_desc="Verify links between xattr and normal file namespace fail" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# Create files set some xattrs on them. + +cti_execute_cmd "touch $TMNT/test_file" +create_xattr $TMNT/test_file passwd /etc/passwd + +# Try to create a soft link from the xattr namespace to the default namespace + +cti_execute_cmd "runat $TMNT/test_file ln -s /etc/passwd foo" +if [[ $? == 0 ]]; then + cti_fail "FAIL: symbolic link between xattr and normal file namespace succeeded unexpectedly" + return +else + cti_report "PASS: symbolic link between xattr and normal file namespace failed as expected" +fi + +# Try to create a hard link from the xattr namespace to the default namespace + +cti_execute_cmd "runat $TMNT/test_file ln /etc/passwd foo" +if [[ $? == 0 ]]; then + cti_fail "FAIL: hard link between xattr and normal file namespace succeeded unexpectedly " + return +else + cti_report "PASS: hard link between xattr and normal file namespace failed as expected" +fi + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_007.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_007.ksh new file mode 100644 index 0000000000..d4376d9a6c --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_007.ksh @@ -0,0 +1,113 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_007 +# +# DESCRIPTION: +# Verify mkdir and various mknods fail inside the xattr namespace +# +# STRATEGY: +# 1. Create a file and add an xattr to it (to ensure the namespace exists) +# 2. Verify that mkdir fails inside the xattr namespace +# 3. Verify that various mknods fails inside the xattr namespace +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_007 +tc_desc="Verify mkdir and various mknods fail inside the xattr namespace" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# Create files set some xattrs on them. + +cti_execute_cmd "touch $TMNT/test_file" +create_xattr $TMNT/test_file passwd /etc/passwd + +# Try to create directory in the xattr namespace + +cti_execute_cmd "runat $TMNT/test_file mkdir foo" +if [[ $? == 0 ]]; then + cti_fail "FAIL: mkdir inside the xattr namespace succeeded unexpectedly" + return +else + cti_report "PASS: mkdir inside the xattr namespace failed as expected" +fi +# Try to create a range of different filetypes in the xattr namespace + +cti_execute_cmd "runat $TMNT/test_file mknod block b 888 888" +if [[ $? == 0 ]]; then + cti_fail "FAIL: mknod block file succeeded unexpectedly inside the xattr namespace" + return +else + cti_report "PASS: mknod block file failed as expected inside the xattr namespace" +fi + +cti_execute_cmd "runat $TMNT/test_file mknod char c" +if [[ $? == 0 ]]; then + cti_fail "FAIL: mknod char file succeeded unexpectedly inside the xattr namespace" + return +else + cti_report "PASS: mknod char file failed as expected inside the xattr namespace" +fi + +cti_execute_cmd "runat $TMNT/test_file mknod fifo p" +if [[ $? == 0 ]]; then + cti_fail "FAIL: mknod fifo file succeeded unexpectedly inside the xattr namespace" + return +else + cti_report "PASS: mknod fifo file failed as expected inside the xattr namespace" +fi + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_008.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_008.ksh new file mode 100644 index 0000000000..004bb033de --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_008.ksh @@ -0,0 +1,303 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_008 +# +# DESCRIPTION: +# Verify basic applications work with xattrs: cpio cp find mv pax tar +# +# STRATEGY: +# 1. For each application +# 2. Create an xattr and archive/move/copy/find files with xattr support +# 3. Also check that when appropriate flag is not used, the xattr +# doesn't get copied +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_008 +tc_desc="Verify basic applications work with xattrs: cpio cp find mv pax tar" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +CDIR=$(pwd) +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# Create a file, and set an xattr on it. This file is used in several of the +# test scenarios below. + +cti_execute_cmd "touch $TMNT/test_file" +create_xattr $TMNT/test_file passwd /etc/passwd + +# For the archive applications below (tar, cpio, pax) +# we create two archives, one with xattrs, one without +# and try various cpio options extracting the archives +# with and without xattr support, checking for correct behaviour + +cpio_xattr=$CDIR/xattr.cpio +cpio_noxattr=$CDIR/noxattr.cpio + +cti_report "Checking cpio" +cti_execute_cmd "touch $TMNT/cpio_test" +create_xattr $TMNT/cpio_test passwd /etc/passwd + +cti_execute_cmd "echo cpio_test| (cd $TMNT; cpio -oc@ -O $cpio_xattr)" +cti_execute_cmd "echo cpio_test| (cd $TMNT; cpio -oc -O $cpio_noxattr)" +cti_execute_cmd "rm -rf $TMNT/cpio_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; cpio -iu -I $cpio_xattr)" +cti_execute_cmd "runat $TMNT/cpio_test cat passwd" +if [[ $? == 0 ]] +then + cti_fail "Fail: we have xattr here unexpectedly" + return +fi +cti_execute_cmd "rm -rf $TMNT/cpio_test" + +# we should have an xattr here + +cti_execute_cmd "(cd $TMNT; cpio -iu@ -I $cpio_xattr)" +verify_xattr $TMNT/cpio_test passwd /etc/passwd +cti_execute_cmd "rm -rf $TMNT/cpio_test" + +#do the same for the second time + +cti_execute_cmd "(cd $TMNT; cpio -iu@ -I $cpio_xattr)" +verify_xattr $TMNT/cpio_test passwd /etc/passwd +cti_execute_cmd "rm -rf $TMNT/cpio_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; cpio -iu -I $cpio_noxattr)" +cti_execute_cmd "runat $TMNT/cpio_test cat passwd" +if [[ $? == 0 ]] +then + cti_fail "Fail: we have xattr here unexpectedly" + return +fi +cti_execute_cmd "rm -rf $TMNT/cpio_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; cpio -iu@ -I $cpio_noxattr)" +cti_execute_cmd "runat $TMNT/cpio_test cat passwd" +if [[ $? == 0 ]] +then + cti_fail "Fail: we have xattr here unexpectedly" + return +fi + +cti_execute_cmd "rm -rf $TMNT/cpio_test" +cti_execute_cmd "rm -rf $cpio_xattr" +cti_execute_cmd "rm -rf $cpio_noxattr" + +cti_report "Checking cp" +# check that with the right flag, the xattr is preserved + +cti_execute_cmd "(cd $TMNT; cp -@ test_file test_file1)" +compare_xattrs $TMNT/test_file $TMNT/test_file1 passwd +cti_execute_cmd "rm -rf $TMNT/test_file1" + +# without the right flag, there should be no xattr (ls should fail) + +cti_execute_cmd "(cd $TMNT; cp test_file test_file1)" +cti_execute_cmd "runat $TMNT/cpio_test ls passwd" +if [[ $? == 0 ]] +then + cti_fail "Fail: we have xattr here unexpectedly" + return +fi +cti_execute_cmd "rm -rf $TMNT/test_file1" + +# create a file without xattrs, and check that find -xattr only finds +# our test file that has an xattr. + +cti_report "Checking find" +cti_execute_cmd "mkdir $TMNT/noxattrs" +cti_execute_cmd "touch $TMNT/noxattrs/no-xattr" + +cti_execute_cmd "find $TMNT -xattr | grep test_file" +if [ $? -ne 0 ] +then + cti_fail "find -xattr didn't find our file that had an xattr unexpectedly" +fi +cti_execute_cmd "find $TMNT -xattr | grep no-xattr" +if [ $? -eq 0 ] +then + cti_fail "find -xattr found a file that didn't have an xattr unexpectedly" +fi +cti_execute_cmd "rm -rf $TMNT/noxattrs" + +# mv doesn't have any flags to preserve/ommit xattrs - they're +# always moved. + +cti_report "Checking mv" +cti_execute_cmd "touch $TMNT/mvtest" +create_xattr $TMNT/mvtest passwd /etc/passwd +cti_execute_cmd "(cd $TMNT; mv mvtest mvtest2)" +verify_xattr $TMNT/mvtest2 passwd /etc/passwd +cti_execute_cmd "rm $TMNT/mvtest" +cti_execute_cmd "rm $TMNT/mvtest2" + +pax_xattr=$CDIR/xattr.pax +pax_noxattr=$CDIR/noxattr.pax + +cti_report "Checking pax" +cti_execute_cmd "touch $TMNT/pax_test" +create_xattr $TMNT/pax_test passwd /etc/passwd +cti_execute_cmd "(cd $TMNT; pax -w -f $pax_noxattr pax_test)" +cti_execute_cmd "(cd $TMNT; pax -w@ -f $pax_xattr pax_test)" +cti_execute_cmd "rm $TMNT/pax_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; pax -r -f $pax_noxattr)" +cti_execute_cmd "runat $TMNT/pax_test cat passwd" +if [[ $? == 0 ]]; then + cti_fail "FAIL: we have xattr here unexpectedly" + return +else + cti_report "PASS: we should have no xattr here as expected" +fi +cti_execute_cmd "rm $TMNT/pax_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; pax -r@ -f $pax_noxattr)" +cti_execute_cmd "runat $TMNT/pax_test cat passwd" +if [[ $? == 0 ]]; then + cti_fail "FAIL: we have xattr here unexpectedly" + return +else + cti_report "PASS: we should have no xattr here as expected" +fi +cti_execute_cmd "rm $TMNT/pax_test" + +# we should have an xattr here + +cti_execute_cmd "(cd $TMNT; pax -r@ -f $pax_xattr)" +verify_xattr $TMNT/pax_test passwd /etc/passwd +cti_execute_cmd "rm $TMNT/pax_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; pax -r -f $pax_xattr)" +cti_execute_cmd "runat $TMNT/pax_test cat passwd" +if [[ $? == 0 ]]; then + cti_fail "FAIL: we have xattr here unexpectedly" + return +else + cti_report "PASS: we should have no xattr here as expected" +fi +cti_execute_cmd "rm $TMNT/pax_test" +cti_execute_cmd "rm $pax_noxattr" +cti_execute_cmd "rm $pax_xattr" + +tar_xattr=$CDIR/xattr.tar +tar_noxattr=$CDIR/noxattr.tar + +cti_report "Checking tar" +cti_execute_cmd "touch $TMNT/tar_test" +create_xattr $TMNT/tar_test passwd /etc/passwd +cti_execute_cmd "(cd $TMNT; tar cf $tar_noxattr tar_test)" +cti_execute_cmd "(cd $TMNT; tar c@f $tar_xattr tar_test)" +cti_execute_cmd "rm $TMNT/tar_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; tar xf $tar_xattr)" +cti_execute_cmd "runat $TMNT/tar_test cat passwd" +if [[ $? == 0 ]]; then + cti_fail "FAIL: we have xattr here unexpectedly" + return +else + cti_report "PASS: we should have no xattr here as expected" +fi +cti_execute_cmd "rm $TMNT/tar_test" + +# we should have an xattr here + +cti_execute_cmd "(cd $TMNT; tar x@f $tar_xattr)" +verify_xattr $TMNT/tar_test passwd /etc/passwd +cti_execute_cmd "rm $TMNT/tar_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; tar xf $tar_noxattr)" +cti_execute_cmd "runat $TMNT/tar_test cat passwd" +if [[ $? == 0 ]]; then + cti_fail "FAIL: we have xattr here unexpectedly" + return +else + cti_report "PASS: we should have no xattr here as expected" +fi +cti_execute_cmd "rm $TMNT/tar_test" + +# we should have no xattr here + +cti_execute_cmd "(cd $TMNT; tar x@f $tar_noxattr)" +cti_execute_cmd "runat $TMNT/tar_test cat passwd" +if [[ $? == 0 ]]; then + cti_fail "FAIL: we have xattr here unexpectedly" + return +else + cti_report "PASS: we should have no xattr here as expected" +fi +cti_execute_cmd "rm $TMNT/tar_test" +cti_execute_cmd "rm $tar_noxattr" +cti_execute_cmd "rm $tar_xattr" + +cti_execute_cmd "rm -rf $TMNT/*" + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_009.ksh b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_009.ksh new file mode 100644 index 0000000000..dfe7c51d44 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbfs/xattr/tp_xattr_009.ksh @@ -0,0 +1,121 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: xattr_009 +# +# DESCRIPTION: +# Verify can create many xattrs on a file +# +# STRATEGY: +# 1. Create a file on a filesystem and add 100 xattrs to it +# 2. Verify that the xattrs should be right +# 4. Delete those xattrs +# 5. Verify that xattrs should not be have +# + +. $STF_SUITE/include/libtest.ksh + +tc_id=xattr_009 +tc_desc="Verify can create many xattrs on a file" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share unexpectedly" + return +else + cti_report "PASS: smbmount can mount the public share as expected" +fi + +smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null +if [[ $? != 0 ]]; then + smbmount_clean $TMNT + cti_unsupported "UNSUPPORTED (no xattr in this mount)" + return +fi + +# Create a file, and set 100 xattrs on it. + +cti_execute_cmd "rm -f $TMNT/test_file" +cti_execute_cmd "touch $TMNT/test_file" +typeset -i i=0 +typeset -i j=100 +while [[ $i -lt $j ]]; do + create_xattr $TMNT/test_file passwd$i /etc/passwd + i=$((i+1)) +done + +#create the expected output then compare them with xattrs in the test_file + +i=0 +cp /dev/null temp_file +echo SUNWattr_ro >> temp_file +echo SUNWattr_rw >> temp_file +while [[ $i -lt $j ]]; do + echo passwd$i >> temp_file + i=$((i+1)) +done +cti_execute_cmd "sort temp_file > expected_file" + +#listing the directory passwd* + +cti_execute_cmd "runat $TMNT/test_file ls > output" +cti_execute_cmd "sort output | diff expected_file -" +if [[ $? != 0 ]]; then +cti_fail "FAIL: do not work as expected for xattrs" +return +else +cti_report "PASS: work as expected for xattrs" +fi + +#delete xattrs in test_file verify these are no passwd* in test_file + +cti_execute_cmd "runat $TMNT/test_file rm -f passwd*" +cti_execute_cmd "runat $TMNT/test_file ls passwd*" +if [[ $? == 0 ]]; then +cti_fail "FAIL: have passwd* xattrs in test_file unexpectedly" +return +else +cti_report "PASS: should not have passwd* xattrs in test_file as expected" +fi + +cti_execute_cmd "rm -f temp_file expected_file output" + +smbmount_clean $TMNT +cti_pass "$tc_id: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/Makefile b/usr/src/test/smbclient-tests/tests/smbmount/Makefile new file mode 100644 index 0000000000..83bc9950e7 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/Makefile @@ -0,0 +1,39 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbmount + +TESTS= \ + tp_smbmount_001 \ + tp_smbmount_002 \ + tp_smbmount_003 \ + tp_smbmount_004 \ + tp_smbmount_005 \ + tp_smbmount_006 \ + tp_smbmount_007 \ + tp_smbmount_008 \ + tp_smbmount_009 \ + tp_smbmount_010 \ + tp_smbmount_011 \ + tp_smbmount_012 \ + tp_smbmount_013 \ + tp_smbmount_014 \ + tp_smbmount_015 \ + tp_smbmount_016 + +include ../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_001.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_001.ksh new file mode 100644 index 0000000000..7a29015251 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_001.ksh @@ -0,0 +1,76 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_001 +# +# DESCRIPTION: +# Verify mount smbfs can mount the public share +# +# STRATEGY: +# 1. run "mount -F smbfs /server/public /export/mnt" +# 2. mount can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount001" +tc_desc="Verify smbmount can mount public share" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +smbmount_check $TMNT || return + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: umount the $TMNT failed" + return +else + cti_report "PASS: mount the $TMNT successfully" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_002.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_002.ksh new file mode 100644 index 0000000000..3534d3c653 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_002.ksh @@ -0,0 +1,76 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_002 +# +# DESCRIPTION: +# Verify smbmount can mount private shares +# +# STRATEGY: +# 1. run "mount -F smbfs //$AUSER:$APASS@$server/$AUSER $TMNT" +# 3. verify mount worked +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount002" +tc_desc=" Verify smbmount can mount private shares" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/a_share $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share a_share" + return +else + cti_report "PASS: smbmount can mount the share a_share" +fi + +smbmount_check $TMNT || return + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: umount the $TMNT suceessfully" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_003.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_003.ksh new file mode 100644 index 0000000000..69cdaafef7 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_003.ksh @@ -0,0 +1,71 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_003 +# +# DESCRIPTION: +# Verify smbmount can't mount private share with wrong passwd +# +# STRATEGY: +# 1. run ""mount -F smbfs //$AUSER:$BPASS@$server/$AUSER" +# 2. mount can get the failed message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount003" +tc_desc=" Verify smbmount can't mount private share with wrong passwd" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +# get rid of our connection first +cti_execute_cmd "smbutil discon //$AUSER@$server" +sleep 1 + +cti_report "expect failure next" +cmd="mount -F smbfs -o noprompt //$AUSER:badpass@$server/a_share $TMNT" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_execute_cmd "echo '::nsmb_vc' |sudo -n mdb -k" + cti_fail "FAIL: smbmount can mount the share a_share with wrong passwd" + return +else + cti_report "PASS: smbmount can't mount the share a_share with wrong passwd" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_004.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_004.ksh new file mode 100644 index 0000000000..694abb9318 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_004.ksh @@ -0,0 +1,74 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_004 +# +# DESCRIPTION: +# Verify a share can't be mounted twice on the same point +# +# STRATEGY: +# 1. run "mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT" twice +# 2. the second mount operation failed +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount004" +tc_desc=" Verify a share can't be mounted twice on the same point" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share with user $TUSER" + return +else + cti_report "PASS: smbmount can mount the public share with user $TUSER" +fi + +# cmd= (same as above) +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbmount can mount the public share on the same point twice" + return +else + cti_report "PASS: smbmount can't mount the public share on the same point twice" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_005.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_005.ksh new file mode 100644 index 0000000000..1fd6370091 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_005.ksh @@ -0,0 +1,166 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_005 +# +# DESCRIPTION: +# Verify "mount -F smbfs -O" work well +# +# STRATEGY: +# 1. create user "$AUSER" and "$BUSER" +# 2. run "mount -F smbfs //$AUSER:$APASS@$server/a_share $TMNT" +# 3. mount successfully +# 4. run "mount -F smbfs -O //$BUSER:$BPASS@$server/b_share $TMNT" +# 5. mount successfully +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount005" +tc_desc="-O work well" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/a_share $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share a_share with user $AUSER" + return +else + cti_report "PASS: smbmount can mount the share a_share with user $AUSER" +fi + +smbmount_check $TMNT || return + +# cp file +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to cp the /usr/bin/ls file" + return +else + cti_report "PASS: cp the /usr/bin/ls file successfully" +fi + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the file /usr/bin/ls is different with file ls_file" + return +else + cti_report "PASS: the file /usr/bin/ls is same to the ls_file file" +fi + +cmd="mount -F smbfs -O -o noprompt //$BUSER:$BPASS@$server/a_share $TMNT" +cti_execute -i '' FAIL sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share a_share on the same point twice with -O option" + return +else + cti_report "PASS: smbmount can mount the share a_share on the same point twice with -O option" +fi + +smbmount_check $TMNT || { + cti_execute_cmd sudo -n "umount $TMNT" + return 1 +} + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the second diff file /usr/bin/ls is different with the ls_file file" + return +else + cti_report "PASS: the second diff file /usr/bin/ls is same to the ls_file file" +fi + +# cp file +cmd="cp /usr/bin/rm $TMNT/rm_file" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to cp the /usr/bin/rm file" + return +else + cti_report "PASS: cp the file /usr/bin/rm successfully" +fi + +cmd="diff /usr/bin/rm $TMNT/rm_file" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the file /usr/bin/rm is different with the rm_file file" + return +else + cti_report "PASS: the file /usr/bin/rm is same to the rm_file file" +fi + +cmd="umount $TMNT" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the first umount $TMNT is failed " + return +else + cti_report "PASS: the first umount $TMNT is successful" +fi + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL:the third diff:file /usr/bin/ls is different with file ls_file" + return +else + cti_report "PASS:the third diff:file /usr/bin/ls is same to file ls_file" +fi +cmd="diff /usr/bin/rm $TMNT/rm_file" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the fourth diff:file /usr/bin/rm is different with file rm_file" + return +else + cti_report "PASS: the fourth diff:file /usr/bin/rm is same to the rm_file file" +fi + +cmd="umount $TMNT" +cti_execute_cmd sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the second umount $TMNT is failed" + return +else + cti_report "PASS: the second umount $TMNT is successful" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_006.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_006.ksh new file mode 100644 index 0000000000..e189bded06 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_006.ksh @@ -0,0 +1,90 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_006 +# +# DESCRIPTION: +# Verify mutil user can't mount on the same mount point" +# +# STRATEGY: +# 1. create user "$AUSER" and "$BUSER" +# 2. run "mount -F smbfs //$AUSER:$APASS@$server/public $TMNT" +# 3. mount successfully +# 4. run "mount -F smbfs //$BUSER:$BPASS@$server/public $TMNT" +# 5. mount failed +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount006" +tc_desc=" Verify mutil user mount failed on the same plan" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +smbmount_check $TMNT || return + +# this should fail +cmd="mount -F smbfs -o noprompt //$BUSER:$BPASS@$server/public $TMNT" +cti_execute -i '' PASS sudo -n -u $BUSER $cmd +if [[ $? == 0 ]]; then + cti_execute_cmd "echo '::nsmb_vc' |sudo -n mdb -k" + cti_fail "FAIL: smbmount - second mount should have failed" + return +else + cti_report "PASS: smbmount - second mount failed as expected" +fi + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: umount the $TMNT successfully" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_007.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_007.ksh new file mode 100644 index 0000000000..0b77cafd12 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_007.ksh @@ -0,0 +1,127 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_007 +# +# DESCRIPTION: +# Verify mutil user mount success with -O +# +# STRATEGY: +# 1. create users "$AUSER", "$BUSER" and their passwords +# 2. create $AUSER smb private share for user "$AUSER" +# 3. run "mount -F smbfs //$AUSER:$APASS@server/public /export/mnt" +# 4. mount successfully +# 5. run "mount -F smbfs -O //$BUSER:$BPASS@server/public /export/mnt" +# 6. mount successfully +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount007" +tc_desc=" Verify mutil user mount success with -o O" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# SKIP for now (mount -O needs privs) +no_tested || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount mount the public share successfully" +fi + +smbmount_check $TMNT || return + +cmd="cp /usr/bin/ls $TMNT/$AUSER" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the file by $AUSER" + return +else + cti_report "PASS: create the file by $AUSER successfully" +fi + +cmd="rm -rf $TMNT/$AUSER" +cti_execute_cmd $cmd + +cmd="mount -F smbfs -O -o noprompt //$BUSER:$BPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the second mount with $BUSER failed" + return +else + cti_report "PASS: the second mount with $BUSER successfully" +fi + +smbmount_check $TMNT || return + +cmd="cp /usr/bin/ls $TMNT/$BUSER" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to create the file by the $BUSER" + return +else + cti_report "PASS: create the file by the $BUSER successfully" +fi + +cmd="rm -rf $TMNT/$BUSER" +cti_execute_cmd $cmd + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: umount the $TMNT successfully" +fi + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the second umount the $TMNT failed" + return +else + cti_report "PASS: the second umount the $TMNT successfully" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_008.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_008.ksh new file mode 100644 index 0000000000..1bd320627d --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_008.ksh @@ -0,0 +1,94 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_008 +# +# DESCRIPTION: +# Verify normal smbmount can mount public share +# +# STRATEGY: +# 1. run sudo -u $TUSER "mount -F smbfs -ofileperms=666" +# //$TUSER:$TPASS@$server/public $TMNT"" +# 2. mount successfully +# 3. run sudo -u $AUSER "cp /usr/bin/ls ls_file" +# 4. mount and cp can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount008" +tc_desc="Verify normal smbmount can mount public share" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +sudo -n chown $TUSER $TMNT + +cmd="mount -F smbfs -o noprompt,fileperms=666 \ + //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL sudo -n $TUSER "$cmd" +if [[ $? != 0 ]]; then + cti_fail "FAIL: the normal user can't mount the public share" + smbmount_clean $TMNT + return +else + cti_report "PASS: the normal user can mount the public share" +fi + +smbmount_check $TMNT || return + +cti_execute_cmd "rm -rf $TMNT/*" + +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd + +cti_execute_cmd "rm $TMNT/ls_file" + +cmd="umount $TMNT" +cti_execute_cmd "sudo -n -u $TUSER $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the normal user can't umount the public share" + smbmount_clean $TMNT + return +else + cti_report "PASS: the normal user can umount the public share" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_009.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_009.ksh new file mode 100644 index 0000000000..27a78702f4 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_009.ksh @@ -0,0 +1,101 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_009 +# +# DESCRIPTION: +# Verify normal smbmount can mount private shares +# +# STRATEGY: +# 1. run "mount -F smbfs //$AUSER:$APASS@$server/$AUSER $TMNT" +# 2. mount successfully +# 3. rm and cp can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount009" +tc_desc="Verify normal smbmount can mount private shares" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +sudo -n chown $AUSER $TMNT + +cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/a_share $TMNT" +cti_execute -i '' FAIL sudo -n -u $AUSER "$cmd" +if [[ $? != 0 ]]; then + cti_fail "FAIL: the normal user can't mount the share a_share" + return +else + cti_report "PASS: the normal user can mount the share a_share" +fi + +smbmount_check $TMNT || return + +cti_execute_cmd "rm -rf $TMNT/*" + +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: cp the file /usr/bin/ls is failed" + return +else + cti_report "PASS: cp the file /usr/bin/ls successfully" +fi + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute_cmd sudo -n -u $AUSER $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the file /usr/bin/ls is different with the file ls_file" + return +else + cti_report "PASS: the file /usr/bin/ls is same to the file ls_file" +fi + +cti_execute_cmd "rm ls_file" + +cmd="umount $TMNT" +cti_execute_cmd sudo -n -u $AUSER $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the normal user failed to umount the $TMNT" + return +else + cti_report "PASS: the normal user umount the $TMNT successfully" +fi + +smbmount_clean $TMNT +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_010.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_010.ksh new file mode 100644 index 0000000000..f25eda3074 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_010.ksh @@ -0,0 +1,108 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_010 +# +# DESCRIPTION: +# Verify smbmount can work well with smbutil login +# +# STRATEGY: +# 1. run "mount -F smbfs "//aaa;$TUSER:$TPASS@$server/public" $TMNT" +# 2. mount successfully +# 3. cp and diff can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount010" +tc_desc="smbmount can work well with smbutil login" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +smbutil logout -a +cmd="$EXPECT $SMBUTILEXP $TUSER $TPASS@aaa" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd" + return +else + cti_report "PASS: smbutil login set the passwd successfully" +fi + +cmd="mount -F smbfs -o noprompt //aaa;$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the normal user can't mount the public share" + smbutil logout -a + return +else + cti_report "PASS: the normal user can mount the public share" +fi + +smbmount_check $TMNT +if [[ $? != 0 ]]; then + smbutil logout -a + return +fi + +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL $cmd + +cmd="cmp -s /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the file /usr/bin/ls is different with the file ls_file" + smbutil logout -a + return +else + cti_report "PASS: the file /usr/bin/ls is same to with the file ls_file" +fi + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the normal user can't umount the public share" + smbutil logout -a + return +else + cti_report "PASS: the normal user can umount the public share" +fi + +smbmount_clean $TMNT +smbutil logout -a + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_011.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_011.ksh new file mode 100644 index 0000000000..86e9c5b7b7 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_011.ksh @@ -0,0 +1,94 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_011 +# +# DESCRIPTION: +# -o fileperms affects both file and dir permissions +# +# STRATEGY: +# 1. create a smb public share on sever +# 2. run "mount -F smbfs -o fileperms=744 //server/share +# /mnt" on client +# 3. cd /mnt; touch a; ls -l a get 744 permisson +# 4. cd /mnt; mkdir d; ls -l a get 755 permisson +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount011" +tc_desc="fileperm=xxx worked well " +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt,noacl,fileperms=744 + //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd + +cti_execute_cmd "touch $TMNT/a" +perm=$(cd $TMNT; ls -l a|awk '{ print $1}') +if [[ $perm != "-rwxr--r--" && $perm != "-rwxr--r--+" ]]; then + tet_infoline "ls expect get 744 permission, but get $perm" + smbmount_clean $TMNT + tet_result FAIL + return +fi + +cti_execute_cmd "rm -f $TMNT/a" +cti_execute_cmd "mkdir $TMNT/d" + +perm=$(cd $TMNT; ls -ld d|awk '{ print $1}') +if [[ $perm != "drwxr-xr-x" && $perm != "drwxr-xr-x+" ]]; then + tet_infoline "ls expect get 755 permission, but get $perm" + smbmount_clean $TMNT + tet_result FAIL + return +fi +cti_execute_cmd "rm -rf $TMNT/d" + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: failed to umount the $TMNT" +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_012.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_012.ksh new file mode 100644 index 0000000000..8a4d3bdd1a --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_012.ksh @@ -0,0 +1,89 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_012 +# +# DESCRIPTION: +# -o fileperms work well +# +# STRATEGY: +# 1. create a smb public share for user "$AUSER" on sever +# 2. run "mount -F smbfs -o dirperms=540 //a@server/share +# /mnt" on client +# 3. ls -ld /mnt get 540 permisson +# 4. smbutil login //a@server +# 5. cd /PUBLIC get permisson deny +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount012" +tc_desc="dirperms=xxx worked well " +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt,noacl,dirperms=540 + //$AUSER:$APASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the public share" + return +else + cti_report "PASS: smbmount can mount the public share" +fi + +perm=$(ls -ld $TMNT |awk '{ print $1}') +if [[ $perm != "dr-xr-----" && $perm != "dr-xr-----+" ]]; then + cti_fail "FAIL: the expect result is get 540 permission, but get $perm" + return +else + cti_report "PASS: the expect result is right" +fi +cti_execute_cmd "rm -rf $TMNT/a" + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: umount the $TMNT successfully" +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_013.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_013.ksh new file mode 100644 index 0000000000..f53538fd24 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_013.ksh @@ -0,0 +1,105 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_013 +# +# DESCRIPTION: +# -o uid work well +# +# STRATEGY: +# 1. run "mount -F smbfs -o uid=xxx //$TUSER:$TPASS@... +# 2. ls -ld /mnt get owner xxx +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount013" +tc_desc="uid=xxx worked well" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# SKIP for now (mount -uid needs privs) +no_tested || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +# XXX: Should get this user from config +tc_uid="smmsp" + +cmd="mount -F smbfs -o noprompt,noacl,uid=$tc_uid \ + //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL sudo -n $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +usr=$(ls -ld $TMNT|awk '{ print $3}') + +if [[ $usr != "$tc_uid" ]]; then + cti_fail "FAIL: ls -ld, expected $tc_uid, got $usr" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "touch $TMNT/a" +usr=$(ls -l a|awk '{ print $3}') +if [[ $usr != "$tc_uid" ]]; then + cti_fail "FAIL: touch a, expected $tc_uid usr, got $usr" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -rf $TMNT/b" +cti_execute_cmd "mkdir $TMNT/b" +usr=$(ls -ld b|awk '{ print $3}') +if [[ $usr != "$tc_uid" ]]; then + cti_fail "FAIL: mkdir b, expected $tc_uid usr, got $usr" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_014.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_014.ksh new file mode 100644 index 0000000000..3c9a13ce87 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_014.ksh @@ -0,0 +1,90 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_014 +# +# DESCRIPTION: +# Verify readonly worked on smbfs +# STRATEGY: +# 1. create a smb public share for user "$AUSER" on sever +# 2. run "mount -F smbfs //$AUSER:$APASS@$server/$AUSER $TMNT" +# 3. df and cp can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount014" +tc_desc="Verify readonly worked on smbfs" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# SKIP for now (mount priv issues) +no_tested || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/a_share $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share a_share" + return +else + cti_report "PASS: smbmount can mount the share a_share" +fi + +smbmount_check $TMNT || return + +cmd="cp /usr/bin/ls $TMNT" +cti_execute_cmd sudo -n -u $BUSER $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: cp to the smbfs should fail, but it's successful" + return +else + cti_report "PASS: cp to the smbfs is failed, it's right" +fi + + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: umount the $TMNT succssfully" +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_015.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_015.ksh new file mode 100644 index 0000000000..6bfeb65a1f --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_015.ksh @@ -0,0 +1,114 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_015 +# +# DESCRIPTION: +# Verify smbmount can mount 2 private shares +# +# STRATEGY: +# 1. run "mount -F smbfs -o dirperms=777,fileperms=666 +# //$AUSER:$APASS@$server/$AUSER $TMNT" +# 2 mount successfully +# 3. run "mount -F smbfs -o dirperms=777,fileperms=666 +# //$BUSER:$BPASS@$server/$BUSER $TMNT2" +# 4 mount successfully +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount015" +tc_desc="Verify smbmount can mount 2 private shares" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# SKIP for now (mount priv issues) +no_tested || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT +smbmount_clean $TMNT2 +smbmount_init $TMNT2 + +cmd="mount -F smbfs -o noprompt,dirperms=777,fileperms=666 + //$AUSER:$APASS@$server/a_share $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbmount can't mount the share a_share" + return +else + cti_report "PASS: smbmount can mount the share a_share" +fi + +smbmount_check $TMNT || return + +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd + +cmd="mount -F smbfs -o noprompt,dirperms=777,fileperms=666 + //$BUSER:$BPASS@$server/$BUSER $TMNT2" +cti_execute -i '' FAIL $cmd + +smbmount_check $TMNT || return + +cmd="cp /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd + +cmd="diff /usr/bin/ls $TMNT/ls_file" +cti_execute FAIL sudo -n -u $AUSER $cmd + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +else + cti_report "PASS: umount the $TMNT successfully" +fi + +cmd="umount $TMNT2" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT2" + return + cti_report "PASS: umount the $TMNT2 successfully" +fi + +smbmount_clean $TMNT +smbmount_clean $TMNT2 + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_016.ksh b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_016.ksh new file mode 100644 index 0000000000..34d0c1dc74 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_016.ksh @@ -0,0 +1,101 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbmount_016 +# +# DESCRIPTION: +# -o gid work well +# +# STRATEGY: +# 1. run "mount -F smbfs -o gid=xxx //$TUSER:$TPASS@... +# 2. ls -ld /mnt get gid xxx +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbmount016" +tc_desc="gid=xxx worked well" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +testdir_init $TDIR +smbmount_clean $TMNT +smbmount_init $TMNT + +# XXX: Should get this group from config +tc_gid="gdm" + +cmd="mount -F smbfs -o noprompt,noacl,gid=$tc_gid \ + //$TUSER:$TPASS@$server/public $TMNT" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +fi + +grp=$(ls -ld $TMNT|awk '{ print $4}') +if [[ $grp != "$tc_gid" ]]; then + cti_fail "FAIL: ls -ld, expected $tc_gid, got $grp" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "touch $TMNT/a" +grp=$(cd $TMNT; ls -l a|awk '{ print $4}') +if [[ $grp != "$tc_gid" ]]; then + cti_fail "FAIL: touch a, expected $tc_gid usr, got $grp" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -rf $TMNT/b" +cti_execute_cmd "mkdir $TMNT/b" +grp=$(cd $TMNT; ls -ld b|awk '{ print $4}') +if [[ $grp != "$tc_gid" ]]; then + cti_fail "FAIL: mkdir b, expected $tc_gid usr, got $grp" + smbmount_clean $TMNT + return +fi + +cti_execute_cmd "rm -rf $TMNT/*" + +cmd="umount $TMNT" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: failed to umount the $TMNT" + return +fi + +smbmount_clean $TMNT + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/Makefile b/usr/src/test/smbclient-tests/tests/smbutil/Makefile new file mode 100644 index 0000000000..7527356a9f --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/Makefile @@ -0,0 +1,39 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +include $(SRC)/Makefile.master +include ../../Makefile.com + +ROOTTESTDIR= $(ROOTOPTPKG)/tests/smbutil + +TESTS= \ + tp_smbutil_001 \ + tp_smbutil_002 \ + tp_smbutil_003 \ + tp_smbutil_004 \ + tp_smbutil_005 \ + tp_smbutil_006 \ + tp_smbutil_007 \ + tp_smbutil_008 \ + tp_smbutil_009 \ + tp_smbutil_010 \ + tp_smbutil_011 \ + tp_smbutil_012 \ + tp_smbutil_013 \ + tp_smbutil_014 \ + tp_smbutil_015 \ + tp_smbutil_016 + +include ../Makefile.tests diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_001.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_001.ksh new file mode 100644 index 0000000000..18aea3b8c0 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_001.ksh @@ -0,0 +1,88 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_001 +# +# DESCRIPTION: +# Verify smbutil can handle invalid arguments +# +# STRATEGY: +# 1. run "smbutil" ... +# 2. smbutil can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil001" +tc_desc="Verify smbutil can handle error arg" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +cti_execute_cmd "rm -f core" + +cti_execute_cmd "smbutil lookup" +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil lookup succeeded" + return +else + cti_report "PASS: smbutil lookup failed" +fi + +cti_execute_cmd "smbutil" +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil succeeded" + return +else + cti_report "PASS: smbutil failed" +fi + +cti_execute_cmd "smbutil status" +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil status succeeded" + return +else + cti_report "PASS: smbutil status failed" +fi + +cti_execute_cmd "smbutil -a" +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil -a suceeded" + return +else + cti_report "PASS: smbutil status failed" +fi + +if [[ -f core ]]; then + cti_fail "FAIL: smbutil coredump" + return +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_002.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_002.ksh new file mode 100644 index 0000000000..850e7adc09 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_002.ksh @@ -0,0 +1,81 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_002 +# +# DESCRIPTION: +# Verify smbutil lookup can resolve NETBIOS name. +# +# STRATEGY: +# 1. run "smbutil lookup" on he smb NETBIOS name +# 2. smbutil can resolve the smb NETBIOS name +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil002" +tc_desc="Test smbutil status, smbutil lookup" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# Try "status" first, which basically tells us if the +# server supports NetBIOS. If not, UNSUPPORTED. +cmd="smbutil status $server" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_unsupported "SKIP: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +# Get the server name from the status output. +grep '^Server' cti_stdout | read junk nbname +if [[ "x$nbname" == x ]] ; then + cti_unsupported "SKIP: Can't get NetBIOS name." + return +else + cti_report "Server NetBIOS name: $nbname" +fi + +# Now try lookup of the NetBIOS name. +cmd="smbutil lookup $nbname" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: $cmd" + return +else + cti_report "PASS: $cmd" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_003.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_003.ksh new file mode 100644 index 0000000000..9ece2ed89c --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_003.ksh @@ -0,0 +1,91 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_003 +# +# DESCRIPTION: +# Verify smbutil login can work. +# +# STRATEGY: +# 1. run "smbutil login ..." +# 2. Verify with "smbutil login -c ..." +# 3. Verify smbutil view can authenticate +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil003" +tc_desc="Verify smbutil login works" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# clean up all the password +smbutil logout -a +cmd="$EXPECT $SMBUTILEXP $TUSER $TPASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd" + return +else + cti_report "PASS: smbutil login succeed to set passwd" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: keychain doesn't exist" + return +else + cti_report "PASS: the keychain doesn't exist" +fi + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't view shares" + return +else + cti_report "PASS: smbutil can view shares" +fi + +parse_view_output public cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view can't get the public share" + return +else + cti_report "PASS: smbutil view can get the public share" +fi + +smbutil logout -a + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_004.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_004.ksh new file mode 100644 index 0000000000..0fb55a25fc --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_004.ksh @@ -0,0 +1,57 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_004 +# +# DESCRIPTION: +# Verify smbutil status can handle invalid hostname +# +# STRATEGY: +# 1. run "smbutil status invalid" +# 2. get correct help message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil004" +tc_desc="Verify smbutil status can handle error arg" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +cti_execute_cmd "smbutil status bad" +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil status bad succeeded" + return +else + cti_report "PASS: smbutil status bad failed" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_005.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_005.ksh new file mode 100644 index 0000000000..056acffae9 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_005.ksh @@ -0,0 +1,123 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_005 +# +# DESCRIPTION: +# Verify smbutil logoutall could work +# +# STRATEGY: +# 1. set up smb server on a test machine +# 2. run "smbutil logoutall" +# 3. smbutil logout and smbutil login can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil005" +tc_desc="Verify smbutil logout could work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# initialize +sudo -n smbutil logoutall + +cmd="$EXPECT $SMBUTILEXP $TUSER $TPASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd" + return +else + cti_report "PASS: smbutil login succeeded to set passwd" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: keychain doesn't exist" + return +else + cti_report "PASS: keychain exists" +fi + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't view shares" + return +else + cti_report "PASS: smbutil can view shares" +fi + +parse_view_output public cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view can't get the public share" + return +else + cti_report "PASS: smbutil view can get the public share" +fi + +cmd="smbutil logout $TUSER" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil logout failed" + return +else + cti_report "PASS: smbutil logout succeeded" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: keychain exists" + return +else + cti_report "PASS: keychain doesn't exist" +fi + +# get rid of our connection first +cti_execute_cmd "smbutil discon //$TUSER@$server" +sleep 1 + +cti_report "expect failure next" +cmd="smbutil view -N //$TUSER@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_execute_cmd "echo ::nsmb_vc|mdb -k" + cti_fail "FAIL: smbutil can view shares" + return +else + cti_report "PASS: smbutil can't view shares" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_006.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_006.ksh new file mode 100644 index 0000000000..48f0308f4b --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_006.ksh @@ -0,0 +1,80 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_006 +# +# DESCRIPTION: +# Verify smbutil view can handle invalid NETBIOS name +# +# STRATEGY: +# 1. run "smbutil view invalid", "smbutil view //invalid" +# 2. smbutil can get the right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil006" +tc_desc="Verify smbutil view can handle invald server syntax" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# this should fail +cmd="smbutil view //bad" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil view //bad succeeded" + return +else + cti_report "PASS: smbutil view //bad failed" +fi + +# this should fail +cmd="smbutil view bad_bad" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil view bad_bad succeeded" +else + cti_report "PASS: smbutil view bad_bad failed" +fi + +# this should fail +cmd="smbutil view $server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil view $server succeeded" + return +else + cti_report "PASS: smbutil view $server failed" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_007.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_007.ksh new file mode 100644 index 0000000000..cda7011c64 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_007.ksh @@ -0,0 +1,69 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_007 +# +# DESCRIPTION: +# Verify smbutil can view the public share +# +# STRATEGY: +# 1. create a smb public share +# 2. run "smbutil view //netbiosname" +# 3. smbutil can get share information +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil007" +tc_desc="Verify smbutil can view public share" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cmd="smbutil view //$TUSER:$TPASS@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "smbutil can't view shares" + return +else + cti_report "smbutil can view shares" +fi + +parse_view_output public cti_stdout +if [[ $? != 0 ]]; then + cti_fail "smbutil view can't get the public share" + return +else + cti_report "smbutil view can get the public share" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_008.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_008.ksh new file mode 100644 index 0000000000..e96e5155a6 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_008.ksh @@ -0,0 +1,72 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_008 +# +# DESCRIPTION: +# Verify smbutil view get private share +# +# STRATEGY: +# 1. create user "$AUSER" and "$BUSER" +# 2. create a smb user "$AUSER" private share +# 3. run "smbutil view //$AUSER:$APASS@netbiosname" +# 4. smbutil can get share information +# 5. run "smbutil view //$BUSER:$BPASS@netbiosname" +# 6. smbutil can't get share information. +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil008" +tc_desc="Verify smbutil can view private share" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cmd="smbutil view //$AUSER:$APASS@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "smbutil can't view shares" + return +else + cti_report "smbutil can view shares" +fi + +parse_view_output a_share cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view did not find a_share" + return +else + cti_report "PASS: smbutil view found a_share" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_009.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_009.ksh new file mode 100644 index 0000000000..8a1fa74705 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_009.ksh @@ -0,0 +1,71 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_009 +# +# DESCRIPTION: +# Verify smbutil view get homes share +# +# STRATEGY: +# 1. create user "$TUSER" +# 2. create a smb homes share +# 3. run "smbutil view //$TUSER:$TPASS@netbiosname" +# 4. smbutil can get share information +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil009" +tc_desc="Verify smbutil can view home share" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +no_tested || return +server=$(server_name) || return + +cmd="smbutil view //$TUSER:$TPASS@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't view the shares" + return +else + cti_report "PASS: smbutil can view the shares" +fi + +parse_view_output homes cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't view home share" + return +else + cti_report "PASS: smbutil can view home share" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_010.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_010.ksh new file mode 100644 index 0000000000..157c6a1fc6 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_010.ksh @@ -0,0 +1,72 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_010 +# +# DESCRIPTION: +# Verify smbutil can view mutil share +# +# STRATEGY: +# 1. smbutil can get mutil share information +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil010" +tc_desc=" Verify smbutil can view mutil share" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +no_tested || return +server=$(server_name) || return + +cmd="smbutil view //$TUSER:$TPASS@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can view shares" + return +else + cti_report "PASS: smbutil can't view shares" +fi + +i=0 +while ((i<20)); do + parse_view_output public$i cti_stdout + if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view can't get share $public$i " + return + else + cti_report "PASS: smbutil view can get share $public$i " + fi + ((i=i+1)) +done + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_011.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_011.ksh new file mode 100644 index 0000000000..c4e593ddd6 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_011.ksh @@ -0,0 +1,64 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_011 +# +# DESCRIPTION: +# Verify smbutil view failed with incorrect password +# +# STRATEGY: +# 1. smbutil failed with incorrect password +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil011" +tc_desc=" Verify smbutil can failed with wrong passwd" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# get rid of our connection first +cti_execute_cmd "smbutil discon //$AUSER:a@$server" +sleep 1 + +cti_report "expect failure next" +cmd="smbutil view -N //$AUSER:a@$server" +cti_execute -i '' PASS $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: smbutil can view private $AUSER with incorrect password" + return +else + cti_report "PASS: smbutil can't view private $AUSER with incorrect password" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_012.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_012.ksh new file mode 100644 index 0000000000..5504fde184 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_012.ksh @@ -0,0 +1,68 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_012 +# +# DESCRIPTION: +# Verify smbutil -A can work +# +# STRATEGY: +# 1. run "smbutil view -A //$server" +# 2. smbutil can get share information +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil012" +tc_desc="Verify smbutil -A can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +cmd="smbutil view -A //$server" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't view the shares" + return +else + cti_report "PASS: smbutil can view the shares" +fi + +parse_view_output public cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view can't get the public share" + return +else + cti_report "PASS: smbutil view can get the public share" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_013.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_013.ksh new file mode 100644 index 0000000000..eef6a4b478 --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_013.ksh @@ -0,0 +1,151 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_013 +# +# DESCRIPTION: +# Verify smbutil logout -a can works +# +# STRATEGY: +# 1. run "smbutil login -c $TUSER" +# 2. smbutil login and smbutil view can get right message +# 3. smbutil logout -a can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil013" +tc_desc="Verify smbutil login -a works" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +server=$(server_name) || return + +# initialize +sudo -n smbutil logoutall + +cmd="$EXPECT $SMBUTILEXP $TUSER \$TPASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set password for user '$TUSER'" + return +else + cti_report "PASS: smbutil login successfully set password for user '$TUSER'" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: keychain doesn't exist" + return +else + cti_report "PASS: keychain exists" +fi + +cmd="smbutil view //$TUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can view the shares" + return +else + cti_report "PASS: smbutil can't view the shares" +fi + +parse_view_output public cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil view can't get the public share" + return +else + cti_report "PASS: smbutil view can get the public share" +fi + +cmd="$EXPECT $SMBUTILEXP $AUSER $APASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd to $AUSER" + return +else + cti_report "PASS: smbutil login succeeded to set passwd to $AUSER" +fi + +cmd="smbutil login -c $AUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: '$AUSER' keychain doesn't exist" + return +else + cti_report "PASS: '$AUSER' keychain exists" +fi + +cmd="smbutil view //$AUSER@$server" +cti_execute -i '' FAIL $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't view shares" + return +else + cti_report "PASS: smbutil can view shares" +fi + +parse_view_output public cti_stdout +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil can't get the public share" + return +else + cti_report "PASS: smbutil can get the public share" +fi + +cti_execute_cmd "smbutil logout -a" +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil logout -a doesn't work" + return +else + cti_report "smbutil logout -a works" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: '$TUSER' keychain exists" + return +else + cti_report "PASS: '$TUSER' keychain doesn't exist" +fi + +cmd="smbutil login -c $AUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: '$AUSER' keychain exists" + return +else + cti_report "PASS: '$AUSER' keychain doesn't exist" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_014.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_014.ksh new file mode 100644 index 0000000000..0f0f2fde1a --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_014.ksh @@ -0,0 +1,115 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_014 +# +# DESCRIPTION: +# Verify smbutil logoutall can work +# +# STRATEGY: +# 1. run "smbutil logoutall" +# 2. smbutil logoutall and smbutil login -c can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil014" +tc_desc="Verify smbutil logoutall can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# initialize +sudo -n smbutil logoutall + +cmd="$EXPECT $SMBUTILEXP $TUSER \$TPASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd to $TUSER" + return +else + cti_report "PASS: smbutil login failed to set passwd to $TUSER" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: '$TUSER' keychain doesn't exist" + return +else + cti_report "PASS: '$TUSER' keychain exists" +fi + +cmd="$EXPECT $SMBUTILEXP $AUSER \$APASS" +cti_execute_cmd sudo -n -u $AUSER $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd to $TUSER" + return +else + cti_report "PASS: smbutil login failed to set passwd to $TUSER" +fi + +cmd="smbutil login -c $AUSER | grep exists" +cti_execute_cmd sudo -n -u $AUSER $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the keychain doesn't exist" + return +else + cti_report "PASS: the keychain exists" +fi + +cmd="sudo -n smbutil logoutall" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil logoutut can't work" + return +else + cti_report "PASS: smbutil logoutut can work" +fi + +cmd="smbutil login -c $TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: the $TUSER keychain exists" + return +else + cti_report "PASS: the $TUSER keychain doesn't exist" +fi + +cmd="smbutil login -c $AUSER | grep exists" +cti_execute_cmd sudo -n -u $AUSER $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: the $AUSER keychain exists" + return +else + cti_report "PASS: the $AUSER keychain doesn't exist" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_015.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_015.ksh new file mode 100644 index 0000000000..a56a05b92f --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_015.ksh @@ -0,0 +1,117 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_015 +# +# DESCRIPTION: +# 1. Do stress testing on smbutil +# 2. Verify smbutil logout -a work well +# +# STRATEGY: +# 1. run "smbutil logout -a" and "smbutil login -c" +# 2. the smbutil commands can get right message +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil015" +tc_desc="Verify smbutil logout -a works" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +sleep 3 + +smbutil logout -a + +i=0 +while ((i<20));do + cmd="$EXPECT $SMBUTILEXP $TUSER$i \$TPASS\$i" + cti_execute_cmd $cmd + if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd to $TUSER$i" + return + else + cti_report "PASS: smbutil login failed to set passwd to $TUSER$i" + fi + + cmd="smbutil login -c $TUSER$i | grep exists" + cti_execute_cmd $cmd + if [[ $? != 0 ]]; then + cti_fail "FAIL: '$TUSER$i' keychain doesn't exist" + return + else + cti_report "PASS: '$TUSER$i' keychain exists" + fi + ((i=i+1)) +done + +i=0 +while ((i<20));do + cmd="smbutil logout $TUSER$i" + cti_execute_cmd $cmd + if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil logout $TUSER$i failed" + return + else + cti_report "PASS: smbutil logout $TUSER$i succeeded" + fi + cmd="smbutil login -c $TUSER$i | grep exists" + cti_execute_cmd $cmd + if [[ $? == 0 ]]; then + cti_fail "FAIL: '$TUSER$i' keychain exists" + return + else + cti_report "PASS: '$TUSER$i' keychain doesn't exist" + fi + ((i=i+1)) +done + +cti_execute_cmd "smbutil logout -a" +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil logout -a doesn't work" + return +else + cti_report "PASS: smbutil logout -a works" +fi + +while ((i<20)); do + cmd="smbutil login -c $TUSER$i|grep exists" + cti_execute_cmd $cmd + if [[ $? == 0 ]]; then + cti_fail "FAIL: '$TUSER$i' keychain exists" + return + else + cti_report "PASS: '$TUSER$i' keychain doesn't exist" + fi + ((i=i+1)) +done + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_016.ksh b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_016.ksh new file mode 100644 index 0000000000..0372fbc7ce --- /dev/null +++ b/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_016.ksh @@ -0,0 +1,124 @@ +#!/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 2010 Sun Microsystems, Inc. All rights reserved. +# + +# +# ID: smbutil_016 +# +# DESCRIPTION: +# Verify smbutil login works +# +# STRATEGY: +# 1. run "smbutil login -c" command +# 2. run "smbutil logout" command +# 3. smbutil commands can get right messages +# + +. $STF_SUITE/include/libtest.ksh + +tc_id="smbutil016" +tc_desc="Verify smbutil login can work" +print_test_case $tc_id - $tc_desc + +if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ + [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then + set -x +fi + +# cleanup the keychains +smbutil logout -a +cmd="$EXPECT $SMBUTILEXP ${TUSER}@mygroup \$TPASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd" + return +else + cti_report "PASS: smbutil login succeeded to set passwd" +fi + +cmd="smbutil login -c mygroup/$TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the keychain doesn't exist" + return +else + cti_report "PASS: the keychain exists" +fi + +cmd="smbutil logout mygroup/$TUSER" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the smbutil logout failed" + return +else + cti_report "PASS: the smbutil logout succeeded" +fi + +cmd="smbutil login -c mygroup/$TUSER | grep exists" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: the keychain exists" + return +else + cti_report "PASS: the keychain doesn't exists" +fi + +cmd="$EXPECT $SMBUTILEXP mygroup/${TUSER} \$TPASS" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: smbutil login failed to set passwd" + return +else + cti_report "PASS: smbutil login succeeded to set passwd" +fi + +cmd="smbutil login -c ${TUSER}@mygroup | grep exists" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the keychain doesn't exist" + return +else + cti_report "PASS: the keychain exists" +fi + +cmd="smbutil logout mygroup/$TUSER" +cti_execute_cmd $cmd +if [[ $? != 0 ]]; then + cti_fail "FAIL: the smbutil logout fail" + return +else + cti_report "PASS: the smbutil logout successfully" +fi + +cmd="smbutil login -c ${TUSER}@mygroup | grep exists" +cti_execute_cmd $cmd +if [[ $? == 0 ]]; then + cti_fail "FAIL: the keychain exists" + return +else + cti_report "PASS: the keychain doestn't exist" +fi + +cti_pass "${tc_id}: PASS" diff --git a/usr/src/test/test-runner/cmd/run b/usr/src/test/test-runner/cmd/run index 678f74f4e1..61fb66791c 100644 --- a/usr/src/test/test-runner/cmd/run +++ b/usr/src/test/test-runner/cmd/run @@ -81,6 +81,8 @@ class Result(object): def done(self, proc, killed): """ Finalize the results of this Cmd. + Report SKIP for return codes 3,4 (NOTINUSE, UNSUPPORTED) + as defined in ../stf/include/stf.shlib """ Result.total += 1 m, s = divmod(time() - self.starttime, 60) @@ -92,6 +94,9 @@ class Result(object): elif self.returncode is 0: self.result = 'PASS' Result.runresults['PASS'] += 1 + elif self.returncode is 3 or self.returncode is 4: + self.result = 'SKIP' + Result.runresults['SKIP'] += 1 elif self.returncode is not 0: self.result = 'FAIL' Result.runresults['FAIL'] += 1 diff --git a/usr/src/test/test-runner/stf/contrib/LICENSE.Artistic b/usr/src/test/test-runner/stf/contrib/LICENSE.Artistic new file mode 100644 index 0000000000..9fe8197153 --- /dev/null +++ b/usr/src/test/test-runner/stf/contrib/LICENSE.Artistic @@ -0,0 +1,119 @@ + The "Artistic License" + + Preamble + + The intent of this document is to state the conditions under which a + Package may be copied, such that the Copyright Holder maintains some + semblance of artistic control over the development of the package, + while giving the users of the package the right to use and distribute + the Package in a more-or-less customary fashion, plus the right to + make reasonable modifications. + + Definitions: + + * "Package" refers to the collection of files distributed by the + Copyright Holder, and derivatives of that collection of files + created through textual modification. + + * "Standard Version" refers to such a Package if it has not been + modified, or has been modified in accordance with the wishes of + the Copyright Holder. + + * "Copyright Holder" is whoever is named in the copyright or + copyrights for the package. + + * "You" is you, if you're thinking about copying or distributing + this Package. + + * "Reasonable copying fee" is whatever you can justify on the + basis of media cost, duplication charges, time of people + involved, and so on. (You will not be required to justify it to + the Copyright Holder, but only to the computing community at + large as a market that must bear the fee.) + + * "Freely Available" means that no fee is charged for the item + itself, though there may be fees involved in handling the item. + It also means that recipients of the item may redistribute it + under the same conditions they received it. + + 1. You may make and give away verbatim copies of the source form of + the Standard Version of this Package without restriction, provided + that you duplicate all of the original copyright notices and + associated disclaimers. + + 2. You may apply bug fixes, portability fixes and other modifications + derived from the Public Domain or from the Copyright Holder. A + Package modified in such a way shall still be considered the Standard + Version. + + 3. You may otherwise modify your copy of this Package in any way, + provided that you insert a prominent notice in each changed file + stating how and when you changed that file, and provided that you do + at least ONE of the following: + + a) place your modifications in the Public Domain or + otherwise make them Freely Available, such as by posting + said modifications to Usenet or an equivalent medium, or + placing the modifications on a major archive site such as + ftp.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or + organization. + + c) rename any non-standard executables so the names do not + conflict with standard executables, which must also be + provided, and provide a separate manual page for each + non-standard executable that clearly documents how it + differs from the Standard Version. + + d) make other distribution arrangements with the Copyright + Holder. + + 4. You may distribute the programs of this Package in object code or + executable form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and + library files, together with instructions (in the manual + page or equivalent) on where to get the Standard Version. + + b) accompany the distribution with the machine-readable + source of the Package with your modifications. + + c) accompany any non-standard executables with their + corresponding Standard Version executables, giving the + non-standard executables non-standard names, and clearly + documenting the differences in manual pages (or + equivalent), together with instructions on where to get the + Standard Version. + + d) make other distribution arrangements with the Copyright + Holder. + + 5. You may charge a reasonable copying fee for any distribution of + this Package. You may charge any fee you choose for support of this + Package. You may not charge a fee for this Package itself. However, + you may distribute this Package in aggregate with other (possibly + commercial) programs as part of a larger (possibly commercial) + software distribution provided that you do not advertise this Package + as a product of your own. + + 6. The scripts and library files supplied as input to or produced as + output from the programs of this Package do not automatically fall + under the copyright of this Package, but belong to whomever generated + them, and may be sold commercially, and may be aggregated with this + Package. + + 7. C or perl subroutines supplied by you and linked into this Package + shall not be considered part of this Package. + + 8. The name of the Copyright Holder may not be used to endorse or + promote products derived from this software without specific prior + written permission. + + 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + The End + diff --git a/usr/src/test/test-runner/stf/contrib/LICENSE.Artistic.descrip b/usr/src/test/test-runner/stf/contrib/LICENSE.Artistic.descrip new file mode 100644 index 0000000000..f5974e483c --- /dev/null +++ b/usr/src/test/test-runner/stf/contrib/LICENSE.Artistic.descrip @@ -0,0 +1 @@ +CTIUTILS.SHLIB IN TEST-RUNNER diff --git a/usr/src/test/test-runner/stf/contrib/include/Makefile b/usr/src/test/test-runner/stf/contrib/include/Makefile index 7740bf0f1e..3bbf61134f 100644 --- a/usr/src/test/test-runner/stf/contrib/include/Makefile +++ b/usr/src/test/test-runner/stf/contrib/include/Makefile @@ -19,7 +19,7 @@ include $(SRC)/test/Makefile.com ROOTOPTPKG = $(ROOT)/opt/test-runner INCLUDEDIR = $(ROOTOPTPKG)/stf/contrib/include -PROGS = logapi.shlib +PROGS = logapi.shlib ctiutils.shlib CMDS = $(PROGS:%=$(INCLUDEDIR)/%) $(CMDS) := FILEMODE = 0555 diff --git a/usr/src/test/test-runner/stf/contrib/include/ctiutils.shlib b/usr/src/test/test-runner/stf/contrib/include/ctiutils.shlib new file mode 100644 index 0000000000..84247c71a5 --- /dev/null +++ b/usr/src/test/test-runner/stf/contrib/include/ctiutils.shlib @@ -0,0 +1,894 @@ +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the "Artistic License" which is located in the +# file named "LICENSE.Artistic" which is included with this software. +# + +# +# This file was originally part of the "contrib" portion of the +# TET3 test harness from The OpenGroup, originally found here: +# http://tetworks.opengroup.org/tet/ or ftp://ftp.xopen.org/pub/TET3/ +# and later published in hg.opensolaris.org/hg/test-dev/stcnv-gate +# +# A build of that repository delivers this file as part of the +# SUNWstc-tetlite package, which carries the "Artistic" license +# referred to above. +# + +# +# The "Artistic License" places some restrictions on the kinds of +# changes that may be made to this file. The changes made here +# relative to the original are "portability fixes" to allow these +# functions to operate in the "test-runner" environment. +# +# The original from which this was derived can be found here: +# https://bitbucket.org/illumos/illumos-stc/ +# under the path: +# usr/src/tools/tet/contrib/ctitools/src/lib/ksh/ctiutils.ksh + +######################################################################## +# +# NAME: ctiutils.shlib +# +# SYNOPSIS: +# cti_assert assertion_number assertion_msg +# cti_report arg ... +# cti_pass +# cti_fail [msg ...] +# cti_unresolved [msg ...] +# cti_untested [msg ...] +# cti_unsupported [msg ...] +# cti_notinuse [msg ...] +# cti_pathtrace +# cti_checkpath expected-path-count +# cti_deleteall reason +# cti_reportfile path [title] +# cti_rmf [files...] +# cti_writefile path mode lines... +# cti_appendfile path mode lines... +# cti_execute [-c out|err] [-i input] result cmd [args...] +# cti_runexpect failtext command pattern action [pattern action ...] +# cti_expecttest failtext command pattern action [pattern action ...] +# cti_cancel test_num [msg ...] [test result] +# cti_cancelall [msg ...] [test result] +# +# DESCRIPTION: +# Common korn shell functions for tests. +# +# cti_report() writes an informational line to the journal. +# +# The functions cti_pass(), cti_fail(), cti_unresolved(), +# cti_untested(), cti_unsupported() and cti_notinuse() each +# registers the corresponding result code against the current test, +# and write any arguments to the execution results file, as a +# single line. +# +# The cti_pathtrace() and cti_checkpath() are used in path tracing. +# cti_pathtrace() increments the variable pathok. cti_checkpath() +# checks the path tracing and registers a PASS result if +# appropriate. +# +# cti_deleteall() cancels all tests in the current test case. +# +# cti_reportfile() writes the contents of a file to the journal. +# +# cti_rmf() removes files. +# +# cti_writefile() writes to the contents of a file; +# cti_appendfile() appends to contents of a file. +# +# cti_execute() executes a command. +# +# cti_runexpect() runs the expect utility. cti_expecttest() is +# like cti_runexpect() except that it is written with path tracing +# and is designed to do the complete work of a test purpose. +# cti_runexpect() runs the expect utility. cti_expecttest() is +# like cti_runexpect() except that it is written with path tracing +# and is designed to do the complete work of a test purpose. +# +# cti_cancel() cancels the dedicated test purpose in the current test +# case from execution with the test result that user gives. It will work +# in startup function. +# +# cti_cancelall() cancels all tests in the current test case. It could +# be used in startup function to cancel the execution of test cases +# with the test result that user gives. +# +######################################################################## + +# +# cti_lf_checkargs() - check number of arguments passed to a shell function. +# +# Usage: cti_lf_checkargs argc expected-argc operator funcname +# +# operator can be EQ or GE. +# +# Returns 0 if the expected number of arguments were passed, non-zero +# otherwise. +# +function cti_lf_checkargs +{ + typeset -i cti_lv_argc=$1 + typeset -i cti_lv_expargc=$2 + typeset cti_lv_op="$3" + typeset cti_lv_funcname="$4" + + case "$cti_lv_op" in + EQ) + if test $cti_lv_argc -ne $cti_lv_expargc + then + cti_unresolved "Test coding error:" \ + "$cti_lv_funcname() called with $cti_lv_argc" \ + "args, need $cti_lv_expargc" + return 1 + fi + ;; + GE) + if test $cti_lv_argc -lt $cti_lv_expargc + then + cti_unresolved "Test coding error:" \ + "$cti_lv_funcname() called with $cti_lv_argc" \ + "args, need >= $cti_lv_expargc" + return 1 + fi + ;; + *) + cti_unresolved "Internal error: cti_lf_checkargs()" \ + "called for $funcname() with operator $cti_lv_op" + return 1 + ;; + esac + + return 0 +} + +# +# cti_result() - register a result and write informational line to journal. +# +# Usage: cti_result result [msg ...] +# +# If the current test function is not a startup or cleanup, this routine +# registers the specified result code for the current test. The remaining +# arguments, if any, are written to the execution results file as a single +# line. +# +# Modifications for test-runner: +# Print the result and test name (in place of tet_result) +# On failure, return non-zero to tell test-runner our status. +# +function cti_result +{ + typeset res + typeset -i rv=0 + + test $# -eq 0 && return + res=$1 + shift + + my_host=`hostname` + my_timestamp=`date | awk '{print $4}'` + + test $# -gt 0 && print "$my_host $my_timestamp $@" + + # Print the result and test name (as tet_result would) + print "$res: ${tc_id:-$(basename $0)}" + + # Return non-zero for failures. See codes in: + # test-runner/stf/include/stf.shlib + case "$res" in + PASS) + ;; + FAIL) + rv=1 + ;; + UNRESOLVED) + rv=2 + ;; + NOTINUSE) + rv=3 + ;; + UNSUPPORTED) + rv=4 + ;; + UNTESTED) + rv=5 + ;; + UNINITIATED) + rv=6 + ;; + NORESULT) + rv=7 + ;; + WARNING) + rv=8 + ;; + TIMED_OUT) + rv=9 + ;; + *) + echo "cti_result: $res: unknown result code" + rv=10 + ;; + esac + return $rv +} + +# +# cti_report() - write an informational line to the journal +# +# Usage: cti_report arg ... +# +# Writes the arguments to the execution results file, as a single line. +# +function cti_report +{ + my_host=`hostname` + my_timestamp=`date | awk '{print $4}'` + + print "$my_host $my_timestamp $@" +} + +# +# cti_assert() - write an Assert line to the journal +# +# Usage: cti_assert assertion_number assertion_msg +# +# Writes the arguments to the execution results file, as a single line. +# +function cti_assert +{ + cti_lf_checkargs $# 2 GE cti_assert || return 1 + + cti_report "ASSERT $1: $2" +} + +# +# cti_pass() - register a PASS result. +# +# Usage: cti_pass [msg ...] +# +function cti_pass +{ + cti_result PASS "$@" +} + +# +# cti_fail() - register a FAIL result. +# +# Usage: cti_fail [msg ...] +# +# Registers a FAIL result for the current test, and writes any arguments to +# the execution results file, as a single line. +# +function cti_fail +{ + cti_result FAIL "$@" +} + +# +# cti_unresolved() - register an UNRESOLVED result. +# +# Usage: cti_unresolved [msg ...] +# +# Registers an UNRESOLVED result for the current test, and writes any arguments +# to the execution results file, as a single line. +# +function cti_unresolved +{ + cti_result UNRESOLVED "$@" +} + + +# +# cti_uninitiated() - register an UNINITIATED result. +# +# Usage: cti_uninitiated [msg ...] +# +# Registers an UNINITIATED result for the current test, and writes any arguments +# to the execution results file, as a single line. +# +function cti_uninitiated +{ + cti_result UNINITIATED "$@" +} + +# +# cti_untested() - register an UNTESTED result. +# +# Usage: cti_untested [msg ...] +# +# Registers an UNTESTED result for the current test, and writes any arguments +# to the execution results file, as a single line. +# +function cti_untested +{ + cti_result UNTESTED "$@" +} + +# +# cti_unsupported() - register an UNSUPPORTED result. +# +# Usage: cti_unsupported [msg ...] +# +# Registers an UNSUPPORTED result for the current test, and writes any +# arguments to the execution results file, as a single line. +# +function cti_unsupported +{ + cti_result UNSUPPORTED "$@" +} + +# +# cti_notinuse() - register a NOTINUSE result. +# +# Usage: cti_notinuse [msg ...] +# +# Registers a NOTINUSE result for the current test, and writes any arguments +# to the execution results file, as a single line. +# +function cti_notinuse +{ + cti_result NOTINUSE "$@" +} + +# +# cti_pathtrace() - increment path counter. +# +# Usage: cti_pathtrace +# +# Increments variable pathok. Like C macro PATH_TRACE. +# +function cti_pathtrace +{ + : $((pathok += 1)) +} + +# +# cti_checkpath() - check path tracing and register a PASS result. +# +# Usage: cti_checkpath expected-path-count +# +# Like C macro PATH_XS_RPT(). +# +function cti_checkpath +{ + cti_lf_checkargs $# 1 EQ cti_checkpath || return + + if test $pathok -eq $1 + then + cti_pass + else + cti_unresolved "Path tracing error: path counter $pathok," \ + "expecting $1" + fi +} + +# +# cti_deleteall() - cancel all tests. +# +# Usage: cti_deleteall reason +# +# Cancels all tests +# +function cti_deleteall +{ + typeset cti_lv_ic + typeset cti_lv_tp + + test $# -eq 0 && return + + for cti_lv_ic in $iclist + do + for cti_lv_tp in `eval echo \\$$cti_lv_ic` + do + if test -n "$cti_lv_tp" + then + echo "Deleted test: $cti_lv_tp" "$@" + fi + done + done +} + +# +# cti_reportfile() - write the contents of a file to the journal. +# +# Usage: cti_reportfile path [title] +# +# Writes the contents of the file specified by path to the execution results +# file, line by line. +# +function cti_reportfile +{ + typeset cti_lv_path=$1 + typeset cti_lv_title="${2:-$cti_lv_path}" + typeset cti_lv_line + + cti_lf_checkargs $# 1 GE cti_reportfile || return + + cti_report "+++ $cti_lv_title +++" + + /usr/bin/cat $cti_lv_path + + cti_report "+++ end +++" + cti_report " " +} + +# +# cti_rmf() - remove files. +# +# Usage: cti_rmf [files...] +# +# Calls "rm -f" to remove the files, and verifies that they have been removed. +# +# Returns 0 on success, non-zero if any of the files could not be removed. +# +function cti_rmf +{ + typeset cti_lv_file + + for cti_lv_file in "$@" + do + rm -f "$cti_lv_file" + + if test -f "$cti_lv_file" + then + cti_unresolved "Error removing file \"$cti_lv_file\"" + return 1 + fi + done + + return 0 +} + +# +# cti_writefile() - write contents of a file. +# +# Usage: cti_writefile path mode lines... +# +# Truncates the file specified by path and then writes the third and +# subsequent arguments to the specified file as separate lines. +# +# Returns 0 on success, non-zero if any of the files could not be removed. +# +function cti_writefile +{ + cti_lf_checkargs $# 3 GE cti_writefile || return 1 + + cti_rmf "$1" || return 1 + cti_appendfile "$@" +} + +# +# cti_appendfile() - append to contents of a file. +# +# Usage: cti_appendfile path mode lines... +# +# Appends the third and subsequent arguments to the specified file as separate +# lines. +# +# Returns 0 on success, non-zero if any of the files could not be removed. +# +function cti_appendfile +{ + typeset cti_lv_path="$1" + typeset cti_lv_mode="$2" + typeset cti_lv_line + + cti_lf_checkargs $# 3 GE cti_appendfile || return 1 + shift 2 + + for cti_lv_line in "$@" + do + echo "$cti_lv_line" >> "$cti_lv_path" + + if [[ $? -ne 0 ]] + then + cti_unresolved \ + "Error writing to file \"$cti_lv_path\"" + return 1 + fi + done + + cti_execute UNRESOLVED chmod "$cti_lv_mode" "$cti_lv_path" + return $? +} + +# +# cti_execute() - execute a command +# +# Usage: cti_execute [-c out|err] [-i input] result cmd [args...] +# +# Executes a command. The standard output is redirected to the file cti_stdout +# and the standard error is redirected to the file cti_stderr. +# +# If the command has a non-zero exit status, cti_execute() registers a result +# code of `result'. +# +# Options: +# -c out|err Check standard output/error. If anything is written to +# the specified output channel, a result code of `result' +# is registered and the output written to the journal. +# May have multiple -c options. +# -i input Use -i as an input line to the command. +# May have multiple -i options. +# +# Returns 0 on success, non-zero on failure (returning the +# exit status from the command when possible). +# +function cti_execute +{ + typeset cti_lv_opt + typeset -i cti_lv_checkstdout=0 + typeset -i cti_lv_checkstderr=0 + typeset cti_lv_result + typeset -i cti_lv_status + typeset -i cti_lv_rv=0 + + # Remove files used for redirecting standard I/O. + cti_rmf cti_stdin cti_stdout cti_stderr || return 1 + + # Create (empty) files to take standard output and error so there are + # no problems later when we come to run the command. + touch cti_stdout cti_stderr + + if [[ $? -ne 0 ]] + then + cti_unresolved "Error creating files cti_stdout and cti_stderr" + return 1 + fi + + # Parse command line options + while getopts "c:i:l:s:" cti_lv_opt + do + case $cti_lv_opt in + c) + case "$OPTARG" in + out|err) + eval cti_lv_checkstd$OPTARG=1 + ;; + *) + cti_unresolved "cti_execute() called with" \ + "bad option argument -c $OPTARG" + return 1 + ;; + esac + ;; + i) + echo "$OPTARG" >> cti_stdin + if [[ $? -ne 0 ]] + then + cti_unresolved "Error writing to cti_stdin" + return 1 + fi + ;; + *) + cti_unresolved "cti_execute() called with illegal" \ + "option $cti_lv_opt" + return 1 + ;; + esac + done + + shift $((OPTIND-1)) + + # Verify the correct number of arguments were passed. + cti_lf_checkargs $# 2 GE cti_execute || return 1 + + # First (non-option) argument is the result code to use if the command + # fails. + cti_lv_result="${1:-UNRESOLVED}" + shift + + # Execute the command, redirecting standard input if required. + if test -f cti_stdin + then + eval "$@" < cti_stdin > cti_stdout 2> cti_stderr + else + eval "$@" > cti_stdout 2> cti_stderr + fi + + cti_lv_status=$? + + # Check the exit status of the command + if test $cti_lv_status -ne 0 + then + if [[ "$cti_lv_result" = "CTI" ]] + then + cti_report CTI "Command \"$*\" failed "\ + "with status $cti_lv_status" + else + cti_result "$cti_lv_result"\ + "Command \"$*\" failed "\ + "with status $cti_lv_status" + cti_lv_rv=$cti_lv_status + fi + fi + + # Always log output of cti_execute_cmd + if [[ "$cti_lv_result" = "CTI" ]] + then + + if test -s cti_stdout + then + cti_reportfile cti_stdout "Standard output from command \"$*\"" + fi + if test -s cti_stderr + then + cti_reportfile cti_stderr "Standard error from command \"$*\"" + fi + return $cti_lv_status + fi + + # If cmd failed, or if "-c err", check standard error. + if test \( $cti_lv_rv -ne 0 -o $cti_lv_checkstderr -eq 1 \) \ + -a -s cti_stderr + then + cti_result "$cti_lv_result" \ + "Command \"$*\" produced standard error" + cti_reportfile cti_stderr "Standard error from command \"$*\"" + [[ $cti_lv_rv = 0 ]] && cti_lv_rv=1 + fi + + # If cmd failed, or if "-c out", check standard output. + if test \( $cti_lv_rv -ne 0 -o $cti_lv_checkstdout -eq 1 \) \ + -a -s cti_stdout + then + cti_result "$cti_lv_result" \ + "Command \"$*\" produced standard output" + cti_reportfile cti_stdout "Standard output from command \"$*\"" + [[ $cti_lv_rv = 0 ]] && cti_lv_rv=1 + fi + + return $cti_lv_rv +} + +# +# Exit values for expect scripts. +# N.B. Do not use 0, as expect uses this for e.g. syntax errors. +# +typeset -ri CTI_EXP_RV_TIMEDOUT=1 +typeset -ri CTI_EXP_RV_TESTFAIL=2 +typeset -ri CTI_EXP_RV_OK=3 + +# +# cti_runexpect() - run the expect utility. +# +# Usage: cti_runexpect failtext command pattern action [pattern action ...] +# +# Executes the expect utility using the command line specified in the second +# argument. Generates a temporary expect script which is removed at the end of +# the call. The arguments following the second are pattern-action pairs. The +# pattern can be a regular expression or "CALL", which indicates the action is +# simply a function call which is unconditionally executed at that point. +# +# The following expect functions are available: +# +# startcritical Indicates that failures from this point onwards +# constitute a test failure. In that case the +# ``failtext'' argument is used to report the error +# message. +# endcritical Indicates the end of the test failure section begun by +# startcritical. +# finish Exit the expect script here - the test has passed. +# +# Returns 0 on success, non-zero on failure. +# +function cti_runexpect +{ + typeset -ri CTI_EXP_TIMEOUT=5 + typeset -r cti_lv_expfile="./cti_$tc_id-$$.exp" + typeset cti_lv_failtext="$1" + typeset cti_lv_command="$2" + typeset -i cti_lv_rv=0 + typeset cti_lv_dopt + + # Verify the correct number of arguments were passed. + cti_lf_checkargs $# 4 GE cti_runexpect || return 1 + + shift 2 + + # Generate expect script. + { + echo "set STATUS_OK $CTI_EXP_RV_OK" + echo "set STATUS_FAIL $CTI_EXP_RV_TESTFAIL" + echo "set STATUS_TIMEDOUT $CTI_EXP_RV_TIMEDOUT" + echo '' + echo "set timeout $CTI_EXP_TIMEOUT" + echo 'set retval $STATUS_TIMEDOUT' + echo '' + echo 'eval spawn [lrange $argv 0 end]' + echo '' + echo 'proc startcritical {} {' + echo ' global retval' + echo ' global STATUS_FAIL' + echo ' set retval $STATUS_FAIL' + echo '}' + echo '' + echo 'proc endcritical {} {' + echo ' global retval' + echo ' global STATUS_TIMEDOUT' + echo ' set retval $STATUS_TIMEDOUT' + echo '}' + echo '' + echo 'proc finish {} {' + echo ' global STATUS_OK' + echo ' exit $STATUS_OK' + echo '}' + + while test $# -gt 1 + do + echo '' + + if test "$1" = "CALL" + then + echo "$2" + else + echo 'expect {' + echo " -re \"$1\" {" + echo " $2 " + echo ' }' + echo ' timeout {' + echo ' exit $retval' + echo ' }' + echo '}' + fi + + shift 2 + done + } > $cti_lv_expfile + + # Check that there were no errors writing to the script file. + if test $? -ne 0 + then + cti_unresolved "Error writing expect script to file" \ + "\"$cti_lv_expfile\"" + return 1 + fi + + # If debug is on, turn on expect debug flag. + case "$CTI_SHELL_DEBUG" in + y*|Y*) + cti_lv_dopt='-d' + ;; + esac + + # Execute expect using generated script. + expect $cti_lv_dopt -f $cti_lv_expfile $cti_lv_command > cti_expout 2>&1 + cti_lv_rv=$? + + # If debug is on, save expect script and output, otherwise remove + # script. + case "$CTI_SHELL_DEBUG" in + y*|Y*) + cp cti_expout ${cti_lv_expfile%.exp}.out + cti_report "DEBUG: expect script is $PWD/$cti_lv_expfile," \ + "expect output is in $PWD/${cti_lv_expfile%.exp}.out" + ;; + *) + rm -f $cti_lv_expfile + esac + + # Deal with return value from expect. + case $cti_lv_rv in + $CTI_EXP_RV_OK) + return 0 + ;; + $CTI_EXP_RV_TIMEDOUT) + cti_unresolved "Expect script timed-out during test setup" + ;; + $CTI_EXP_RV_TESTFAIL) + cti_fail "$cti_lv_failtext" + ;; + *) + cti_unresolved "Test coding error or expect bug:" \ + "unexpected exit status $cti_lv_rv from expect script" + cti_reportfile cti_expout "Output from expect" + ;; + esac + + return 1 +} + +# +# cti_expecttest() - run the expect utility. +# +# Usage: cti_expecttest failtext command pattern action [pattern action ...] +# +# Common test function for test purposes which use expect. Like cti_runexpect() +# except that this is written with path tracing and is designed to do the +# complete work of a test purpose. +# +function cti_expecttest +{ + # Verify the correct number of arguments were passed. + cti_lf_checkargs $# 4 GE cti_expecttest || return + + # Use cti_runexpect() to execute expect utililty. + if cti_runexpect "$@" + then + cti_pathtrace + else + return + fi + + cti_checkpath 1 +} + +function cti_execute_cmd +{ + cti_execute CTI "$@" +} + +# +# "private" functions for internal use by cti_cancel function +# used to replace test purpose functions which will be canceled. +# +function cancel_ic { + cti_result $cticancel_result "$cticancel_msg" +} + +# +# cti_cancel() - cancel an individual test purpose. +# +# Usage: cti_cancel tp reason [test result] +# +# Cancels an individual test by replace the tp function with +# cancel_ic function +# +function cti_cancel { + test $# -gt 3 && return + test_num=$1 + cticancel_msg="$2" + cticancel_result=${3:-"UNSUPPORTED"} + typeset cti_lv_ic cti_lv_ic_mod + typeset cti_lv_tp + + cti_report "Canceling test $test_num: $cticancel_msg" + # + # translate the ic and point the test purpose ic to + # cancel_ic function + # + for cti_lv_ic in $iclist + do + cti_lv_ic_mod="" + for cti_lv_tp in `eval echo \\$$cti_lv_ic` + do + if [ X"$cti_lv_tp" == X"$test_num" ]; then + cti_lv_ic_mod=$cti_lv_ic_mod" cancel_ic" + else + cti_lv_ic_mod=$cti_lv_ic_mod" $cti_lv_tp" + fi + done + eval "$cti_lv_ic=\"$cti_lv_ic_mod\"" + done +} + +# +# cti_cancelall() - cancel all tests. +# +# Usage: cti_cancelall reason [test result] +# +# Cancels all tests by replace the tests functions with cancel_ic function +# +function cti_cancelall { + typeset cti_lv_ic + typeset cti_lv_tp + cticancel_msg=$1 + cticancel_result=${2:-"UNSUPPORTED"} + + test $# -eq 0 && return + + for cti_lv_ic in $iclist + do + for cti_lv_tp in `eval echo \\$$cti_lv_ic` + do + cti_cancel $cti_lv_tp "$cticancel_msg" \ + $cticancel_result + done + done +} |