#!/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 "$@"