diff options
author | Serban Constantinescu <serban.constantinescu@linaro.org> | 2016-07-19 16:50:51 +0100 |
---|---|---|
committer | Serban Constantinescu <serban.constantinescu@linaro.org> | 2016-08-17 16:34:34 +0100 |
commit | 95538b86e2a7853a5a50a28a6c778ae2b6477f8b (patch) | |
tree | 0ece9fd14943dfc95aa507861061e9b548ec28b0 | |
parent | 831b6e91834adcd48fa1d3aa9442c050f9e9e851 (diff) | |
download | art-build-scripts-95538b86e2a7853a5a50a28a6c778ae2b6477f8b.tar.gz |
Add art testing presubmit tests
Change-Id: I39611fb22f9d61b0e15d3c2ba8e003bdc038296a
-rwxr-xr-x | jenkins/presubmit_art_testing.sh | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/jenkins/presubmit_art_testing.sh b/jenkins/presubmit_art_testing.sh new file mode 100755 index 00000000..11dce671 --- /dev/null +++ b/jenkins/presubmit_art_testing.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# ART Testing Presubmit Test. +# +# Jenkins link: +# https://ci.linaro.org/job/linaro-art-tip-microbenchmarks-presubmit-test/ + +readonly local_path=$(dirname "$0") +source "${local_path}/../utils/utils.sh" +source "${local_path}/../utils/utils_android.sh" + +readonly timer_name="ART Testing Test" +readonly test_time_file="$(get_workspace)/time_test.txt" +readonly git_repo="http://android-review.linaro.org/linaro/art-testing" +readonly git_co_dir="art-testing" + +usage() { + log I "$0" + log I "This script is used to run the ART Testing Jenkins Presubmit test." + log I "It will clone and run the ART Testing tests." + log I "It does not require an Android environment, as it will only clone and run" + log I "from a Git repository." + log I " -h - help" + log I " -v - verbose" +} + +update_git_repo() { + branch=${3:-master} + + if [[ -d $2 ]]; then + safe pushd "$2" >/dev/null + safe git fetch origin + safe git clean -fdx + safe git reset --hard origin/master + safe popd >/dev/null + else + safe git clone -b "${branch}" "$1" "$2" + fi +} + +arguments_parser() { + while getopts ":vh" opt; do + case ${opt} in + v) + enable_verbose + ;; + h) + usage + exit 0 + ;; + \?) + log E "Invalid option: ${OPTARG}" + abort + ;; + esac + done +} + + +main() { + arguments_parser "$@" + + if [[ ! -v GERRIT_HOST || ! -v GERRIT_PROJECT || ! -v GERRIT_BRANCH ]]; then + log E "Need to be triggered by Gerrit." + exit 1 + fi + readonly gerrit_url="http://${GERRIT_HOST}/${GERRIT_PROJECT}" + + start_timer "${timer_name}" + + safe mkdir -p "${HOME}/srv/${JOB_NAME}" + safe cd "${HOME}/srv/${JOB_NAME}" + + update_git_repo "${git_repo}" "${git_co_dir}" "${GERRIT_BRANCH}" + safe cd "${git_co_dir}" + fetch_apply_gerrit_refspec "${gerrit_url}" "${GERRIT_REFSPEC}" + ./test/test.py + local -r ret=$? + + stop_timer "${timer_name}" + log S "Test Finished!" + dump_timer "${timer_name}" "${test_time_file}" + exit ${ret} +} + +main "$@" |