vfs: Remove misc tests
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 12 Mar 2018 00:48:40 +0000 (20:48 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 30 Apr 2018 18:31:44 +0000 (14:31 -0400)
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/ktest/pb_ktests.c

index e39d005..4f84ed5 100644 (file)
@@ -32,7 +32,6 @@
 #include <slab.h>
 #include <kmalloc.h>
 #include <hashtable.h>
-#include <radix.h>
 #include <circular_buffer.h>
 #include <monitor.h>
 #include <kthread.h>
@@ -948,116 +947,6 @@ bool test_ucq(void)
        return true;
 }
 
-bool test_radix_tree(void)
-{
-       struct radix_tree real_tree = RADIX_INITIALIZER;
-       struct radix_tree *tree = &real_tree;
-       void *retval;
-
-       KT_ASSERT_M("It should be possible to insert at 0",
-                   !radix_insert(tree, 0, (void*)0xdeadbeef, 0));
-       radix_delete(tree, 0);
-       KT_ASSERT_M("It should be possible to re-insert at 0",
-                   !radix_insert(tree, 0, (void*)0xdeadbeef, 0));
-
-       KT_ASSERT_M("It should be possible to insert first",
-                   !radix_insert(tree, 3, (void*)0xdeadbeef, 0));
-       radix_insert(tree, 4, (void*)0x04040404, 0);
-       KT_ASSERT((void*)0xdeadbeef == radix_lookup(tree, 3));
-       for (int i = 5; i < 100; i++)
-               if ((retval = radix_lookup(tree, i))) {
-                       printk("Extra item %p at slot %d in tree %p\n", retval, i,
-                              tree);
-                       print_radix_tree(tree);
-                       monitor(0);
-               }
-       KT_ASSERT_M("It should be possible to insert a two-tier",
-                   !radix_insert(tree, 65, (void*)0xcafebabe, 0));
-       KT_ASSERT_M("It should not be possible to reinsert",
-                   radix_insert(tree, 4, (void*)0x03030303, 0));
-       KT_ASSERT_M("It should be possible to insert a two-tier boundary",
-                   !radix_insert(tree, 4095, (void*)0x4095, 0));
-       KT_ASSERT_M("It should be possible to insert a three-tier",
-                   !radix_insert(tree, 4096, (void*)0x4096, 0));
-       //print_radix_tree(tree);
-       radix_delete(tree, 65);
-       radix_delete(tree, 3);
-       radix_delete(tree, 4);
-       radix_delete(tree, 4095);
-       radix_delete(tree, 4096);
-       //print_radix_tree(tree);
-
-       return true;
-}
-
-/* Assorted FS tests, which were hanging around in init.c */
-// TODO: remove all the print statements and try to convert most into assertions
-bool test_random_fs(void)
-{
-       int retval = do_symlink("/dir1/sym", "/bin/hello", S_IRWXU);
-       KT_ASSERT_M("symlink1 should be created successfully",
-                   (!retval));
-       retval = do_symlink("/symdir", "/dir1/dir1-1", S_IRWXU);
-       KT_ASSERT_M("symlink1 should be created successfully",
-                   (!retval));
-       retval = do_symlink("/dir1/test.txt", "/dir2/test2.txt", S_IRWXU);
-       KT_ASSERT_M("symlink2 should be created successfully",
-                   (!retval));
-       retval = do_symlink("/dir1/dir1-1/up", "../../", S_IRWXU);
-       KT_ASSERT_M("symlink3 should be created successfully",
-                   (!retval));
-       retval = do_symlink("/bin/hello-sym", "hello", S_IRWXU);
-       KT_ASSERT_M("symlink4 should be created successfully",
-                   (!retval));
-
-       struct dentry *dentry;
-       struct nameidata nd_r = {0}, *nd = &nd_r;
-       retval = path_lookup("/dir1/sym", 0, nd);
-       KT_ASSERT_M("symlink lookup should work for an existing symlink",
-                   (!retval));
-       char *symname = nd->dentry->d_inode->i_op->readlink(nd->dentry);
-       printk("Pathlookup got %s (sym)\n", nd->dentry->d_name.name);
-       if (!symname)
-               printk("symlink reading failed\n");
-       else
-               printk("Symname: %s (/bin/hello)\n", symname);
-       path_release(nd);
-       /* try with follow */
-       memset(nd, 0, sizeof(struct nameidata));
-       retval = path_lookup("/dir1/sym", LOOKUP_FOLLOW, nd);
-
-       KT_ASSERT_M("symlink lookup should work for an existing symlink",
-                   (!retval));
-       printk("Pathlookup got %s (hello)\n", nd->dentry->d_name.name);
-       path_release(nd);
-
-       /* try with a directory */
-       memset(nd, 0, sizeof(struct nameidata));
-       retval = path_lookup("/symdir/f1-1.txt", 0, nd);
-       KT_ASSERT_M("symlink lookup should work for an existing symlink",
-                   (!retval));
-       printk("Pathlookup got %s (f1-1.txt)\n", nd->dentry->d_name.name);
-       path_release(nd);
-
-       /* try with a rel path */
-       printk("Try with a rel path\n");
-       memset(nd, 0, sizeof(struct nameidata));
-       retval = path_lookup("/symdir/up/hello.txt", 0, nd);
-       KT_ASSERT_M("symlink lookup should work for an existing symlink",
-                   (!retval));
-       printk("Pathlookup got %s (hello.txt)\n", nd->dentry->d_name.name);
-       path_release(nd);
-
-       printk("Try for an ELOOP\n");
-       memset(nd, 0, sizeof(struct nameidata));
-       retval = path_lookup("/symdir/up/symdir/up/symdir/up/symdir/up/hello.txt", 0, nd);
-       KT_ASSERT_M("symlink lookup should fail for a non existing symlink",
-                   (retval));
-       path_release(nd);
-
-       return true;
-}
-
 /* Kernel message to restart our kthread */
 static void __test_up_sem(uint32_t srcid, long a0, long a1, long a2)
 {
@@ -2065,8 +1954,6 @@ static struct ktest ktests[] = {
        KTEST_REG(circular_buffer,    CONFIG_TEST_circular_buffer),
        KTEST_REG(bcq,                CONFIG_TEST_bcq),
        KTEST_REG(ucq,                CONFIG_TEST_ucq),
-       KTEST_REG(radix_tree,         CONFIG_TEST_radix_tree),
-       KTEST_REG(random_fs,          CONFIG_TEST_random_fs),
        KTEST_REG(kthreads,           CONFIG_TEST_kthreads),
        KTEST_REG(kref,               CONFIG_TEST_kref),
        KTEST_REG(atomics,            CONFIG_TEST_atomics),