^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #!/bin/bash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # Kselftest Install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) # Install kselftest tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # Author: Shuah Khan <shuahkh@osg.samsung.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # Copyright (C) 2015 Samsung Electronics Co., Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) main()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) base_dir=`pwd`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) install_dir="$base_dir"/kselftest_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # Make sure we're in the selftests top-level directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) if [ $(basename "$base_dir") != "selftests" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) echo "$0: Please run it in selftests directory ..."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) exit 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # Only allow installation into an existing location.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) if [ "$#" -eq 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) echo "$0: Installing in default location - $install_dir ..."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) elif [ ! -d "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) echo "$0: $1 doesn't exist!!"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) exit 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) install_dir="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) echo "$0: Installing in specified location - $install_dir ..."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) # Build tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) KSFT_INSTALL_PATH="$install_dir" make install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) main "$@"