linux-stable/tools/testing/selftests/kselftest_install.sh
Kees Cook ea1bf0bb18 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: 42d46e57ec ("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>
2019-11-07 14:43:27 -07:00

35 lines
823 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Kselftest Install
# Install kselftest tests
# Author: Shuah Khan <shuahkh@osg.samsung.com>
# Copyright (C) 2015 Samsung Electronics Co., Ltd.
main()
{
base_dir=`pwd`
install_dir="$base_dir"/kselftest_install
# Make sure we're in the selftests top-level directory.
if [ $(basename "$base_dir") != "selftests" ]; then
echo "$0: Please run it in selftests directory ..."
exit 1;
fi
# Only allow installation into an existing location.
if [ "$#" -eq 0 ]; then
echo "$0: Installing in default location - $install_dir ..."
elif [ ! -d "$1" ]; then
echo "$0: $1 doesn't exist!!"
exit 1;
else
install_dir="$1"
echo "$0: Installing in specified location - $install_dir ..."
fi
# Build tests
KSFT_INSTALL_PATH="$install_dir" make install
}
main "$@"