summaryrefslogtreecommitdiff
path: root/tests/sys
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2020-05-02 20:14:59 +0000
committerAlan Somers <asomers@FreeBSD.org>2020-05-02 20:14:59 +0000
commitb43a935caec0cc4ae1abef7851d67ba3d135411d (patch)
treeca9f544af383ff932b8d69aa76bf0544a23edc83 /tests/sys
parent698dda67778fa99004fd95c4bdb50ed82a532c8b (diff)
downloadsrc-test2-b43a935caec0cc4ae1abef7851d67ba3d135411d.tar.gz
src-test2-b43a935caec0cc4ae1abef7851d67ba3d135411d.zip
Notes
Diffstat (limited to 'tests/sys')
-rw-r--r--tests/sys/fs/fusefs/utils.cc16
-rw-r--r--tests/sys/mac/bsdextended/matches_test.sh9
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/sys/fs/fusefs/utils.cc b/tests/sys/fs/fusefs/utils.cc
index c07e7b177a2c..ef638523d03c 100644
--- a/tests/sys/fs/fusefs/utils.cc
+++ b/tests/sys/fs/fusefs/utils.cc
@@ -70,6 +70,10 @@ const uint32_t default_max_write = MIN(libfuse_max_write, MAXPHYS / 2);
void check_environment()
{
const char *devnode = "/dev/fuse";
+ const char *bsdextended_node = "security.mac.bsdextended.enabled";
+ int bsdextended_val = 0;
+ size_t bsdextended_size = sizeof(bsdextended_val);
+ int bsdextended_found;
const char *usermount_node = "vfs.usermount";
int usermount_val = 0;
size_t usermount_size = sizeof(usermount_val);
@@ -83,9 +87,19 @@ void check_environment()
GTEST_SKIP() << strerror(errno);
}
}
+ // mac_bsdextended(4), when enabled, generates many more GETATTR
+ // operations. The fusefs tests' expectations don't account for those,
+ // and adding extra code to handle them obfuscates the real purpose of
+ // the tests. Better just to skip the fusefs tests if mac_bsdextended
+ // is enabled.
+ bsdextended_found = sysctlbyname(bsdextended_node, &bsdextended_val,
+ &bsdextended_size, NULL, 0);
+ if (bsdextended_found == 0 && bsdextended_val != 0)
+ GTEST_SKIP() <<
+ "The fusefs tests are incompatible with mac_bsdextended.";
ASSERT_EQ(sysctlbyname(usermount_node, &usermount_val, &usermount_size,
NULL, 0),
- 0);;
+ 0);
if (geteuid() != 0 && !usermount_val)
GTEST_SKIP() << "current user is not allowed to mount";
}
diff --git a/tests/sys/mac/bsdextended/matches_test.sh b/tests/sys/mac/bsdextended/matches_test.sh
index 4cfbaeb130a4..c799dd92f075 100644
--- a/tests/sys/mac/bsdextended/matches_test.sh
+++ b/tests/sys/mac/bsdextended/matches_test.sh
@@ -16,6 +16,12 @@ check_ko()
if ! sysctl -N security.mac.bsdextended >/dev/null 2>&1; then
atf_skip "mac_bsdextended(4) support isn't available"
fi
+ if [ $(sysctl -n security.mac.bsdextended.enabled) = "0" ]; then
+ # The kernel module is loaded but disabled. Enable it for the
+ # duration of the test.
+ touch enabled_bsdextended
+ sysctl security.mac.bsdextended.enabled=1
+ fi
}
setup()
@@ -69,6 +75,9 @@ cleanup()
if [ -f md_device ]; then
mdconfig -d -u $( cat md_device )
fi
+ if [ -f enabled_bsdextended ]; then
+ sysctl security.mac.bsdextended.enabled=0
+ fi
}
atf_test_case no_rules cleanup