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 #include <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "bin/file.h" | 7 #include "bin/file.h" |
8 | 8 |
9 #include "vm/benchmark_test.h" | 9 #include "vm/benchmark_test.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| 11 #include "bin/dartutils.h" |
11 #include "vm/unit_test.h" | 12 #include "vm/unit_test.h" |
12 | 13 |
| 14 |
13 // TODO(iposva, asiva): This is a placeholder for the real unittest framework. | 15 // TODO(iposva, asiva): This is a placeholder for the real unittest framework. |
14 namespace dart { | 16 namespace dart { |
15 | 17 |
16 // Only run tests that match the filter string. The default does not match any | 18 // Only run tests that match the filter string. The default does not match any |
17 // tests. | 19 // tests. |
18 static const char* const kNone = "No Test or Benchmarks"; | 20 static const char* const kNone = "No Test or Benchmarks"; |
19 static const char* const kAll = "All"; | 21 static const char* const kAll = "All"; |
20 static const char* const kList = "List all Tests and Benchmarks"; | 22 static const char* const kList = "List all Tests and Benchmarks"; |
21 static const char* const kAllTests = "All Tests"; | 23 static const char* const kAllTests = "All Tests"; |
22 static const char* const kAllBenchmarks = "All Benchmarks"; | 24 static const char* const kAllBenchmarks = "All Benchmarks"; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 run_filter = argv[argc - 1]; | 99 run_filter = argv[argc - 1]; |
98 // Remove the first value (executable) from the arguments and | 100 // Remove the first value (executable) from the arguments and |
99 // exclude the last argument which is the test name. | 101 // exclude the last argument which is the test name. |
100 dart_argc = argc - 2; | 102 dart_argc = argc - 2; |
101 dart_argv = &argv[1]; | 103 dart_argv = &argv[1]; |
102 } | 104 } |
103 bool set_vm_flags_success = Flags::ProcessCommandLineFlags(dart_argc, | 105 bool set_vm_flags_success = Flags::ProcessCommandLineFlags(dart_argc, |
104 dart_argv); | 106 dart_argv); |
105 ASSERT(set_vm_flags_success); | 107 ASSERT(set_vm_flags_success); |
106 const char* err_msg = Dart::InitOnce(NULL, NULL, NULL, NULL, | 108 const char* err_msg = Dart::InitOnce(NULL, NULL, NULL, NULL, |
107 NULL, NULL, NULL); | 109 dart::bin::DartUtils::OpenFile, |
| 110 dart::bin::DartUtils::ReadFile, |
| 111 dart::bin::DartUtils::WriteFile, |
| 112 dart::bin::DartUtils::CloseFile); |
108 ASSERT(err_msg == NULL); | 113 ASSERT(err_msg == NULL); |
109 // Apply the filter to all registered tests. | 114 // Apply the filter to all registered tests. |
110 TestCaseBase::RunAll(); | 115 TestCaseBase::RunAll(); |
111 // Apply the filter to all registered benchmarks. | 116 // Apply the filter to all registered benchmarks. |
112 Benchmark::RunAll(argv[0]); | 117 Benchmark::RunAll(argv[0]); |
113 // Print a warning message if no tests or benchmarks were matched. | 118 // Print a warning message if no tests or benchmarks were matched. |
114 if (run_matches == 0) { | 119 if (run_matches == 0) { |
115 fprintf(stderr, "No tests matched: %s\n", run_filter); | 120 fprintf(stderr, "No tests matched: %s\n", run_filter); |
116 return 1; | 121 return 1; |
117 } | 122 } |
118 return 0; | 123 return 0; |
119 } | 124 } |
120 | 125 |
121 } // namespace dart | 126 } // namespace dart |
122 | 127 |
123 | 128 |
124 int main(int argc, const char** argv) { | 129 int main(int argc, const char** argv) { |
125 return dart::Main(argc, argv); | 130 return dart::Main(argc, argv); |
126 } | 131 } |
OLD | NEW |