diff options
-rw-r--r-- | netfs/unittests/testCore.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index 6bf443f..a55081c 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -275,6 +275,7 @@ BOOST_AUTO_TEST_CASE( access ) memset(&st, 0, sizeof(st)); BOOST_REQUIRE_EQUAL(fuse->access("/", F_OK), 0); BOOST_REQUIRE_EQUAL(fuse->access("/missing", F_OK), -ENOENT); + // Basic assertions BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0700), 0); BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), 0); BOOST_REQUIRE_EQUAL(st.st_mode, 0700 | S_IFDIR); @@ -306,6 +307,27 @@ BOOST_AUTO_TEST_CASE( access ) BOOST_REQUIRE_EQUAL(st.st_mode, 0700 | S_IFDIR); BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir/yes"), 0); BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/yes", &st), -ENOENT); + // Child permissions (files) + struct fuse_file_info fi; + memset(&fi, 0, sizeof(fi)); + fi.flags = O_RDWR; + BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0700), 0); + BOOST_REQUIRE_NE(fuse->create("/dir/yes", 0000, &fi), -1); + BOOST_REQUIRE_EQUAL(fuse->release("/dir/yes", &fi), 0); + BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/yes", &st), 0); + BOOST_REQUIRE_EQUAL(st.st_mode, 0000 | S_IFREG); + BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0500), 0); + BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), 0); + BOOST_REQUIRE_EQUAL(st.st_mode, 0500 | S_IFDIR); + BOOST_REQUIRE_EQUAL(fuse->create("/dir/no", 0600, &fi), -EACCES); + BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/no", &st), -ENOENT); + BOOST_REQUIRE_EQUAL(fuse->unlink("/dir/yes"), -EACCES); + BOOST_REQUIRE_EQUAL(fuse->chmod("/dir", 0700), 0); + BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), 0); + BOOST_REQUIRE_EQUAL(st.st_mode, 0700 | S_IFDIR); + BOOST_REQUIRE_EQUAL(fuse->unlink("/dir/yes"), 0); + BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/yes", &st), -ENOENT); + // Tidy up BOOST_REQUIRE_EQUAL(fuse->rmdir("/dir"), 0); BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st), -ENOENT); } |