blob: c3005f1138f764964ddc93ba68081234ca324665 [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=`tempfile -p 'pub.' -s '.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 -r expanded "$@"