| #!/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=Test |
| ### Entry point for all Fuchsia tests (host, target, and end-to-end) |
| |
| ## Usage: fx test [testName ...] |
| ## |
| ## This is an incomplete list of options. Run 'fx test --help' for the complete set of options. |
| ## Options: |
| ## -h, --help |
| ## --test-filter Runs specific test cases in v2 suite. Can be specified multiple |
| ## times to pass in multiple patterns. |
| ## example: --test-filter glob1 --test-filter glob2 |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $? |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/dart_utils.sh || exit $? |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/host_symbolizer.sh || exit $? |
| fx-config-read |
| |
| # Set an envrionment variable so that child processes can know they were invoked (directly or |
| # indirectly) by fx test. For example, build metrics need this information. |
| export FUCHSIA_FX_TEST_RUN=1 |
| |
| # These pre-parsed properties of the command line can be used to skip expensive operations. |
| info_only=false |
| has_e2e=false |
| host_tests_only=false |
| for arg in "$@"; do |
| if [[ "$arg" == "--help" || "$arg" == "-h" || "$arg" == "--info" || "$arg" == "--dry" ]]; then |
| info_only=true |
| elif [[ "$arg" == "--e2e" || "$arg" == "--only-e2e" ]]; then |
| has_e2e=true |
| elif [[ "$arg" == "--host" ]]; then |
| host_tests_only=true |
| fi |
| |
| if [[ "$arg" == "--" ]]; then |
| break |
| fi |
| done |
| |
| args=() |
| |
| fx-command-run host-tool --print symbolizer > /dev/null |
| if [[ ! $host_tests_only ]]; then |
| fx-command-run host-tool --print ffx > /dev/null |
| fi |
| fx-command-run host-tool test "${args[@]}" "$@" |