From owner-svn-src-projects@freebsd.org Fri Aug 4 23:01:15 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E697BDCD9AC for ; Fri, 4 Aug 2017 23:01:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B12187F5B0; Fri, 4 Aug 2017 23:01:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v74N1EYY079335; Fri, 4 Aug 2017 23:01:14 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v74N1EVm079326; Fri, 4 Aug 2017 23:01:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708042301.v74N1EVm079326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 4 Aug 2017 23:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r322069 - in projects/zfsd/head: etc/mtree tests/sys/cddl/zfs/tests/cli_root tests/sys/cddl/zfs/tests/cli_root/zfs_diff X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in projects/zfsd/head: etc/mtree tests/sys/cddl/zfs/tests/cli_root tests/sys/cddl/zfs/tests/cli_root/zfs_diff X-SVN-Commit-Revision: 322069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 23:01:16 -0000 Author: asomers Date: Fri Aug 4 23:01:13 2017 New Revision: 322069 URL: https://svnweb.freebsd.org/changeset/base/322069 Log: Add a regression test for PR 221234 etc/mtree/BSD.tests.dist tests/sys/cddl/zfs/tests/cli_root/Makefile tests/sys/cddl/zfs/tests/cli_root/zfs_diff/... Add an automated test that checks the typical output of "zfs diff". The is the first and only automated test for "zfs diff". It currently fails for a file that gets moved to a new directory. PR: 221234 Sponsored by: Spectra Logic Corp Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/Makefile (contents, props changed) projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/cleanup.ksh projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/setup.ksh projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.golden projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.ksh projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_test.sh (contents, props changed) Modified: projects/zfsd/head/etc/mtree/BSD.tests.dist projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/Makefile Modified: projects/zfsd/head/etc/mtree/BSD.tests.dist ============================================================================== --- projects/zfsd/head/etc/mtree/BSD.tests.dist Fri Aug 4 22:40:26 2017 (r322068) +++ projects/zfsd/head/etc/mtree/BSD.tests.dist Fri Aug 4 23:01:13 2017 (r322069) @@ -500,6 +500,8 @@ .. zpool_detach .. + zfs_diff + .. zpool_scrub .. zfs_inherit Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/Makefile ============================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/Makefile Fri Aug 4 22:40:26 2017 (r322068) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/Makefile Fri Aug 4 23:01:13 2017 (r322069) @@ -18,6 +18,7 @@ TESTS_SUBDIRS+= zfs_clone TESTS_SUBDIRS+= zfs_copies TESTS_SUBDIRS+= zfs_create TESTS_SUBDIRS+= zfs_destroy +TESTS_SUBDIRS+= zfs_diff TESTS_SUBDIRS+= zfs_get TESTS_SUBDIRS+= zfs_inherit TESTS_SUBDIRS+= zfs_mount Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/Makefile Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +.include + +PACKAGE= tests + +TESTSDIR=${TESTSBASE}/sys/cddl/zfs/tests/cli_root/zfs_diff +FILESDIR=${TESTSDIR} + +ATF_TESTS_KSH93+= zfs_diff_test + +${PACKAGE}FILES+= setup.ksh +${PACKAGE}FILES+= cleanup.ksh +${PACKAGE}FILES+= zfs_diff_001_pos.ksh +${PACKAGE}FILES+= zfs_diff.cfg +${PACKAGE}FILES+= zfs_diff_001_pos.golden + +.include Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/cleanup.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/cleanup.ksh Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,31 @@ +#!/usr/local/bin/ksh93 -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2017 Spectra Logic Corp. All rights reserved. +# Use is subject to license terms. +# +# + +. $STF_SUITE/include/libtest.kshlib + +default_cleanup Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/setup.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/setup.ksh Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,32 @@ +#!/usr/local/bin/ksh93 -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2017 Spectra Logic Corp. All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.kshlib + +DISK=${DISKS%% *} + +default_setup $DISK Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,27 @@ +# +# 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 2017 Spectra Logic. All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/tests/cli_root/cli.cfg Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.golden ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.golden Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,13 @@ ++ /testdir1526/dirs/create ++ /testdir1526/files/create +- /testdir1526/dirs/delete +- /testdir1526/files/delete +M /testdir1526/dirs +M /testdir1526/dirs/modify +M /testdir1526/files +M /testdir1526/files/dstdir +M /testdir1526/files/modify +M /testdir1526/files/srcdir +R /testdir1526/dirs/rename -> /testdir1526/dirs/rename.new +R /testdir1526/files/rename -> /testdir1526/files/rename.new +R /testdir1526/files/srcdir/move -> /testdir1526/files/dstdir/move Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.ksh Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,77 @@ +#!/usr/local/bin/ksh93 -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2017 Spectra Logic Corp. All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.kshlib +. $STF_SUITE/tests/cli_root/zfs_set/zfs_set_common.kshlib + +verify_runnable "both" + +log_assert "'zfs diff' output for typical operations" + +# First create a bunch of files and directories + +#log_must ${CD} $TESTDIR +log_must ${MKDIR} ${TESTDIR}/dirs +log_must ${MKDIR} ${TESTDIR}/dirs/leavealone +log_must ${MKDIR} ${TESTDIR}/dirs/modify +log_must ${MKDIR} ${TESTDIR}/dirs/rename +log_must ${MKDIR} ${TESTDIR}/dirs/delete +log_must ${MKDIR} ${TESTDIR}/files +log_must ${TOUCH} ${TESTDIR}/files/leavealone +log_must ${TOUCH} ${TESTDIR}/files/modify +log_must ${TOUCH} ${TESTDIR}/files/rename +log_must ${TOUCH} ${TESTDIR}/files/delete +log_must ${MKDIR} ${TESTDIR}/files/srcdir +log_must ${MKDIR} ${TESTDIR}/files/dstdir +log_must ${TOUCH} ${TESTDIR}/files/srcdir/move + +log_must $ZFS snapshot $TESTPOOL/$TESTFS@1 + +# Now modify them in different ways +log_must ${TOUCH} ${TESTDIR}/dirs/modify +log_must ${MV} ${TESTDIR}/dirs/rename ${TESTDIR}/dirs/rename.new +log_must ${RMDIR} ${TESTDIR}/dirs/delete +log_must ${MKDIR} ${TESTDIR}/dirs/create +log_must ${DATE} >> ${TESTDIR}/files/modify +log_must ${MV} ${TESTDIR}/files/rename ${TESTDIR}/files/rename.new +log_must ${RM} ${TESTDIR}/files/delete +log_must ${MV} ${TESTDIR}/files/srcdir/move ${TESTDIR}/files/dstdir/move +log_must ${TOUCH} ${TESTDIR}/files/create + +log_must $ZFS snapshot $TESTPOOL/$TESTFS@2 + +# "zfs diff"'s output order is unspecified, so we must sort it. The golden +# file is already sorted. +LC_ALL=C $ZFS diff $TESTPOOL/$TESTFS@1 $TESTPOOL/$TESTFS@2 | ${SORT} > $TESTDIR/zfs_diff_output.txt +if [ $? -ne 0 ]; then + log_fail "zfs diff failed" +fi + +# Finally, compare output to the golden output +log_must diff $STF_SUITE/tests/cli_root/zfs_diff/zfs_diff_001_pos.golden $TESTDIR/zfs_diff_output.txt + +log_pass "'zfs diff' gave the expected output" Added: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_test.sh Fri Aug 4 23:01:13 2017 (r322069) @@ -0,0 +1,56 @@ +# 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 2017 Spectra Logic. All rights reserved. +# Use is subject to license terms. +# + + +atf_test_case zfs_diff_001_pos cleanup +zfs_diff_001_pos_head() +{ + atf_set "descr" "zfs diff output for typical operations" + atf_set "require.progs" zfs +} +zfs_diff_001_pos_body() +{ + export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") + atf_expect_fail "PR221234 ZFS diff does not properly display files that have been moved to a new directory." + . $(atf_get_srcdir)/../../../include/default.cfg + . $(atf_get_srcdir)/zfs_diff.cfg + + ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" + ksh93 $(atf_get_srcdir)/zfs_diff_001_pos.ksh || atf_fail "Testcase failed" +} +zfs_diff_001_pos_cleanup() +{ + export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ") + . $(atf_get_srcdir)/../../../include/default.cfg + . $(atf_get_srcdir)/zfs_diff.cfg + + ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" +} + +atf_init_test_cases() +{ + + atf_add_test_case zfs_diff_001_pos +}