2011-10-05 05:34:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
#
|
|
|
|
|
|
|
|
# A quick check over a subset the tests in the runtime, compiler
|
|
|
|
# and client directories.
|
|
|
|
|
|
|
|
# Currently builds and checks:
|
|
|
|
# runtime - release mode
|
|
|
|
# compiler - debug mode (non-optimized)
|
|
|
|
# client - chromium debug mode
|
|
|
|
|
|
|
|
DO_OPTIMIZE=0
|
|
|
|
DO_DARTIUM=0
|
|
|
|
TESTS_FAILED=0
|
|
|
|
|
|
|
|
function usage {
|
|
|
|
echo "usage: $0 [ --help ] [ --optimize ] [ --dartium ] "
|
|
|
|
echo
|
|
|
|
echo "Runs a quick set of tests on runtime, client, and compiler dirs"
|
|
|
|
echo
|
2011-10-07 07:26:06 +00:00
|
|
|
echo " --optimize: Also run dartc and client tests in release mode"
|
2011-10-05 05:34:19 +00:00
|
|
|
echo " --dartium : Also run dartium/debug tests"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
# Compile the vm/runtime
|
|
|
|
# $1 directory to build in
|
|
|
|
# $2 arch
|
|
|
|
# $3 mode
|
|
|
|
function doBuild {
|
2011-10-28 15:42:44 +00:00
|
|
|
./tools/build.py --arch $1 --mode $2
|
2011-10-05 05:34:19 +00:00
|
|
|
if [ $? != 0 ] ; then
|
2011-10-28 15:42:44 +00:00
|
|
|
echo "Build of $1 - $2 failed"
|
2011-10-05 05:34:19 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Execute a set of tests
|
|
|
|
# $1 directory to test in
|
|
|
|
# $2 arch
|
|
|
|
# $3 mode
|
|
|
|
# Returns the output from the subcommand
|
|
|
|
function doTest {
|
2011-11-01 18:23:21 +00:00
|
|
|
./tools/test.py --component $2 --mode $3
|
2011-10-05 05:34:19 +00:00
|
|
|
RESULT=$?
|
|
|
|
if [ ${RESULT} != 0 ] ; then
|
|
|
|
TESTS_FAILED=1
|
|
|
|
fi
|
|
|
|
return ${RESULT}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Main
|
|
|
|
|
|
|
|
while [ ! -z "$1" ] ; do
|
|
|
|
case $1 in
|
|
|
|
"-h"|"-?"|"-help"|"--help")
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
"--optimize")
|
|
|
|
DO_OPTIMIZE=1
|
|
|
|
;;
|
|
|
|
"--dartium")
|
|
|
|
DO_DARTIUM=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unrecognized argument: $1"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! -d compiler -o ! -d runtime -o ! -d tests ] ; then
|
|
|
|
echo "This doesn't look like the dart source tree."
|
|
|
|
echo "Change your directory to the dart trunk source"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
2011-10-28 15:42:44 +00:00
|
|
|
echo "--- Building release ---"
|
|
|
|
doBuild ia32 release
|
2011-10-05 05:34:19 +00:00
|
|
|
|
|
|
|
echo
|
2011-10-28 15:42:44 +00:00
|
|
|
echo "--- Building debug ---"
|
|
|
|
doBuild ia32 debug
|
2011-10-05 05:34:19 +00:00
|
|
|
|
2011-10-07 07:26:06 +00:00
|
|
|
|
2011-10-05 05:34:19 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "=== Runtime tests === "
|
2011-10-28 15:42:44 +00:00
|
|
|
echo " Debug (Ctrl-C to skip this set of tests)"
|
2011-11-01 18:23:21 +00:00
|
|
|
doTest runtime vm debug
|
2011-10-05 05:34:19 +00:00
|
|
|
RUNTIME_RESULT=$?
|
2011-10-28 15:42:44 +00:00
|
|
|
if [ ${RUNTIME_RESULT} == 0 ] ; then
|
|
|
|
echo " Release (Ctrl-C to skip this set of tests)"
|
2011-11-01 18:23:21 +00:00
|
|
|
doTest runtime vm release
|
2011-10-28 15:42:44 +00:00
|
|
|
RUNTIME_RESULT=$?
|
|
|
|
fi
|
2011-10-05 05:34:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "=== Compiler tests ==="
|
2011-10-07 07:26:06 +00:00
|
|
|
echo " Debug mode (Ctrl-C to skip this set of tests)"
|
2011-10-05 05:34:19 +00:00
|
|
|
doTest compiler dartc debug
|
|
|
|
COMPILER_RESULT=$?
|
|
|
|
|
|
|
|
if [ ${DO_OPTIMIZE} == 1 ] ; then
|
2011-10-28 15:42:44 +00:00
|
|
|
echo " Release mode (--optimize)"
|
2011-10-05 05:34:19 +00:00
|
|
|
doTest compiler dartc release
|
|
|
|
RESULT=$?
|
|
|
|
if [ ${RESULT} != 0 ] ; then
|
2011-10-07 07:26:06 +00:00
|
|
|
COMPILER_RESULT=${RESULT}
|
2011-10-05 05:34:19 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "=== Client tests ==="
|
2011-10-07 07:26:06 +00:00
|
|
|
echo " Chromium (Ctrl-C to skip this set of tests)"
|
2011-10-05 05:34:19 +00:00
|
|
|
doTest client chromium debug
|
|
|
|
CLIENT_RESULT=$?
|
|
|
|
|
2011-10-07 07:26:06 +00:00
|
|
|
if [ ${DO_OPTIMIZE} == 1 ] ; then
|
2011-10-28 15:42:44 +00:00
|
|
|
echo " Chromium Release mode (--optimize)"
|
2011-10-07 07:26:06 +00:00
|
|
|
doTest compiler chromium release
|
|
|
|
RESULT=$?
|
|
|
|
if [ ${RESULT} != 0 ] ; then
|
|
|
|
CLIENT_RESULT=${RESULT}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-10-05 05:34:19 +00:00
|
|
|
if [ ${DO_DARTIUM} == 1 ] ; then
|
2011-10-07 07:26:06 +00:00
|
|
|
echo " Dartium (Ctrl-C to skip this set of tests)"
|
2011-10-05 05:34:19 +00:00
|
|
|
doTest client dartium release
|
|
|
|
RESULT=$?
|
|
|
|
if [ ${RESULT} != 0 ] ; then
|
|
|
|
CLIENT_RESULT=${RESULT}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Print summary of results
|
|
|
|
if [ ${RUNTIME_RESULT} != 0 ] ; then
|
|
|
|
echo "*** Runtime tests failed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${COMPILER_RESULT} != 0 ] ; then
|
|
|
|
echo "*** Compiler tests failed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${CLIENT_RESULT} != 0 ] ; then
|
|
|
|
echo "*** Client tests failed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${TESTS_FAILED} == 0 ] ; then
|
|
|
|
echo "All presubmit tests passed!"
|
|
|
|
fi
|