OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
6 | 6 |
7 | 7 |
8 import com.google.dart.compiler.DartCompiler.Result; | 8 import com.google.dart.compiler.DartCompiler.Result; |
9 | 9 |
10 import java.io.BufferedReader; | 10 import java.io.BufferedReader; |
(...skipping 26 matching lines...) Expand all Loading... |
37 int testsFailed = 0; | 37 int testsFailed = 0; |
38 int totalTests = 0; | 38 int totalTests = 0; |
39 Result batchResult = new Result(DartCompiler.RESULT_OK, null); | 39 Result batchResult = new Result(DartCompiler.RESULT_OK, null); |
40 try { | 40 try { |
41 String line; | 41 String line; |
42 for (; (line = cmdlineReader.readLine()) != null; totalTests++) { | 42 for (; (line = cmdlineReader.readLine()) != null; totalTests++) { |
43 long testStart = System.currentTimeMillis(); | 43 long testStart = System.currentTimeMillis(); |
44 // TODO(zundel): These are shell script cmdlines: be smarter about quote
d strings. | 44 // TODO(zundel): These are shell script cmdlines: be smarter about quote
d strings. |
45 String[] args = line.trim().split("\\s+"); | 45 String[] args = line.trim().split("\\s+"); |
46 Result result = toolInvocation.invoke(args); | 46 Result result = toolInvocation.invoke(args); |
47 boolean resultPass = result.code >= DartCompiler.RESULT_ERRORS; | 47 boolean resultPass = result.code < DartCompiler.RESULT_ERRORS; |
48 if (resultPass) { | 48 if (resultPass) { |
49 testsFailed++; | 49 testsFailed++; |
50 } | 50 } |
51 batchResult = batchResult.merge(result); | 51 batchResult = batchResult.merge(result); |
52 // Write stderr end token and flush. | 52 // Write stderr end token and flush. |
53 System.err.println(">>> EOF STDERR"); | 53 System.err.println(">>> EOF STDERR"); |
54 System.err.flush(); | 54 System.err.flush(); |
55 System.out.println(">>> TEST " + (resultPass ? "PASS" : "FAIL") + " " | 55 System.out.println(">>> TEST " + (resultPass ? "PASS" : "FAIL") + " " |
56 + (System.currentTimeMillis() - testStart) + "ms"); | 56 + (System.currentTimeMillis() - testStart) + "ms"); |
57 System.out.flush(); | 57 System.out.flush(); |
58 } | 58 } |
59 } catch (Throwable e) { | 59 } catch (Throwable e) { |
60 System.err.println(">>> EOF STDERR"); | 60 System.err.println(">>> EOF STDERR"); |
61 System.err.flush(); | 61 System.err.flush(); |
62 System.out.println(">>> TEST CRASH"); | 62 System.out.println(">>> TEST CRASH"); |
63 System.out.flush(); | 63 System.out.flush(); |
64 throw e; | 64 throw e; |
65 } | 65 } |
66 long elapsed = System.currentTimeMillis() - startTime; | 66 long elapsed = System.currentTimeMillis() - startTime; |
67 System.out.println(">>> BATCH END (" + (totalTests - testsFailed) + "/" | 67 System.out.println(">>> BATCH END (" + (totalTests - testsFailed) + "/" |
68 + totalTests + ") " + elapsed + "ms"); | 68 + totalTests + ") " + elapsed + "ms"); |
69 System.out.flush(); | 69 System.out.flush(); |
70 return batchResult; | 70 return batchResult; |
71 } | 71 } |
72 } | 72 } |
OLD | NEW |