aboutsummaryrefslogtreecommitdiff
path: root/tests/test_art_vixl.sh
blob: addbf42689b8227e1d0a58f2f4dc7db3db9aa53d (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
#
# Copyright (c) 2016-2017, Linaro Ltd.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# VIXL tests.
#
# Jenkins link:
# https://android-build.linaro.org/jenkins/job/linaro-art-tip-build-ARTVixlTest

readonly local_path=$(dirname "$0")
source "${local_path}/../utils/utils.sh"
source "${local_path}/../utils/utils_android.sh"
source "${local_path}/../utils/utils_android_root.sh"

readonly vixl_timer_name="VIXL Test"
readonly test_time_file="$(get_workspace)/time_test.txt"

# shellcheck disable=SC2034
declare -A options_format=(
  ["help"]="p:usage()"
  ["h"]="r:&help"
  ["verbose"]="p:enable_verbose()"
  ["v"]="r:&verbose"
)
# shellcheck disable=SC2034
declare -A options=()

usage() {
  log I "$0"
  log I "This script is used to run the VIXL Jenkins test."
  log I "By default the lunch target is inferred from the environment as"
  log I "\${TARGET_PRODUCT}-\${TARGET_BUILD_VARIANT} (as set up by the \`lunch\`"
  log I "command). If those are not defined, the default lunch target is used"
  log I "instead. (current environment's default: $(lunch_target_from_env))"
  log I " -h - help"
  log I " -v - verbose"
  exit 0
}

test_vixl_selftests() {
  log I "Running VIXL standalone tests."

  if ! (exists scons && exists cpplint.py); then
    log E "Missing dependencies! Please take a look at VIXL's README.md."
    abort
  fi

  safe cd external/vixl

  # For upstream vixl we need to move Android.mk and Android.bp to the top level.
  if [[ ! -f Android.mk ]]; then
    safe cp third_party/android/Android.* .
  fi

  # Remove VIXL's output folder. This is a workaround a known scons issue.
  # Scons issue: http://scons.tigris.org/issues/show_bug.cgi?id=2462
  safe rm -fr obj

  # TODO: Reenable clang format and tidy when dependency on exact version
  # is removed from upstream VIXL.
  safe ./tools/test.py  --noclang-format --noclang-tidy
  safe cd -
}

test_art_integration() {
  log I "Building VIXL and ART."

  safe cd external/vixl
  mma_build
  safe cd -

  safe_make_build "build-art"
}

test_art_host_vixl() {
  log I "Running test-art-host-vixl tests."

  mma_build "test-art-host-vixl"
}

# Regression tests. Added to catch issues such as those with: external/vixl 0c90fd69 .
test_vixl_android_path() {
  log I "Running run-vixl-tests from external/vixl"

  safe cd external/vixl
  mma_build "run-vixl-tests"
  safe cd -
}

main() {
  exit_on_failure arguments_parser options_format options -- "$@"
  start_timer "${vixl_timer_name}"

  # The VIXL self-tests do not need to be run within an Android environment. But
  # we set up the environment now so that, if needed, we ask early for user
  # confirmation to use the default lunch target.
  source_android_environment_default

  set_environment_host

  setup_android_target_to_environment_or_default

  test_vixl_selftests
  test_art_integration
  test_art_host_vixl
  test_vixl_android_path

  stop_timer "${vixl_timer_name}"
  log S "Test Finished!"
  dump_timer "${vixl_timer_name}" "${test_time_file}"
}

main "$@"