summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/gen_kselftest_tar.sh
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2019-10-30 22:46:08 +0300
committerShuah Khan <skhan@linuxfoundation.org>2019-11-08 00:43:27 +0300
commitea1bf0bb18c0bd627d7b551196453ff2fff44225 (patch)
treed633df52c7247e2bbddc892fce717b6cfb3b992a /tools/testing/selftests/gen_kselftest_tar.sh
parent5b06eeae52c02dd0d9bc8488275a1207d410870b (diff)
downloadlinux-ea1bf0bb18c0bd627d7b551196453ff2fff44225.tar.xz
selftests: gen_kselftest_tar.sh: Do not clobber kselftest/
The default installation location for gen_kselftest_tar.sh was still "kselftest/" which collides with the existing directory. Instead, this moves the installation target into "kselftest_install/kselftest/" and adjusts the tar creation accordingly. This also adjusts indentation and logic to be consistent. Fixes: 42d46e57ec97 ("selftests: Extract single-test shell logic from lib.mk") Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/gen_kselftest_tar.sh')
-rwxr-xr-xtools/testing/selftests/gen_kselftest_tar.sh21
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/testing/selftests/gen_kselftest_tar.sh b/tools/testing/selftests/gen_kselftest_tar.sh
index a27e2eec3586..8b2b6088540d 100755
--- a/tools/testing/selftests/gen_kselftest_tar.sh
+++ b/tools/testing/selftests/gen_kselftest_tar.sh
@@ -38,16 +38,21 @@ main()
esac
fi
- install_dir=./kselftest
+ # Create working directory.
+ dest=`pwd`
+ install_work="$dest"/kselftest_install
+ install_name=kselftest
+ install_dir="$install_work"/"$install_name"
+ mkdir -p "$install_dir"
-# Run install using INSTALL_KSFT_PATH override to generate install
-# directory
-./kselftest_install.sh
-tar $copts kselftest${ext} $install_dir
-echo "Kselftest archive kselftest${ext} created!"
+ # Run install using INSTALL_KSFT_PATH override to generate install
+ # directory
+ ./kselftest_install.sh "$install_dir"
+ (cd "$install_work"; tar $copts "$dest"/kselftest${ext} $install_name)
+ echo "Kselftest archive kselftest${ext} created!"
-# clean up install directory
-rm -rf kselftest
+ # clean up top-level install work directory
+ rm -rf "$install_work"
}
main "$@"