Skip to content
Snippets Groups Projects
Commit 41614da6 authored by Raphael S. Carvalho's avatar Raphael S. Carvalho Committed by Pekka Enberg
Browse files

tst-vfs: Add test case to dentry hierarchy support

parent 67d82557
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <unistd.h> #include <unistd.h>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <osv/dentry.h>
BOOST_AUTO_TEST_CASE(test_path_lookup) BOOST_AUTO_TEST_CASE(test_path_lookup)
{ {
TempDir dir; TempDir dir;
...@@ -45,6 +47,32 @@ BOOST_AUTO_TEST_CASE(test_path_lookup) ...@@ -45,6 +47,32 @@ BOOST_AUTO_TEST_CASE(test_path_lookup)
} }
} }
extern "C" {
int namei(char *, struct dentry **);
void drele(struct dentry *);
}
BOOST_AUTO_TEST_CASE(test_dentry_hierarchy)
{
debug("Running dentry hierarchy tests\n");
char path[] = "/tests/tst-vfs.so";
struct dentry *dp;
BOOST_REQUIRE(!namei(path, &dp));
// Check if dentry hierarchy is exactly as expected.
BOOST_CHECK_EQUAL("/tests/tst-vfs.so", dp->d_path);
BOOST_REQUIRE(dp->d_parent);
BOOST_CHECK_EQUAL("/tests", dp->d_parent->d_path);
BOOST_REQUIRE(dp->d_parent->d_parent);
BOOST_CHECK_EQUAL("/", dp->d_parent->d_parent->d_path);
drele(dp);
debug("dentry hierarchy tests succeeded\n");
}
BOOST_AUTO_TEST_CASE(test_concurrent_file_operations) BOOST_AUTO_TEST_CASE(test_concurrent_file_operations)
{ {
debug("Running concurrent file operation tests\n"); debug("Running concurrent file operation tests\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment