Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups to run_tests.sh script #8337

Merged
merged 2 commits into from
Mar 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 66 additions & 20 deletions testing/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,81 @@

set -o pipefail -e;

HOST_DIR=${1:-host_debug_unopt}
BUILDROOT_DIR="$(pwd)"
if [[ "$BUILDROOT_DIR" != */src ]]; then
if [[ "$BUILDROOT_DIR" != */src/* ]]; then
echo "Unable to determine build root. Exiting."
exit 1
fi
BUILDROOT_DIR="${BUILDROOT_DIR%/src/*}/src"
fi
echo "Using build root: $BUILDROOT_DIR"

OUT_DIR="$BUILDROOT_DIR/out"
HOST_DIR="$OUT_DIR/${1:-host_debug_unopt}"

# Check a Dart SDK has been built.
if [[ ! -d "$HOST_DIR/dart-sdk" ]]; then
echo "Built Dart SDK not found at $HOST_DIR/dart-sdk. Exiting."
exit 1
fi

# Switch to buildroot dir. Some tests assume paths relative to buildroot.
cd "$BUILDROOT_DIR"

# TODO(dnfield): Re-enable this when the upstream Dart changes that make it not be flaky land.
# out/$HOST_DIR/embedder_unittests
out/$HOST_DIR/flow_unittests
out/$HOST_DIR/fml_unittests --gtest_filter="-*TimeSensitiveTest*"
out/$HOST_DIR/runtime_unittests
out/$HOST_DIR/shell_unittests
out/$HOST_DIR/synchronization_unittests
out/$HOST_DIR/txt_unittests --font-directory=flutter/third_party/txt/third_party/fonts

# pubspec.yaml points to these files
./flutter/tools/gn --unoptimized
ninja -C out/host_debug_unopt flutter/sky/packages

pushd flutter/testing/dart
pub get
# $HOST_DIR/embedder_unittests
echo "Running flow_unittests..."
"$HOST_DIR/flow_unittests"

echo "Running fml_unittests..."
"$HOST_DIR/fml_unittests" --gtest_filter="-*TimeSensitiveTest*"

echo "Running runtime_unittests..."
"$HOST_DIR/runtime_unittests"

echo "Running shell_unittests..."
"$HOST_DIR/shell_unittests"

echo "Running synchronization_unittests..."
"$HOST_DIR/synchronization_unittests"

echo "Running txt_unittests..."
"$HOST_DIR/txt_unittests" --font-directory="$BUILDROOT_DIR/flutter/third_party/txt/third_party/fonts"

# Build flutter/sky/packages.
#
# flutter/testing/dart/pubspec.yaml contains harcoded path deps to
# host_debug_unopt packages.
"$BUILDROOT_DIR/flutter/tools/gn" --unoptimized
ninja -C $OUT_DIR/host_debug_unopt flutter/sky/packages
cbracken marked this conversation as resolved.
Show resolved Hide resolved

# Fetch Dart test dependencies.
pushd "$BUILDROOT_DIR/flutter/testing/dart"
"$HOST_DIR/dart-sdk/bin/pub" get
popd

run_test () {
out/$HOST_DIR/dart out/$HOST_DIR/gen/frontend_server.dart.snapshot --sdk-root out/$HOST_DIR/flutter_patched_sdk --incremental --strong --target=flutter --packages flutter/testing/dart/.packages --output-dill out/$HOST_DIR/engine_test.dill $1
out/$HOST_DIR/flutter_tester --disable-observatory --use-test-fonts out/$HOST_DIR/engine_test.dill
"$HOST_DIR/dart" $HOST_DIR/gen/frontend_server.dart.snapshot \
--sdk-root $HOST_DIR/flutter_patched_sdk \
--incremental \
--strong \
--target=flutter \
--packages flutter/testing/dart/.packages \
--output-dill $HOST_DIR/engine_test.dill \
$1

"$HOST_DIR/flutter_tester" \
--disable-observatory \
--use-test-fonts \
"$HOST_DIR/engine_test.dill"
}

# Verify that a failing test returns a failure code.
! run_test flutter/testing/smoke_test_failure/fail_test.dart
! run_test "$BUILDROOT_DIR/flutter/testing/smoke_test_failure/fail_test.dart"

for TEST_SCRIPT in flutter/testing/dart/*.dart; do
run_test $TEST_SCRIPT
for TEST_SCRIPT in "$BUILDROOT_DIR"/flutter/testing/dart/*.dart; do
run_test "$TEST_SCRIPT"
done

pushd flutter
Expand Down