]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - tools/testing/selftests/lib.mk
Merge remote-tracking branches 'asoc/topic/wm8904', 'asoc/topic/wm8955' and 'asoc...
[mirror_ubuntu-zesty-kernel.git] / tools / testing / selftests / lib.mk
CommitLineData
84f887bf
ME
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.
3CC := $(CROSS_COMPILE)gcc
4
5e29a910
ME
5define RUN_TESTS
6 @for TEST in $(TEST_PROGS); do \
7 (./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
8 done;
9endef
10
11run_tests: all
12 $(RUN_TESTS)
13
32dcfba6 14define INSTALL_RULE
900d65ee
BJZ
15 @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
16 mkdir -p ${INSTALL_PATH}; \
17 echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \
18 rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \
a7d0f078 19 fi
32dcfba6
ME
20endef
21
22install: all
23ifdef INSTALL_PATH
24 $(INSTALL_RULE)
25else
26 $(error Error: set INSTALL_PATH to use install)
27endif
28
29define EMIT_TESTS
30 @for TEST in $(TEST_PROGS); do \
31 echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
32 done;
33endef
34
35emit_tests:
36 $(EMIT_TESTS)
37
38.PHONY: run_tests all clean install emit_tests