Add a new make target to enable installing test. This target
installs test in the kselftest install location and add to the
kselftest script to run the test. Install target can be run
only from top level source dir.

Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
---
 tools/testing/selftests/memfd/Makefile | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile 
b/tools/testing/selftests/memfd/Makefile
index b80cd10..a9e06cc 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -2,19 +2,33 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 
+INSTALL_PROGS = memfd_test fuse_test run_fuse_test.sh
+MEMFD_TEST_STR = ./memfd_test || echo memfd_test: [FAIL]
+FUSE_TEST_STR = ./run_fuse_test.sh || echo fuse_test: [FAIL]
+
 all:
        gcc $(CFLAGS) memfd_test.c -o memfd_test
 
+install:
+ifdef INSTALL_KSFT_PATH
+       install $(INSTALL_PROGS) $(INSTALL_KSFT_PATH)
+       @echo echo Start memfd test .... >> $(KSELFTEST)
+       @echo "$(MEMFD_TEST_STR)" >> $(KSELFTEST)
+       @echo echo End memfd test .... >> $(KSELFTEST)
+       @echo echo ============================== >> $(KSELFTEST)
+else
+       @echo Run make kselftest_install in top level source directory
+endif
+
 run_tests: all
-       gcc $(CFLAGS) memfd_test.c -o memfd_test
-       @./memfd_test || echo "memfd_test: [FAIL]"
+       @$(MEMFD_TEST_STR)
 
 build_fuse:
        gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt
        gcc $(CFLAGS) fuse_test.c -o fuse_test
 
 run_fuse: build_fuse
-       @./run_fuse_test.sh || echo "fuse_test: [FAIL]"
+       @$(FUSE_TEST_STR)
 
 clean:
        $(RM) memfd_test fuse_test
-- 
1.9.1

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

Reply via email to