]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests: Add version file to kselftest installation dir
authorTianyi Cui <1997cui@gmail.com>
Tue, 10 Jun 2025 22:12:07 +0000 (15:12 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 17 Jun 2025 20:22:18 +0000 (14:22 -0600)
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>
tools/testing/selftests/Makefile

index 339b31e6a6b592217eca1c03068f21728ea024b4..9dae84a74e7ff1894236f426682faae100a23070 100644 (file)
@@ -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