#!/usr/bin/env 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 setglobal DO_OPTIMIZE = '0' setglobal DO_DARTIUM = '0' setglobal TESTS_FAILED = '0' proc usage { echo "usage: $0 [ --help ] [ --optimize ] [ --dartium ] " echo echo "Runs a quick set of tests on runtime, client, and compiler dirs" echo echo " --optimize: Also run dartc and client tests in release mode" echo " --dartium : Also run dartium/debug tests" echo } # Compile the vm/runtime # $1 directory to build in # $2 arch # $3 mode proc doBuild { ./tools/build.py --arch $1 --mode $2 if test $Status != 0 { echo "Build of $1 - $2 failed" exit 1 } } # Execute a set of tests # $1 directory to test in # $2 arch # $3 mode # Returns the output from the subcommand proc doTest { ./tools/test.py --component $2 --mode $3 setglobal RESULT = $Status if test $(RESULT) != 0 { setglobal TESTS_FAILED = '1' } return ${RESULT} } # Main while test ! -z $1 { match $1 { with "-h"|"-?"|"-help"|"--help" usage exit 1 with "--optimize" setglobal DO_OPTIMIZE = '1' with "--dartium" setglobal DO_DARTIUM = '1' with * echo "Unrecognized argument: $1" usage exit 1 } shift } if test ! -d compiler -o ! -d runtime -o ! -d tests { echo "This doesn't look like the dart source tree." echo "Change your directory to the dart trunk source" exit 1 } echo echo "--- Building release ---" doBuild ia32 release echo echo "--- Building debug ---" doBuild ia32 debug echo echo "=== Runtime tests === " echo " Debug (Ctrl-C to skip this set of tests)" doTest runtime vm debug setglobal RUNTIME_RESULT = $Status if test $(RUNTIME_RESULT) == 0 { echo " Release (Ctrl-C to skip this set of tests)" doTest runtime vm release setglobal RUNTIME_RESULT = $Status } echo echo "=== dartc tests ===" echo " Debug mode (Ctrl-C to skip this set of tests)" doTest compiler dartc debug setglobal DARTC_RESULT = $Status if test $(DO_OPTIMIZE) == 1 { echo " Release mode (--optimize)" doTest compiler dartc release setglobal RESULT = $Status if test $(RESULT) != 0 { setglobal DARTC_RESULT = $(RESULT) } } echo echo "=== Client tests ===" echo " Chromium (Ctrl-C to skip this set of tests)" doTest client chromium debug setglobal CLIENT_RESULT = $Status if test $(DO_OPTIMIZE) == 1 { echo " Chromium Release mode (--optimize)" doTest compiler chromium release setglobal RESULT = $Status if test $(RESULT) != 0 { setglobal CLIENT_RESULT = $(RESULT) } } if test $(DO_DARTIUM) == 1 { echo " Dartium (Ctrl-C to skip this set of tests)" doTest client dartium release setglobal RESULT = $Status if test $(RESULT) != 0 { setglobal CLIENT_RESULT = $(RESULT) } } # Print summary of results if test $(RUNTIME_RESULT) != 0 { echo "*** vm tests failed" } if test $(DARTC_RESULT) != 0 { echo "*** dartc tests failed" } if test $(CLIENT_RESULT) != 0 { echo "*** client tests failed" } if test $(TESTS_FAILED) == 0 { echo "All presubmit tests passed!" }