summaryrefslogtreecommitdiff
path: root/automated/linux/pointer-tagging/pointer-tagging-tests.sh
blob: 51c30b585ffb6935a3a8e6d039cdd5a9a3707cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

# shellcheck disable=SC1091
. ../../lib/sh-test-lib

OUTPUT="$(pwd)/output"
RESULT_FILE="${OUTPUT}/result.txt"
export RESULT_FILE

usage() {
    echo "Usage: $0 [-s <true>]" 1>&2
    exit 1
}

while getopts "s:" o; do
  case "$o" in
    s) SKIP_INSTALL="${OPTARG}" ;;
    *) usage ;;
  esac
done

pointer_tagging_build_test() {

    git clone https://git.linaro.org/qa/pointer-tagging-tests.git
    # shellcheck disable=SC2164
    cd pointer-tagging-tests
    make all
    # Run tests
    for tests in $(./pointer_tagging_tests -l) ; do
	./pointer_tagging_tests -t "${tests}"
	check_return "${tests}"
    done
}

# Test run.
! check_root && error_msg "This script must be run as root"
[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
mkdir -p "${OUTPUT}"

info_msg "About to run pointer-tagging-tests  test..."
info_msg "Output directory: ${OUTPUT}"

# Install packages
pkgs="binutils gcc git make"
install_deps "${pkgs}" "${SKIP_INSTALL}"

# Build pointer tagging tests and run tests
pointer_tagging_build_test