diff options
Diffstat (limited to 'src/kernel/tests/vfs.c')
-rw-r--r-- | src/kernel/tests/vfs.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/kernel/tests/vfs.c b/src/kernel/tests/vfs.c index 7b353e8..9f7c6da 100644 --- a/src/kernel/tests/vfs.c +++ b/src/kernel/tests/vfs.c @@ -2,70 +2,8 @@ #include <kernel/tests/base.h> #include <kernel/tests/tests.h> #include <kernel/vfs/mount.h> -#include <kernel/vfs/path.h> #include <shared/mem.h> -TEST(path_simplify) { -#define TEST_WRAPPER(argument, result) do { \ - int len = path_simplify(argument, buf, sizeof(argument) - 1); \ - if (result == NULL) { \ - TEST_COND(len < 0); \ - } else { \ - if (len == sizeof(result) - 1) { \ - TEST_COND(0 == memcmp(result, buf, len)); \ - } else { \ - TEST_COND(false); \ - } \ - } \ - } while (0) - - char buf[256]; - - // some easy cases first - TEST_WRAPPER("/", "/"); - TEST_WRAPPER("/.", "/"); - TEST_WRAPPER("//", "/"); - TEST_WRAPPER("/asdf", "/asdf"); - TEST_WRAPPER("/asdf/", "/asdf/"); - TEST_WRAPPER("/asdf//", "/asdf/"); - TEST_WRAPPER("/asdf/./", "/asdf/"); - TEST_WRAPPER("/a/./b", "/a/b"); - TEST_WRAPPER("/a/./b/", "/a/b/"); - - // some slightly less easy cases - TEST_WRAPPER("/asdf/..", "/"); - TEST_WRAPPER("/asdf/../", "/"); - TEST_WRAPPER("/asdf/.", "/asdf/"); - TEST_WRAPPER("/asdf//.", "/asdf/"); - - TEST_WRAPPER("/foo/bar/..", "/foo/"); - TEST_WRAPPER("/foo/bar/../baz", "/foo/baz"); - TEST_WRAPPER("/foo/bar/../baz/", "/foo/baz/"); - TEST_WRAPPER("/foo/bar/xyz/..", "/foo/bar/"); - TEST_WRAPPER("/foo/bar/xyz/../", "/foo/bar/"); - - // going under the root or close to it - TEST_WRAPPER("/..", NULL); - TEST_WRAPPER("/../asdf", NULL); - TEST_WRAPPER("/../asdf/", NULL); - TEST_WRAPPER("/./a/../..", NULL); - TEST_WRAPPER("/a/a/../..", "/"); - TEST_WRAPPER("/a/../a/..", "/"); - TEST_WRAPPER("/a/../../a", NULL); - TEST_WRAPPER("/../a/../a", NULL); - TEST_WRAPPER("/../../a/a", NULL); - TEST_WRAPPER("/////../..", NULL); - TEST_WRAPPER("//a//../..", NULL); - - // relative paths aren't allowed - TEST_WRAPPER("relative", NULL); - TEST_WRAPPER("some/stuff", NULL); - TEST_WRAPPER("./stuff", NULL); - TEST_WRAPPER("../stuff", NULL); - TEST_WRAPPER("", NULL); -#undef TEST_WRAPPER -} - TEST(vfs_mount_resolve) { struct vfs_mount *mount = NULL; @@ -107,6 +45,5 @@ TEST(vfs_mount_resolve) { } void tests_vfs(void) { - TEST_RUN(path_simplify); TEST_RUN(vfs_mount_resolve); } |