When EXEC parameter is set, do not build this tool.
run the test tool with a given path.(/usr/bin, /usr/local/bin)

Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com>
---
 Makefile        | 32 +++++++++++++++++++++++++++++++-
 tests/README.md | 10 ++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 30a0ee22..8ca5e63f 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@
 #   EXTRA_LDFLAGS  additional linker flags
 #
 # Testing-specific options (see also tests/README.md):
+#   EXEC=path      run test(s) use exec file in given path
 #   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
@@ -295,11 +296,38 @@ $(BUILDDIRS):
        @echo "Making all in $(patsubst build-%,%,$@)"
        $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst build-%,%,$@)
 
+ifneq ("$(EXEC)","")
+test-convert:
+       @echo "    [TEST]   convert-tests.sh"
+       $(Q)bash tests/convert-tests.sh
+
+# btrfs-corrupt-block is a internal tool of btrfs-progs.
+test-fsck: btrfs-corrupt-block
+       @echo "    [TEST]   fsck-tests.sh"
+       $(Q)bash tests/fsck-tests.sh
+
+# btrfs-corrupt-block is a internal tool of btrfs-progs.
+# fssum is a internal tool for tests.
+test-misc: btrfs-corrupt-block fssum
+       @echo "    [TEST]   misc-tests.sh"
+       $(Q)bash tests/misc-tests.sh
+
+test-mkfs:
+       @echo "    [TEST]   mkfs-tests.sh"
+       $(Q)bash tests/mkfs-tests.sh
+
+test-fuzz:
+       @echo "    [TEST]   fuzz-tests.sh"
+       $(Q)bash tests/fuzz-tests.sh
+
+test-cli:
+       @echo "    [TEST]   cli-tests.sh"
+       $(Q)bash tests/cli-tests.sh
+else
 test-convert: btrfs btrfs-convert
        @echo "    [TEST]   convert-tests.sh"
        $(Q)bash tests/convert-tests.sh
 
-test-check: test-fsck
 test-fsck: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune
        @echo "    [TEST]   fsck-tests.sh"
        $(Q)bash tests/fsck-tests.sh
@@ -320,7 +348,9 @@ test-fuzz: btrfs
 test-cli: btrfs
        @echo "    [TEST]   cli-tests.sh"
        $(Q)bash tests/cli-tests.sh
+endif
 
+test-check: test-fsck
 test-clean:
        @echo "Cleaning tests"
        $(Q)bash tests/clean-tests.sh
diff --git a/tests/README.md b/tests/README.md
index 04d2ce2a..35383346 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -28,6 +28,16 @@ $ ./misc-tests.sh
 The verbose output of the tests is logged into a file named after the test
 category, eg. `fsck-tests-results.txt`.
 
+## Specify binary
+
+Use binary in the given path to run test.
+
+```shell
+$ make EXEC=/usr/bin/ test
+```
+
+will run tests use binary in /usr/bin.
+
 ## Selective testing
 
 The tests are prefixed by a number for ordering and uniqueness. To run a
-- 
2.13.6



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to