Index: contrib/pjdfstest/tests/ftruncate/11.t =================================================================== --- contrib/pjdfstest/tests/ftruncate/11.t +++ contrib/pjdfstest/tests/ftruncate/11.t @@ -8,6 +8,8 @@ [ "${os}" = "FreeBSD" ] || quick_exit +requires_exec + echo "1..2" n0=`namegen` Index: contrib/pjdfstest/tests/misc.sh =================================================================== --- contrib/pjdfstest/tests/misc.sh +++ contrib/pjdfstest/tests/misc.sh @@ -219,3 +219,36 @@ 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 + + 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 not mounted with exec enabled" + exit 0 + fi +} Index: contrib/pjdfstest/tests/open/20.t =================================================================== --- contrib/pjdfstest/tests/open/20.t +++ contrib/pjdfstest/tests/open/20.t @@ -8,6 +8,8 @@ [ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit +requires_exec + echo "1..4" n0=`namegen` Index: contrib/pjdfstest/tests/truncate/11.t =================================================================== --- contrib/pjdfstest/tests/truncate/11.t +++ contrib/pjdfstest/tests/truncate/11.t @@ -8,6 +8,8 @@ [ "${os}" = "FreeBSD" ] || quick_exit +requires_exec + echo "1..2" n0=`namegen`