| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library("standalone_test_config"); | 5 #library("standalone_test_config"); |
| 6 | 6 |
| 7 #import("../../tools/testing/dart/test_runner.dart"); | 7 #import("../../tools/testing/dart/test_runner.dart"); |
| 8 #import("../../tools/testing/dart/status_file_parser.dart"); | 8 #import("../../tools/testing/dart/status_file_parser.dart"); |
| 9 | 9 |
| 10 class StandaloneTestSuite { | 10 class StandaloneTestSuite { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // until they are handled correctly. | 54 // until they are handled correctly. |
| 55 if (expectations.contains(SKIP)) return; | 55 if (expectations.contains(SKIP)) return; |
| 56 | 56 |
| 57 List args = ["--ignore-unrecognized-flags"]; | 57 List args = ["--ignore-unrecognized-flags"]; |
| 58 if (configuration["checked"]) { | 58 if (configuration["checked"]) { |
| 59 args.add("--enable_type_checks"); | 59 args.add("--enable_type_checks"); |
| 60 } | 60 } |
| 61 if (configuration["component"] == "leg") { | 61 if (configuration["component"] == "leg") { |
| 62 args.add("--enable_leg"); | 62 args.add("--enable_leg"); |
| 63 } | 63 } |
| 64 args.add(filename); | |
| 65 | 64 |
| 65 var optionsFromFile = testOptions(filename); |
| 66 List<List<String>> optionsList = optionsFromFile["vmOptions"]; |
| 67 List<String> dartOptions = optionsFromFile["dartOptions"]; |
| 68 args.addAll(dartOptions == null ? [filename] : dartOptions); |
| 66 | 69 |
| 67 List<List> optionsList = testOptions(filename); | |
| 68 if (optionsList.isEmpty()) { | 70 if (optionsList.isEmpty()) { |
| 69 doTest(new TestCase(testName, | 71 doTest(new TestCase(testName, |
| 70 shellPath, | 72 shellPath, |
| 71 args, | 73 args, |
| 72 configuration["timeout"], | 74 configuration["timeout"], |
| 73 completeHandler, | 75 completeHandler, |
| 74 expectations)); | 76 expectations)); |
| 75 } else { | 77 } else { |
| 76 for (var options in optionsList) { | 78 for (var options in optionsList) { |
| 77 options.addAll(args); | 79 options.addAll(args); |
| 78 doTest(new TestCase(testName, | 80 doTest(new TestCase(testName, |
| 79 shellPath, | 81 shellPath, |
| 80 options, | 82 options, |
| 81 configuration["timeout"], | 83 configuration["timeout"], |
| 82 completeHandler, | 84 completeHandler, |
| 83 expectations)); | 85 expectations)); |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 } | 88 } |
| 87 | 89 |
| 88 List<List> testOptions(String filename) { | 90 Map testOptions(String filename) { |
| 89 RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)"); | 91 RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)"); |
| 92 RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)"); |
| 90 File file = new File(filename); | 93 File file = new File(filename); |
| 91 FileInputStream fileStream = file.openInputStream(); | 94 FileInputStream fileStream = file.openInputStream(); |
| 92 StringInputStream lines = new StringInputStream(fileStream); | 95 StringInputStream lines = new StringInputStream(fileStream); |
| 93 | 96 |
| 94 List<List> result = new List<List>(); | 97 List<List> result = new List<List>(); |
| 98 List<String> dartOptions; |
| 95 String line; | 99 String line; |
| 96 while ((line = lines.readLine()) != null) { | 100 while ((line = lines.readLine()) != null) { |
| 97 Match match = testOptionsRegExp.firstMatch(line); | 101 Match match = testOptionsRegExp.firstMatch(line); |
| 98 if (match != null) { | 102 if (match != null) { |
| 99 result.add(match[1].split(' ').filter((e) => e != '')); | 103 result.add(match[1].split(' ').filter((e) => e != '')); |
| 100 } | 104 } |
| 105 |
| 106 match = dartOptionsRegExp.firstMatch(line); |
| 107 if (match != null) { |
| 108 if (dartOptions != null) { |
| 109 throw new Exception('More than one "// DartOptions=" line in test'); |
| 110 } |
| 111 dartOptions = match[1].split(' ').filter((e) => e != ''); |
| 112 } |
| 101 } | 113 } |
| 102 return result; | 114 return {"vmOptions": result, "dartOptions": dartOptions}; |
| 103 } | 115 } |
| 104 | 116 |
| 105 void completeHandler(TestCase testCase) { | 117 void completeHandler(TestCase testCase) { |
| 106 } | 118 } |
| 107 } | 119 } |
| OLD | NEW |