diff options
author | bamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com> | 2016-11-29 19:55:52 +0800 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-01-05 13:42:22 -0700 |
commit | a8ba798bc8ec663cf02e80b0dd770324de9bafd9 (patch) | |
tree | e654822d4a82b46dc087febceb4d79999fd51488 /tools/testing/selftests/lib.mk | |
parent | 80d443e8876602be2c130f79c4de81e12e2a700d (diff) | |
download | lwn-a8ba798bc8ec663cf02e80b0dd770324de9bafd9.tar.gz lwn-a8ba798bc8ec663cf02e80b0dd770324de9bafd9.zip |
selftests: enable O and KBUILD_OUTPUT
Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest
to another directory by passing O or KBUILD_OUTPUT. And O is high
priority than KBUILD_OUTPUT.
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests/lib.mk')
-rw-r--r-- | tools/testing/selftests/lib.mk | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 0f7a371beff7..01bb7782a35e 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -4,7 +4,8 @@ CC := $(CROSS_COMPILE)gcc define RUN_TESTS @for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \ - (./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \ + BASENAME_TEST=`basename $$TEST`; \ + cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\ done; endef @@ -33,19 +34,29 @@ endif define EMIT_TESTS @for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \ - echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \ + BASENAME_TEST=`basename $$TEST`; \ + echo "(./$$BASENAME_TEST && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \ done; endef emit_tests: $(EMIT_TESTS) +TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) +TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) + all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) clean: $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN) -%: %.c - $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^ +$(OUTPUT)/%:%.c + $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $< -o $@ + +$(OUTPUT)/%.o:%.S + $(CC) $(ASFLAGS) -c $< -o $@ + +$(OUTPUT)/%:%.S + $(CC) $(ASFLAGS) $< -o $@ .PHONY: run_tests all clean install emit_tests |