blob: c05a8104c5ea652b7899e49c93e0000f697b1dfe [file] [log] [blame] [edit]
#!/bin/bash
# Copyright 2019 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.
#### CATEGORY=Run, inspect and debug
### run e2e tests
## Usage: fx run-e2e-tests
##
## Thin wrapper around `fx run-host-tests` which sets up the environment to run
## an end to end test against the current hardware target.
##
## Hint:
## Use fx --dir and/or fx -d flags to change the selected build directory or
## target device.
set -o errexit
set -o pipefail
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/vars.sh
fx-config-read
export FUCHSIA_DEVICE_ADDR="$(get-fuchsia-device-addr)"
if [[ -z "$FUCHSIA_DEVICE_ADDR" ]]; then
fx-error "Cannot determine IP address of Fuchsia target"
exit 1
fi
if [[ "$FUCHSIA_DEVICE_ADDR" == "::1" ]]; then
# Device addr is localhost, assume that means that ports were forwarded with
# fx serve-remote from a remote workstation/laptop with a device attached.
export SL4F_HTTP_PORT=9080
fi
# For legacy code.
export FUCHSIA_IPV4_ADDR="${FUCHSIA_DEVICE_ADDR}"
port="$(get-device-ssh-port)"
if [[ -n "${port}" ]]; then
export FUCHSIA_SSH_PORT="${port}"
fi
export FUCHSIA_SSH_KEY="$(get-ssh-privkey)" || exit $?
export FUCHSIA_TEST_OUTDIR="${FUCHSIA_OUT_DIR}/test_out/$(date +'%F-%H:%M:%S')"
mkdir -p "${FUCHSIA_TEST_OUTDIR}"
fx-command-run run-host-tests "$@"