]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - tools/testing/selftests/lib.mk
scsi_dh: don't try to load a device handler during async probing
[karo-tx-linux.git] / tools / testing / selftests / lib.mk
1 # This mimics the top-level Makefile. We do it explicitly here so that this
2 # Makefile can operate with or without the kbuild infrastructure.
3 CC := $(CROSS_COMPILE)gcc
4
5 define RUN_TESTS
6         @for TEST in $(TEST_PROGS); do \
7                 (./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
8         done;
9 endef
10
11 run_tests: all
12         $(RUN_TESTS)
13
14 define INSTALL_RULE
15         @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then                        \
16                 mkdir -p $(INSTALL_PATH);                                                               \
17                 for TEST_DIR in $(TEST_DIRS); do                                                        \
18                         cp -r $$TEST_DIR $(INSTALL_PATH);                                               \
19                 done;                                                                                   \
20                 echo "install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)";   \
21                 install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES);          \
22         fi
23 endef
24
25 install: all
26 ifdef INSTALL_PATH
27         $(INSTALL_RULE)
28 else
29         $(error Error: set INSTALL_PATH to use install)
30 endif
31
32 define EMIT_TESTS
33         @for TEST in $(TEST_PROGS); do \
34                 echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
35         done;
36 endef
37
38 emit_tests:
39         $(EMIT_TESTS)
40
41 .PHONY: run_tests all clean install emit_tests