diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-08-14 15:05:12 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:15:38 -0400 |
commit | dc11dd5d707a4157882f281c96055d6894d10c8c (patch) | |
tree | 57cebbc3b1746c4184d31e09ff452a34842f2340 /fs/btrfs/super.c | |
parent | 00361589d2eebd90fca022148c763e40d3e90871 (diff) |
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>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 196790375bb3..1bd0bb523660 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "rcu-string.h" | 56 | #include "rcu-string.h" |
57 | #include "dev-replace.h" | 57 | #include "dev-replace.h" |
58 | #include "free-space-cache.h" | 58 | #include "free-space-cache.h" |
59 | #include "tests/btrfs-tests.h" | ||
59 | 60 | ||
60 | #define CREATE_TRACE_POINTS | 61 | #define CREATE_TRACE_POINTS |
61 | #include <trace/events/btrfs.h> | 62 | #include <trace/events/btrfs.h> |
@@ -1762,6 +1763,11 @@ static void btrfs_print_info(void) | |||
1762 | "\n"); | 1763 | "\n"); |
1763 | } | 1764 | } |
1764 | 1765 | ||
1766 | static int btrfs_run_sanity_tests(void) | ||
1767 | { | ||
1768 | return btrfs_test_free_space_cache(); | ||
1769 | } | ||
1770 | |||
1765 | static int __init init_btrfs_fs(void) | 1771 | static int __init init_btrfs_fs(void) |
1766 | { | 1772 | { |
1767 | int err; | 1773 | int err; |
@@ -1804,14 +1810,17 @@ static int __init init_btrfs_fs(void) | |||
1804 | if (err) | 1810 | if (err) |
1805 | goto free_delayed_ref; | 1811 | goto free_delayed_ref; |
1806 | 1812 | ||
1807 | err = register_filesystem(&btrfs_fs_type); | ||
1808 | if (err) | ||
1809 | goto unregister_ioctl; | ||
1810 | |||
1811 | btrfs_init_lockdep(); | 1813 | btrfs_init_lockdep(); |
1812 | 1814 | ||
1813 | btrfs_print_info(); | 1815 | btrfs_print_info(); |
1814 | btrfs_test_free_space_cache(); | 1816 | |
1817 | err = btrfs_run_sanity_tests(); | ||
1818 | if (err) | ||
1819 | goto unregister_ioctl; | ||
1820 | |||
1821 | err = register_filesystem(&btrfs_fs_type); | ||
1822 | if (err) | ||
1823 | goto unregister_ioctl; | ||
1815 | 1824 | ||
1816 | return 0; | 1825 | return 0; |
1817 | 1826 | ||