Btrfs: separate out tests into their own directory
The plan is to have a bunch of unit tests that run when btrfs is loaded when you build with the appropriate config option. My ultimate goal is to have a test for every non-static function we have, but at first I'm going to focus on the things that cause us the most problems. To start out with this just adds a tests/ directory and moves the existing free space cache tests into that directory and sets up all of the infrastructure. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
#include "rcu-string.h"
|
||||
#include "dev-replace.h"
|
||||
#include "free-space-cache.h"
|
||||
#include "tests/btrfs-tests.h"
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/btrfs.h>
|
||||
@@ -1762,6 +1763,11 @@ static void btrfs_print_info(void)
|
||||
"\n");
|
||||
}
|
||||
|
||||
static int btrfs_run_sanity_tests(void)
|
||||
{
|
||||
return btrfs_test_free_space_cache();
|
||||
}
|
||||
|
||||
static int __init init_btrfs_fs(void)
|
||||
{
|
||||
int err;
|
||||
@@ -1804,14 +1810,17 @@ static int __init init_btrfs_fs(void)
|
||||
if (err)
|
||||
goto free_delayed_ref;
|
||||
|
||||
err = register_filesystem(&btrfs_fs_type);
|
||||
if (err)
|
||||
goto unregister_ioctl;
|
||||
|
||||
btrfs_init_lockdep();
|
||||
|
||||
btrfs_print_info();
|
||||
btrfs_test_free_space_cache();
|
||||
|
||||
err = btrfs_run_sanity_tests();
|
||||
if (err)
|
||||
goto unregister_ioctl;
|
||||
|
||||
err = register_filesystem(&btrfs_fs_type);
|
||||
if (err)
|
||||
goto unregister_ioctl;
|
||||
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user