blob: 75c6c7261fdf8ab3af4455fc845d8e6bcfa1bad6 [file] [log] [blame]
#!/bin/bash
#
# Copyright 2022 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.
#
# Runs local tests for scripts/bootstrap.sh. Not runnable on CQ.
#
# Usage:
# $FUCHSIA_EMBEDDER_DIR/scripts/tests/bootstrap_test.sh
set -e # Fail on any error.
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/helpers.sh || exit $?
pushd $FUCHSIA_EMBEDDER_DIR
echo-info 'Testing build_and_run_example.sh with no arguments ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh
echo-info 'Testing build_and_run_example.sh --cpu arm64 ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh --cpu arm64
if [[ -d "${embedder_engine_dir}" ]]
then
echo-info 'Testing build_and_run_example.sh --with-engine ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh --with-engine
echo-info 'Testing build_and_run_example.sh --with-engine --goma ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh --with-engine --goma
echo-info 'Testing build_and_run_example.sh --with-engine --goma --no-prebuilt-dart-sdk ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh --with-engine --goma --no-prebuilt-dart-sdk
echo-info 'Testing build_and_run_example.sh --with-engine --goma --cpu arm64 ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh --with-engine --goma --cpu arm64
else
echo-warning "Skipping --with-engine tests because ${embedder_engine_dir} doesn't exist."
echo-warning "To run these tests, follow the setup from https://fuchsia.googlesource.com/flutter-embedder/+/refs/heads/main/docs/making_engine_changes.md."
fi
if ! [ -z "${LOCAL_FUCHSIA_PLATFORM_BUILD}" ]
then
echo-info 'Testing build_and_run_example.sh --with-fuchsia ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh --with-fuchsia
else
echo-warning "Skipping --with-fuchsia tests because ${LOCAL_FUCHSIA_PLATFORM_BUILD} isn't set."
echo-warning "To run these tests, follow the setup from https://fuchsia.googlesource.com/flutter-embedder/+/refs/heads/main/docs/testing_fuchsia_sdk_changes.md."
fi
popd # $FUCHSIA_EMBEDDER_DIR
pushd $HOME
echo-info 'Testing build_and_run_example.sh from $HOME ...'
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh
popd # $HOME