| #!/bin/bash |
| # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| ### build, copy to and run a test on target |
| |
| ## usage: fx run-test TARGET [ARGS ...] |
| ## Builds the specified target (e.g., fxl_unittests), copies it to the |
| ## target, and executes it. Useful for tight iterations on unittests. |
| |
| set -e |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh |
| fx-config-read |
| |
| function usage { |
| fx-command-help run-test |
| } |
| |
| function main { |
| if [[ $# -eq 0 ]]; then |
| usage |
| return 1 |
| fi |
| |
| target="$1" |
| fx-command-run build "${target}" |
| fx-command-run cp "${FUCHSIA_BUILD_DIR}/${target}" "/tmp/${target}" |
| shift |
| fx-command-run shell "/tmp/${target}" "$@" |
| } |
| |
| main "$@" |