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 using dart::bin::DartUtils; | |
Ivan Posva
2013/05/02 21:42:58
No using, please...
siva
2013/05/03 01:58:32
Done.
| |
15 | |
13 // TODO(iposva, asiva): This is a placeholder for the real unittest framework. | 16 // TODO(iposva, asiva): This is a placeholder for the real unittest framework. |
14 namespace dart { | 17 namespace dart { |
15 | 18 |
16 // Only run tests that match the filter string. The default does not match any | 19 // Only run tests that match the filter string. The default does not match any |
17 // tests. | 20 // tests. |
18 static const char* const kNone = "No Test or Benchmarks"; | 21 static const char* const kNone = "No Test or Benchmarks"; |
19 static const char* const kAll = "All"; | 22 static const char* const kAll = "All"; |
20 static const char* const kList = "List all Tests and Benchmarks"; | 23 static const char* const kList = "List all Tests and Benchmarks"; |
21 static const char* const kAllTests = "All Tests"; | 24 static const char* const kAllTests = "All Tests"; |
22 static const char* const kAllBenchmarks = "All Benchmarks"; | 25 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]; | 100 run_filter = argv[argc - 1]; |
98 // Remove the first value (executable) from the arguments and | 101 // Remove the first value (executable) from the arguments and |
99 // exclude the last argument which is the test name. | 102 // exclude the last argument which is the test name. |
100 dart_argc = argc - 2; | 103 dart_argc = argc - 2; |
101 dart_argv = &argv[1]; | 104 dart_argv = &argv[1]; |
102 } | 105 } |
103 bool set_vm_flags_success = Flags::ProcessCommandLineFlags(dart_argc, | 106 bool set_vm_flags_success = Flags::ProcessCommandLineFlags(dart_argc, |
104 dart_argv); | 107 dart_argv); |
105 ASSERT(set_vm_flags_success); | 108 ASSERT(set_vm_flags_success); |
106 const char* err_msg = Dart::InitOnce(NULL, NULL, NULL, NULL, | 109 const char* err_msg = Dart::InitOnce(NULL, NULL, NULL, NULL, |
107 NULL, NULL, NULL); | 110 DartUtils::OpenFile, |
Ivan Posva
2013/05/02 21:42:58
Do we need these here? Can we run the VM tests fro
siva
2013/05/03 01:58:32
There are some basic tests which cannot assume the
| |
111 DartUtils::ReadFile, | |
112 DartUtils::WriteFile, | |
113 DartUtils::CloseFile); | |
108 ASSERT(err_msg == NULL); | 114 ASSERT(err_msg == NULL); |
109 // Apply the filter to all registered tests. | 115 // Apply the filter to all registered tests. |
110 TestCaseBase::RunAll(); | 116 TestCaseBase::RunAll(); |
111 // Apply the filter to all registered benchmarks. | 117 // Apply the filter to all registered benchmarks. |
112 Benchmark::RunAll(argv[0]); | 118 Benchmark::RunAll(argv[0]); |
113 // Print a warning message if no tests or benchmarks were matched. | 119 // Print a warning message if no tests or benchmarks were matched. |
114 if (run_matches == 0) { | 120 if (run_matches == 0) { |
115 fprintf(stderr, "No tests matched: %s\n", run_filter); | 121 fprintf(stderr, "No tests matched: %s\n", run_filter); |
116 return 1; | 122 return 1; |
117 } | 123 } |
118 return 0; | 124 return 0; |
119 } | 125 } |
120 | 126 |
121 } // namespace dart | 127 } // namespace dart |
122 | 128 |
123 | 129 |
124 int main(int argc, const char** argv) { | 130 int main(int argc, const char** argv) { |
125 return dart::Main(argc, argv); | 131 return dart::Main(argc, argv); |
126 } | 132 } |
OLD | NEW |