blob: 8446b9073ed0f61882d9006e1353351af774ec73 [file] [log] [blame]
#!/bin/bash
# Make sure dartfmt is run on everything
# This assumes you have dart_style as a dev_dependency
echo "Checking dartfmt..."
NEEDS_DARTFMT="$(find lib test -name "*.dart" | xargs pub run dart_style:format -n)"
if [[ ${NEEDS_DARTFMT} != "" ]]
then
echo "FAILED"
echo "${NEEDS_DARTFMT}"
exit 1
fi
echo "PASSED"
# Make sure we pass the analyzer
echo "Checking dartanalyzer..."
FAILS_ANALYZER="$(find lib test -name "*.dart" | xargs dartanalyzer --options .analysis_options)"
if [[ $FAILS_ANALYZER == *"[error]"* ]]
then
echo "FAILED"
echo "${FAILS_ANALYZER}"
exit 1
fi
echo "PASSED"
# Fail on anything that fails going forward.
set -e
# Allow running this script locally, otherwise it fails outside of travis.
if [[ ${TEST_PLATFORM} == "" ]]
then
TEST_PLATFORM="vm"
fi
THE_COMMAND="pub run test -p $TEST_PLATFORM"
if [[ ${TEST_PLATFORM} == "firefox" ]]
then
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
t=0; until (xdpyinfo -display :99 &> /dev/null || test $t -gt 10); do sleep 1; let t=$t+1; done
fi
echo $THE_COMMAND
exec $THE_COMMAND