#!/bin/bash set -e # bail on error proc fail { echo -e "Some tests failed" return 1 } # Some tests require being run from the package root # switch to the root directory of dev_compiler cd $[ dirname $(BASH_SOURCE[0])]/.. # Check minimum SDK version ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail # Delete codegen expectation files to be sure that if a test fails to compile # we don't erroneously pick up the old version. if test -d test/codegen/expect { rm -r test/codegen/expect || fail } if test -d gen/codegen_input { rm -r gen/codegen_input || fail } if test -d gen/codegen_output { rm -r gen/codegen_output || fail } ./tool/build_test_pkgs.sh # Make sure we don't run tests in code coverage mode. # this will cause us to generate files that are not part of the baseline # TODO(jmesserly): we should move diff into Dart code, so we don't need to # worry about this. Also if we're in code coverage mode, we should avoid running # all_tests twice. Finally self_host_test is not currently being tracked by # code coverage. unset COVERALLS_TOKEN dart test/all_tests.dart || fail do { global fc := $[find test -name "*.dart" |\ xargs grep "/\*\S* should be \S*\*/" | wc -l] echo "There are" $fc "tests marked as known failures." } echo -e "All tests built - run tool/browser_test.sh to run tests" (CommandList children: [ (C {(set)} {(-e)}) (FuncDef name: fail body: (BraceGroup children: [ (C {(echo)} {(-e)} {(DQ ("\u001b[31mSome tests failed\u001b[0m"))}) (ControlFlow token: arg_word:{(1)}) ] spids: [15] ) spids: [11 14] ) (C {(cd)} { (CommandSubPart command_list: (CommandList children: [ (C {(dirname)} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [47 52] ) ) } ) ] ) left_token: spids: [42 55] ) (/..) } ) (AndOr children: [(C {(./tool/sdk_version_check.dart)} {(1.9.0-dev.4.0)}) (C {(fail)})] op_id: Op_DPipe ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {(test/codegen/expect)} {(Lit_Other "]")}) terminator: ) ] action: [ (AndOr children: [(C {(rm)} {(-r)} {(test/codegen/expect)}) (C {(fail)})] op_id: Op_DPipe ) ] spids: [-1 88] ) ] spids: [-1 101] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {(gen/codegen_input)} {(Lit_Other "]")}) terminator: ) ] action: [ (AndOr children: [(C {(rm)} {(-r)} {(gen/codegen_input)}) (C {(fail)})] op_id: Op_DPipe ) ] spids: [-1 115] ) ] spids: [-1 128] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {(gen/codegen_output)} {(Lit_Other "]")}) terminator: ) ] action: [ (AndOr children: [(C {(rm)} {(-r)} {(gen/codegen_output)}) (C {(fail)})] op_id: Op_DPipe ) ] spids: [-1 142] ) ] spids: [-1 155] ) (C {(./tool/build_test_pkgs.sh)}) (C {(unset)} {(COVERALLS_TOKEN)}) (AndOr children:[(C {(dart)} {(test/all_tests.dart)})(C {(fail)})] op_id:Op_DPipe) (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fc) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(find)} {(test)} {(-name)} {(DQ ("*.dart"))}) (C {(xargs)} {(grep)} { (DQ (/) (EscapedLiteralPart token:) (EscapedLiteralPart token: ) ("* should be ") (EscapedLiteralPart token:) ("*") (EscapedLiteralPart token: ) (/) ) } ) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: spids: [196 230] ) } spids: [195] ) ] spids: [195] ) (C {(echo)} {(DQ ("There are"))} {($ VSub_Name "$fc")} {(DQ ("tests marked as known failures."))}) ] spids: [192] ) (C {(echo)} {(-e)} {(DQ ("\u001b[32mAll tests built - run tool/browser_test.sh to run tests\u001b[0m"))} ) ] )