Index: tests/standalone/test_config.dart |
diff --git a/tests/standalone/test_config.dart b/tests/standalone/test_config.dart |
index 170de26c172f5dda8f9a80ab0b35ea52e94f979a..97f57a99bc0e4618b98166fbe52bd6d1dd3b322a 100644 |
--- a/tests/standalone/test_config.dart |
+++ b/tests/standalone/test_config.dart |
@@ -5,51 +5,77 @@ |
#library("standalone_test_config"); |
#import("../../tools/testing/dart/test_runner.dart"); |
+#import("../../tools/testing/dart/status_file_parser.dart"); |
class StandaloneTestSuite { |
- final String directoryPath = "tests/standalone/src"; |
+ String directoryPath = "tests/standalone/src"; |
+ final String statusFilePath = "tests/standalone/standalone.status"; |
Function doTest; |
Function doDone; |
String shellPath; |
String pathSeparator; |
+ TestSettingMap testSettingMap; |
+ Configuration configuration; |
StandaloneTestSuite() { |
shellPath = getDartShellFileName() ; |
pathSeparator = new Platform().pathSeparator(); |
+ testSettingMap = new TestSettingMap(); |
+ configuration = new Configuration({"mode":"debug", |
+ "arch":"ia32", |
+ "checked":"false", |
+ "component":"vm", |
+ "system": |
+ new Platform().operatingSystem()}); |
Mads Ager (google)
2011/11/09 14:46:53
How about avoiding this indentation by doing:
con
Bill Hesse
2011/11/09 14:55:39
Done.
Mads Ager (google)
2011/11/09 15:12:35
Could you upload a new snapshot?
|
} |
void forEachTest(Function onTest, [Function onDone = null]) { |
doTest = onTest; |
doDone = onDone; |
+ |
+ // Read configuration from status file. |
+ List<Section> sections = new List<Section>(); |
+ ReadConfigurationInto(statusFilePath, sections); |
+ for (Section section in sections) { |
+ if (configuration.isEnabled(section)) { |
+ for (var testSetting in section.testSettings) { |
+ testSettingMap.addTest(testSetting, configuration); |
Mads Ager (google)
2011/11/09 14:46:53
What is a testSetting and why does the testSetting
Bill Hesse
2011/11/09 14:55:39
This is the immediate next thing to be implemented
Mads Ager (google)
2011/11/09 15:12:35
OK, I would still leave it out of this change unti
|
+ } |
+ } |
+ } |
+ |
processDirectory(); |
} |
void processDirectory() { |
+ directoryPath = getDirname(directoryPath); |
Directory dir = new Directory(directoryPath); |
- if (!dir.existsSync()) { |
- dir = new Directory(".." + pathSeparator + directoryPath); |
- Expect.isTrue(dir.existsSync(), |
- "Cannot find tests/corelib/src or ../tests/corelib/src"); |
+ Expect.isTrue(dir.existsSync(), |
+ "Cannot find tests/standalone/src or ../tests/standalone/src"); |
// TODO(ager): Use dir.errorHandler instead when it is implemented. |
- } |
dir.fileHandler = processFile; |
dir.doneHandler = doDone; |
dir.list(false); |
} |
void processFile(String filename) { |
- if (filename.endsWith("Test.dart")) { |
- int start = filename.lastIndexOf(pathSeparator); |
- String displayName = filename.substring(start + 1, filename.length - 5); |
- // TODO(whesse): Gather test case info from status file and test file. |
- doTest(new TestCase(displayName, |
- shellPath, |
- <String>["--enable_type_checks", |
- "--ignore-unrecognized-flags", |
- filename ], |
- completeHandler, |
- new Set.from([PASS, FAIL, CRASH, TIMEOUT]))); |
- } |
+ if (!filename.endsWith("Test.dart")) return; |
+ |
+ Expect.isTrue(filename.contains(directoryPath)); |
+ String testName = filename.substring( |
Mads Ager (google)
2011/11/09 14:46:53
I linked what you had before much better. This loo
Bill Hesse
2011/11/09 14:55:39
The reason for the complication is that some test
Mads Ager (google)
2011/11/09 15:12:35
OK, in that case should you make the directory lis
|
+ filename.indexOf(directoryPath) + directoryPath.length + 1, |
+ filename.length - ".dart".length); |
+ Set<String> expectations = testSettingMap.expectations(testName); |
Mads Ager (google)
2011/11/09 14:46:53
I would leave this out for now as well. It doesn't
Bill Hesse
2011/11/09 14:55:39
I wanted the design, and the stubs. That way, I c
Mads Ager (google)
2011/11/09 15:12:35
Same as above. I would wait until it does somethin
|
+ expectations.addAll(ExpectationsFromFile(filename)); |
+ if (expectations.contains(SKIP)) return; |
+ |
+ doTest(new TestCase(testName, |
+ shellPath, |
+ <String>["--enable_type_checks", |
+ "--ignore-unrecognized-flags", |
+ filename ], |
+ completeHandler, |
+ expectations)); |
} |
void completeHandler(TestCase testCase) { |
@@ -57,3 +83,27 @@ class StandaloneTestSuite { |
print("Exit code: ${output.exitCode} Time: ${output.time}"); |
} |
} |
+ |
+ |
+class Configuration { |
+ Map<String, String> environment; |
+ |
+ Configuration(this.environment); |
+ |
+ bool isEnabled(Section section) => |
+ section.condition == null || section.condition.evaluate(environment); |
+} |
+ |
+class TestSettingMap { |
+ TestSettingMap(); |
+ |
+ void addTest(testSetting, Configuration configuration) { } |
+ |
+ Set<String> expectations(String filename) => |
+ new Set.from([PASS, FAIL, CRASH, TIMEOUT]); |
+} |
+ |
+ |
+Collection<String> ExpectationsFromFile(String fileName) { |
+ return new List<String>(); |
+} |