From owner-svn-src-stable@freebsd.org Tue Mar 22 19:29:56 2016 Return-Path: Delivered-To: svn-src-stable@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 9BEB1AD9BDB; Tue, 22 Mar 2016 19:29:56 +0000 (UTC) (envelope-from ngie@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 6A2F9B9B; Tue, 22 Mar 2016 19:29:56 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2MJTt8P032748; Tue, 22 Mar 2016 19:29:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2MJTtB3032744; Tue, 22 Mar 2016 19:29:55 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201603221929.u2MJTtB3032744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 22 Mar 2016 19:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297195 - in stable/10/contrib/pjdfstest/tests: . ftruncate open truncate X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2016 19:29:56 -0000 Author: ngie Date: Tue Mar 22 19:29:55 2016 New Revision: 297195 URL: https://svnweb.freebsd.org/changeset/base/297195 Log: MFC r296766: Better handle filesystems mounted with -o noexec ftruncate/11, open/20, and truncate/11 copy sleep(1) to a temporary file on the target filesystem, execute the binary, then expect a result. This doesn't work with scenarios where the target binary cannot be executed, e.g. the filesystem was mounted with -o noexec. Ensure the filesystem hasn't been mounted with -o noexec for the testcases before executing them. Modified: stable/10/contrib/pjdfstest/tests/ftruncate/11.t stable/10/contrib/pjdfstest/tests/misc.sh stable/10/contrib/pjdfstest/tests/open/20.t stable/10/contrib/pjdfstest/tests/truncate/11.t Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/pjdfstest/tests/ftruncate/11.t ============================================================================== --- stable/10/contrib/pjdfstest/tests/ftruncate/11.t Tue Mar 22 18:56:23 2016 (r297194) +++ stable/10/contrib/pjdfstest/tests/ftruncate/11.t Tue Mar 22 19:29:55 2016 (r297195) @@ -8,6 +8,8 @@ dir=`dirname $0` [ "${os}" = "FreeBSD" ] || quick_exit +requires_exec + echo "1..2" n0=`namegen` Modified: stable/10/contrib/pjdfstest/tests/misc.sh ============================================================================== --- stable/10/contrib/pjdfstest/tests/misc.sh Tue Mar 22 18:56:23 2016 (r297194) +++ stable/10/contrib/pjdfstest/tests/misc.sh Tue Mar 22 19:29:55 2016 (r297195) @@ -219,3 +219,37 @@ create_file() { expect 0 lchmod ${name} ${3} fi } + +# Tests for whether or not a filesystem is mounted with a particular option +# with -o, e.g. `mount -o noexec`. +# +# Parameters: +# - mount_option - noatime, noexec, etc. +# +# Returns: +# - 0 if mounted with the option. +# - 1 otherwise. +has_mount_option() +{ + local IFS=, + local mount_opt + + local mount_option_search=$1 + + # XXX: mountpoint is defined in .../tests/sys/pjdfstest/tests/conf + for mount_opt in $(mount -d -p | awk '$2 == "'$mountpoint'" { print $4 }'); do + if [ "$mount_opt" = "$mount_option_search" ]; then + return 0 + fi + done + return 1 +} + +# Filesystem must be mounted with -o exec +requires_exec() +{ + if has_mount_option noexec; then + echo "1..0 # SKIP filesystem mounted with -o noexec" + exit 0 + fi +} Modified: stable/10/contrib/pjdfstest/tests/open/20.t ============================================================================== --- stable/10/contrib/pjdfstest/tests/open/20.t Tue Mar 22 18:56:23 2016 (r297194) +++ stable/10/contrib/pjdfstest/tests/open/20.t Tue Mar 22 19:29:55 2016 (r297195) @@ -8,6 +8,8 @@ dir=`dirname $0` [ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit +requires_exec + echo "1..4" n0=`namegen` Modified: stable/10/contrib/pjdfstest/tests/truncate/11.t ============================================================================== --- stable/10/contrib/pjdfstest/tests/truncate/11.t Tue Mar 22 18:56:23 2016 (r297194) +++ stable/10/contrib/pjdfstest/tests/truncate/11.t Tue Mar 22 19:29:55 2016 (r297195) @@ -8,6 +8,8 @@ dir=`dirname $0` [ "${os}" = "FreeBSD" ] || quick_exit +requires_exec + echo "1..2" n0=`namegen`