| #!/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 | |
| set -e | |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh | |
| fx-config-read | |
| function usage { | |
| cat <<END | |
| 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. | |
| END | |
| } | |
| if [[ $# -eq 0 ]]; then | |
| usage | |
| exit 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}" "$@" |