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