blob: 7dff3b5c968476967e244642eaac8a0525dc079b [file] [log] [blame]
#!/bin/bash -e
### Test wrapper script.
# Many of the integration tests runs the `pub` command, this is slow if every
# invocation requires the dart compiler to load all the sources. This script
# will create a `pub.XXX.dart.snapshot.dart2` which the tests can utilize.
# After creating the snapshot this script will forward arguments to
# `pub run test`, and ensure that the snapshot is deleted after tests have been
# run.
# Find folder containing this script.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# PATH to a snapshot file.
PUB_SNAPSHOT_FILE=`mktemp -t pub.XXXXXXX.dart.snapshot.dart2`
# Always remove the snapshot
function cleanup {
trap cleanup EXIT;
# Build a snapshot for faster testing
echo 'Building snapshot'
cd "$ROOT/";
dart --snapshot="$PUB_SNAPSHOT_FILE" bin/pub.dart
# Run tests
echo 'Running tests'
pub run test "$@"