This is a fixed up version of:

https://codereview.chromium.org/1305183010/

- Reorder the priority of flags in the test harness when passed to the VM:
  default flags, file flags, command line flags
- Ensure to not enable assertions when not being requested.

Peter, any reason to not move the flags in to the
configuration file?  Why don't we actually have all of them in there? (not
that I want to move them, I am just currious why we don't add them in
there, it seems more logical to me)

BUG=
R=iposva@google.com, whesse@google.com

Committed: dd7767d95e

Review URL: https://codereview.chromium.org//1330643003 .
This commit is contained in:
Rico Wind 2015-09-14 07:58:18 +02:00
parent 9ca5ca6316
commit 2e22f41612
6 changed files with 31 additions and 7 deletions

View file

@ -9091,7 +9091,7 @@ AstNode* Parser::ParseAssertStatement() {
ConsumeToken(); // Consume assert keyword.
ExpectToken(Token::kLPAREN);
const intptr_t condition_pos = TokenPos();
if (!I->flags().asserts() && !I->flags().type_checks()) {
if (!I->flags().asserts()) {
SkipExpr();
ExpectToken(Token::kRPAREN);
return NULL;

View file

@ -1,7 +1,7 @@
// 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.
// VMOptions=--enable_type_checks
// VMOptions=--enable_asserts
//
// Dart test program testing assert statements.

View file

@ -0,0 +1,16 @@
// Copyright (c) 2015, 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.
// VMOptions=--no-enable_asserts --enable_type_checks
// Ensure that enabling of type checks does not automatically enable asserts.
main() {
assert(false);
try {
int i = "String";
throw "FAIL";
} on TypeError catch (e) {
print("PASS");
}
}

View file

@ -17,6 +17,9 @@ issue14236_test: Pass # Do not remove this line. It serves as a marker for Issue
javascript_compatibility_errors_test/none: Fail, OK # Not possible to exclude or annotate with '/// none:'
[ $runtime != vm ]
no_assert_test: Fail, OK # This is testing a vm flag.
[ $runtime == vm ]
package/package_isolate_test: Fail # Issue 12474
io/observatory_test: Fail

View file

@ -155,7 +155,12 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
List<String> sharedOptions,
List<String> originalArguments,
CommandArtifact artifact) {
return <String>[]
List<String> args = [];
if (isChecked) {
args.add('--enable_asserts');
args.add('--enable_type_checks');
}
return args
..addAll(vmOptions)
..addAll(sharedOptions)
..addAll(originalArguments);
@ -315,6 +320,10 @@ class AnalyzerCompilerConfiguration extends CompilerConfiguration {
CommandBuilder commandBuilder,
List arguments,
Map<String, String> environmentOverrides) {
arguments = new List.from(arguments);
if (isChecked) {
arguments.add('--enable_type_checks');
}
return new CommandArtifact(
<Command>[
commandBuilder.getAnalysisCommand(

View file

@ -2225,10 +2225,6 @@ class TestUtils {
static List<String> standardOptions(Map configuration) {
List args = ["--ignore-unrecognized-flags"];
if (configuration["checked"]) {
args.add('--enable_asserts');
args.add("--enable_type_checks");
}
String compiler = configuration["compiler"];
if (compiler == "dart2js") {
args = ['--generate-code-with-compile-time-errors', '--test-mode'];