mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
eCTS: Add script to run tests and publish results
This script will run nightly in the lab and publish the results. Publishing results will be implemented later. BUG=chromium:735546 BRANCH=none TEST=Run run_ects.sh inside & outside chroot and verify all tests pass. Change-Id: I405ea601eff33f1a4328f2606c8bb4050ff8d253 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/543681
This commit is contained in:
committed by
chrome-bot
parent
52fa37a801
commit
9069d0ff28
118
util/run_ects.sh
Executable file
118
util/run_ects.sh
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2017 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
#
|
||||
# Run all eCTS tests and publish results
|
||||
|
||||
set -e
|
||||
|
||||
NOC='\033[0m'
|
||||
RED='\033[0;31m'
|
||||
GRN='\033[0;32m'
|
||||
|
||||
# List of tests to run.
|
||||
TESTS=(meta interrupt gpio task timer)
|
||||
|
||||
usage() {
|
||||
cat <<END
|
||||
|
||||
${SCRIPT_NAME} - Run all eCTS tests and publish results.
|
||||
Usage: ${SCRIPT_NAME} [options]
|
||||
Options:
|
||||
-d: Dry run tests.
|
||||
-h: Print this message.
|
||||
-s: Sync tree before running tests.
|
||||
-u: Upload results.
|
||||
-v: Enable verbose output.
|
||||
|
||||
END
|
||||
}
|
||||
|
||||
error() {
|
||||
printf "%b[%s] %s%b\n" "${RED}" "${SCRIPT_NAME}" "$*" "${NOC}" 1>&2
|
||||
}
|
||||
|
||||
info() {
|
||||
printf "%b[%s] %s%b\n" "${GRN}" "${SCRIPT_NAME}" "$*" "${NOC}"
|
||||
}
|
||||
|
||||
get_script_name() {
|
||||
local name=$(basename "$1")
|
||||
printf "${name%.*}"
|
||||
}
|
||||
|
||||
get_ec_dir() {
|
||||
readlink -f "$(dirname $1)/.."
|
||||
}
|
||||
|
||||
get_cros_sdk() {
|
||||
if [[ -e "/etc/cros_chroot_version" ]]; then
|
||||
printf ""
|
||||
else
|
||||
printf "cros_sdk --"
|
||||
fi
|
||||
}
|
||||
|
||||
sync_src() {
|
||||
info "Syncing tree..."
|
||||
if ! repo sync .; then
|
||||
error "Failed to sync source"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_test() {
|
||||
${CROS_SDK} ${DRY_RUN} "/mnt/host/source/src/platform/ec/cts/cts.py" -m "$1"
|
||||
}
|
||||
|
||||
run() {
|
||||
local t
|
||||
for t in "${TESTS[@]}"; do
|
||||
info "Running ${t} test"
|
||||
run_test "${t}"
|
||||
done
|
||||
}
|
||||
|
||||
upload_results() {
|
||||
info "Uploading results... (Not implemented)"
|
||||
}
|
||||
|
||||
main() {
|
||||
local do_sync
|
||||
local do_upload
|
||||
|
||||
SCRIPT_NAME=$(get_script_name "$0")
|
||||
CROS_SDK=$(get_cros_sdk)
|
||||
EC_DIR=$(get_ec_dir "$0")
|
||||
DRY_RUN=""
|
||||
VERBOSITY=""
|
||||
|
||||
# Need to cd to SDK directory to run tools (cros_sdk, repo sync).
|
||||
cd "${EC_DIR}"
|
||||
|
||||
while getopts ":dhsuv" opt; do
|
||||
case "${opt}" in
|
||||
d) DRY_RUN="echo" ;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
s) do_sync="y" ;;
|
||||
u) do_upload="y" ;;
|
||||
v) VERBOSITY="y" ;;
|
||||
\?)
|
||||
error "invalid option: -${OPTARG}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
[[ "${do_sync}" == "y" ]] && sync_src
|
||||
run
|
||||
[[ "${do_upload}" == "y" ]] && upload_results
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user