Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tianyi Cui and committed by
Shuah Khan
cd9f02ad 44c71c16

+7
+7
tools/testing/selftests/Makefile
··· 293 293 $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \ 294 294 -C $$TARGET emit_tests >> $(TEST_LIST); \ 295 295 done; 296 + @VERSION=$$(git describe HEAD 2>/dev/null); \ 297 + if [ -n "$$VERSION" ]; then \ 298 + echo "$$VERSION" > $(INSTALL_PATH)/VERSION; \ 299 + printf "Version saved to $(INSTALL_PATH)/VERSION\n"; \ 300 + else \ 301 + printf "Unable to get version from git describe\n"; \ 302 + fi 296 303 else 297 304 $(error Error: set INSTALL_PATH to use install) 298 305 endif