summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianyi Cui <1997cui@gmail.com>2025-06-10 15:12:07 -0700
committerShuah Khan <skhan@linuxfoundation.org>2025-06-17 14:22:18 -0600
commitcd9f02adca658f74cd7b28334ce163170bd3c19c (patch)
tree7a89f885eb5c4cae125e974e9f55212423e75d42
parent44c71c16f37d5c40418801e7868b62acdcc6b701 (diff)
selftests: Add version file to kselftest installation dir
As titled, adding version file to kselftest installation dir, so the user of the tarball can know which kernel version the tarball belongs to. Link: https://lore.kernel.org/r/20250610221248.819519-1-1997cui@gmail.com Signed-off-by: Tianyi Cui <1997cui@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-rw-r--r--tools/testing/selftests/Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 339b31e6a6b5..9dae84a74e7f 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -293,6 +293,13 @@ ifdef INSTALL_PATH
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
-C $$TARGET emit_tests >> $(TEST_LIST); \
done;
+ @VERSION=$$(git describe HEAD 2>/dev/null); \
+ if [ -n "$$VERSION" ]; then \
+ echo "$$VERSION" > $(INSTALL_PATH)/VERSION; \
+ printf "Version saved to $(INSTALL_PATH)/VERSION\n"; \
+ else \
+ printf "Unable to get version from git describe\n"; \
+ fi
else
$(error Error: set INSTALL_PATH to use install)
endif