github.com/nya3jp/tast@v0.0.0-20230601000426-85c8e4d83a9b/tools/run_tast.sh (about) 1 #!/bin/bash -e 2 3 # Copyright 2018 The ChromiumOS Authors 4 # Use of this source code is governed by a BSD-style license that can be 5 # found in the LICENSE file. 6 7 # Convenience script to make it easy for developers to directly run a tast 8 # executable from an autotest_server_package.tar.bz2 archive produced by a 9 # builder. This script is included in these archive files by cbuildbot. 10 11 if [[ $# -lt 2 || "$1" == '-h' || "$1" == '--help' ]]; then 12 cat - << EOF 13 Usage: $(basename "$0") [flag]... [target] [pattern]... 14 15 Run one or more Tast tests against a ChromeOS test device using 16 binaries from an autotest_server_package.tar.bz2 archive. 17 18 Additional flags for "tast run" may be supplied, most notably: 19 -keyfile=PATH passwordless private SSH key to use 20 -resultsdir=PATH directory where results will be written 21 22 Positional arguments: 23 target DUT as "host", "host:port", or "user@host:port" 24 pattern test pattern as a test name (e.g. "login.Chrome"), 25 wildcard (e.g. "power.*"), or parentheses-surrounded 26 test attribute expression (e.g. "(bvt && chrome)") 27 EOF 28 exit 1 29 fi 30 31 flags=() 32 33 # Try to find the testing SSH key. If -keyfile was passed as a positional 34 # argument, it will override the flag added here. 35 for dir in "${HOME}/chromeos" "${HOME}/chromiumos" "${HOME}/trunk"; do 36 keyfile="${dir}/chromite/ssh_keys/testing_rsa" 37 if [[ -e "${keyfile}" ]]; then 38 flags+=("-keyfile=${keyfile}") 39 break 40 fi 41 done 42 43 # Files are expected to be located at the same paths relative to this script 44 # that are used within the archive file. 45 basedir=$(dirname "$0") 46 exec "${basedir}/tast" -verbose run -build=false \ 47 -remotebundledir="${basedir}/bundles/remote" \ 48 -remotedatadir="${basedir}/data" \ 49 -remoterunner="${basedir}/remote_test_runner" \ 50 -defaultvarsdir="${basedir}/vars" \ 51 "${flags[@]}" "$@"