btrfs-progs: check: introduce function to check dir_item
[platform/upstream/btrfs-progs.git] / Makefile.in
index 5187a93..5c4a995 100644 (file)
 #   EXTRA_CFLAGS   additional compiler flags
 #   EXTRA_LDFLAGS  additional linker flags
 #
+# Testing-specific options (see also tests/README.md):
+#   TEST=GLOB      run test(s) from directories matching GLOB
+#   TEST_LOG=tty   print name of a command run via the execution helpers
+#   TEST_LOG=dump  dump testing log file when a test fails
+#
 # Static checkers:
 #   CHECKER        static checker binary to be called (default: sparse)
 #   CHECKER_FLAGS  flags to pass to CHECKER, can override CFLAGS
@@ -68,7 +73,7 @@ CFLAGS = @CFLAGS@ \
         $(EXTRA_CFLAGS)
 
 LDFLAGS = @LDFLAGS@ \
-         -rdynamic $(EXTRA_LDFLAGS)
+         -rdynamic -L$(TOPDIR) $(EXTRA_LDFLAGS)
 
 LIBS = @UUID_LIBS@ @BLKID_LIBS@ @ZLIB_LIBS@ @LZO2_LIBS@ -L. -pthread
 LIBBTRFS_LIBS = $(LIBS)
@@ -91,7 +96,7 @@ CHECKER_FLAGS := -include $(check_defs) -D__CHECKER__ \
 objects = ctree.o disk-io.o kernel-lib/radix-tree.o extent-tree.o print-tree.o \
          root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
          extent-cache.o extent_io.o volumes.o utils.o repair.o \
-         qgroup.o raid6.o free-space-cache.o kernel-lib/list_sort.o props.o \
+         qgroup.o raid56.o free-space-cache.o kernel-lib/list_sort.o props.o \
          ulist.o qgroup-verify.o backref.o string-table.o task-utils.o \
          inode.o file.o find-root.o free-space-tree.o help.o
 cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
@@ -169,15 +174,16 @@ endif
 MAKEOPTS = --no-print-directory Q=$(Q)
 
 # build all by default
-progs = $(progs_install) btrfsck btrfs-corrupt-block btrfs-calc-size
+progs = $(progs_install) btrfsck btrfs-corrupt-block
 
 # install only selected
 progs_install = btrfs mkfs.btrfs btrfs-debug-tree \
        btrfs-map-logical btrfs-image btrfs-zero-log \
-       btrfs-find-root btrfstune btrfs-show-super \
+       btrfs-find-root btrfstune \
        btrfs-select-super
 
-progs_extra = btrfs-fragments
+# other tools, not built by default
+progs_extra = btrfs-fragments btrfs-calc-size btrfs-show-super
 
 progs_static = $(foreach p,$(progs),$(p).static)
 
@@ -298,7 +304,7 @@ test-inst: all
                $(MAKE) DESTDIR=$$tmpdest install && \
                $(RM) -rf -- $$tmpdest
 
-test: test-fsck test-mkfs test-convert test-misc test-fuzz
+test: test-fsck test-mkfs test-convert test-misc test-fuzz test-cli
 
 #
 # NOTE: For static compiles, you need to have all the required libs
@@ -384,6 +390,15 @@ btrfstune.static: $(static_objects) btrfstune.static.o $(static_libbtrfs_objects
        $(Q)$(CC) $(STATIC_CFLAGS) -o $@ btrfstune.static.o $(static_objects) \
                $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
 
+btrfs-image: $(objects) $(libs_static) image/main.o
+       @echo "    [LD]     $@"
+       $(Q)$(CC) $(CFLAGS) -I$(TOPDIR)/image -o btrfs-image $(objects) image/main.o $(libs_static) $(LDFLAGS) $(LIBS)
+
+btrfs-image.static: $(static_objects) image/main.static.o $(static_libbtrfs_objects)
+       @echo "    [LD]     $@"
+       $(Q)$(CC) $(STATIC_CFLAGS) -o $@ image/main.static.o $(static_objects) \
+               $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
+
 dir-test: $(objects) $(libs) dir-test.o
        @echo "    [LD]     $@"
        $(Q)$(CC) $(CFLAGS) -o dir-test $(objects) $(libs) dir-test.o $(LDFLAGS) $(LIBS)
@@ -428,17 +443,17 @@ test-ioctl: ioctl-test ioctl-test-32 ioctl-test-64
        $(Q)./ioctl-test-32 > ioctl-test-32.log
        $(Q)./ioctl-test-64 > ioctl-test-64.log
 
-send-test: $(objects) $(libs) send-test.o
-       @echo "    [LD]     $@"
-       $(Q)$(CC) $(CFLAGS) -o send-test $(objects) $(libs) send-test.o $(LDFLAGS) $(LIBS)
-
 library-test: $(libs_shared) library-test.o
        @echo "    [LD]     $@"
-       $(Q)$(CC) $(CFLAGS) -o library-test library-test.o $(LDFLAGS) -lbtrfs
+       $(Q)$(CC) $(CFLAGS) -o library-test library-test.o $(LDFLAGS) -Wl,-rpath=$(TOPDIR) -lbtrfs
+       @echo "    [TEST]   $@"
+       $(Q)./$@
 
-library-test.static: $(libs_static) library-test.o
+library-test.static: $(libs_static) library-test.static.o
        @echo "    [LD]     $@"
-       $(Q)$(CC) $(CFLAGS) -o library-test-static library-test.o $(LDFLAGS) $(libs_static)
+       $(Q)$(CC) $(STATIC_CFLAGS) -o library-test.static library-test.static.o $(STATIC_LDFLAGS) $(libs_static) $(STATIC_LIBS)
+       @echo "    [TEST]   $@"
+       $(Q)./$@
 
 test-build: test-build-pre test-build-real
 
@@ -464,7 +479,8 @@ clean: $(CLEANDIRS)
        @echo "Cleaning"
        $(Q)$(RM) -f -- $(progs) cscope.out *.o *.o.d \
                kernel-lib/*.o kernel-lib/*.o.d \
-             dir-test ioctl-test quick-test send-test library-test library-test-static \
+               image/*.o image/*.o.d \
+             dir-test ioctl-test quick-test library-test library-test-static \
              btrfs.static mkfs.btrfs.static \
              $(check_defs) \
              $(libs) $(lib_links) \