blob: e7dd4c5652c62a1d3320bd0c783677dbca60850a [file] [log] [blame]
#!/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]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
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 "$@"