diff options
author | David Sterba <dsterba@suse.com> | 2016-11-23 10:39:05 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-24 13:06:36 +0100 |
commit | 15f2582e5440b4e67ec6e631a6915ec31b383f7f (patch) | |
tree | fb417cf3cd76da0106834738e015cfe9ab8fff6f | |
parent | e5362f5feb6b526ff3145bb0d7ce164e4d501edd (diff) |
btrfs-progs: test: extend library-test coverage
Add test for linkage error of lookup_path_rootid. The built binary has
to be run to catch also run-time errors.
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | library-test.c | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in index 3698d387..79dfcf5a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -446,10 +446,14 @@ test-ioctl: ioctl-test ioctl-test-32 ioctl-test-64 library-test: $(libs_shared) library-test.o @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o library-test library-test.o $(LDFLAGS) -lbtrfs + @echo " [TEST] $@" + $(Q)./$@ library-test.static: $(libs_static) library-test.o @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o library-test-static library-test.o $(LDFLAGS) $(libs_static) + @echo " [TEST] $@" + $(Q)./$@ test-build: test-build-pre test-build-real diff --git a/library-test.c b/library-test.c index 142188a7..9d14bbf9 100644 --- a/library-test.c +++ b/library-test.c @@ -19,6 +19,7 @@ #include "kerncompat.h" #include "version.h" #include "send-stream.h" +#include "btrfs-list.h" /* * Reduced code snippet from snapper.git/snapper/Btrfs.cc @@ -62,8 +63,15 @@ static int test_send_stream_api() { return ret; } +static int test_list_rootid() { + u64 treeid; + + return btrfs_list_get_path_rootid(-1, &treeid); +} + int main() { test_send_stream_api(); + test_list_rootid(); return 0; } |