Chromium Code Reviews| 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/dartutils.h" | 7 #include "bin/dartutils.h" |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 #include "bin/platform.h" | 9 #include "bin/platform.h" |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 static int run_matches = 0; | 34 static int run_matches = 0; |
| 35 | 35 |
| 36 | 36 |
| 37 void TestCase::Run() { | 37 void TestCase::Run() { |
| 38 fprintf(stdout, "Running test: %s\n", name()); | 38 fprintf(stdout, "Running test: %s\n", name()); |
| 39 (*run_)(); | 39 (*run_)(); |
| 40 fprintf(stdout, "Done: %s\n", name()); | 40 fprintf(stdout, "Done: %s\n", name()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 void RawTestCase::Run() { | |
| 45 fprintf(stdout, "Running test: %s\n", name()); | |
|
rmacnak
2017/01/31 21:43:42
OS::Print
bkonyi
2017/01/31 22:14:35
fprintf is used throughout run_vm_tests.cc. Should
rmacnak
2017/01/31 22:44:39
They ought to be OS::Print so one can actually rea
bkonyi
2017/01/31 22:57:18
Ah okay. I'll update all of the fprintf instances
| |
| 46 (*run_)(); | |
| 47 fprintf(stdout, "Done: %s\n", name()); | |
| 48 } | |
| 49 | |
| 50 | |
| 44 void TestCaseBase::RunTest() { | 51 void TestCaseBase::RunTest() { |
| 45 if (strcmp(run_filter, this->name()) == 0) { | 52 if (strcmp(run_filter, this->name()) == 0) { |
| 46 this->Run(); | 53 this->Run(); |
| 47 run_matches++; | 54 run_matches++; |
| 48 } else if (run_filter == kList) { | 55 } else if (run_filter == kList) { |
| 49 fprintf(stdout, "%s\n", this->name()); | 56 fprintf(stdout, "%s\n", this->name()); |
| 50 run_matches++; | 57 run_matches++; |
| 51 } | 58 } |
| 52 } | 59 } |
| 53 | 60 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 83 if (argc < 2) { | 90 if (argc < 2) { |
| 84 // Bad parameter count. | 91 // Bad parameter count. |
| 85 PrintUsage(); | 92 PrintUsage(); |
| 86 return 1; | 93 return 1; |
| 87 } else if (argc == 2) { | 94 } else if (argc == 2) { |
| 88 if (strcmp(argv[1], "--list") == 0) { | 95 if (strcmp(argv[1], "--list") == 0) { |
| 89 run_filter = kList; | 96 run_filter = kList; |
| 90 // List all tests and benchmarks and exit without initializing the VM. | 97 // List all tests and benchmarks and exit without initializing the VM. |
| 91 TestCaseBase::RunAll(); | 98 TestCaseBase::RunAll(); |
| 92 Benchmark::RunAll(argv[0]); | 99 Benchmark::RunAll(argv[0]); |
| 100 TestCaseBase::RunAllRaw(); | |
| 93 fflush(stdout); | 101 fflush(stdout); |
| 94 return 0; | 102 return 0; |
| 95 } else if (strcmp(argv[1], "--benchmarks") == 0) { | 103 } else if (strcmp(argv[1], "--benchmarks") == 0) { |
| 96 run_filter = kAllBenchmarks; | 104 run_filter = kAllBenchmarks; |
| 97 } else { | 105 } else { |
| 98 run_filter = argv[1]; | 106 run_filter = argv[1]; |
| 99 } | 107 } |
| 100 } else { | 108 } else { |
| 101 // Last argument is the test name, the rest are vm flags. | 109 // Last argument is the test name, the rest are vm flags. |
| 102 run_filter = argv[argc - 1]; | 110 run_filter = argv[argc - 1]; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 115 dart::bin::DartUtils::CloseFile, NULL, NULL); | 123 dart::bin::DartUtils::CloseFile, NULL, NULL); |
| 116 ASSERT(err_msg == NULL); | 124 ASSERT(err_msg == NULL); |
| 117 // Apply the filter to all registered tests. | 125 // Apply the filter to all registered tests. |
| 118 TestCaseBase::RunAll(); | 126 TestCaseBase::RunAll(); |
| 119 // Apply the filter to all registered benchmarks. | 127 // Apply the filter to all registered benchmarks. |
| 120 Benchmark::RunAll(argv[0]); | 128 Benchmark::RunAll(argv[0]); |
| 121 | 129 |
| 122 err_msg = Dart::Cleanup(); | 130 err_msg = Dart::Cleanup(); |
| 123 ASSERT(err_msg == NULL); | 131 ASSERT(err_msg == NULL); |
| 124 | 132 |
| 133 TestCaseBase::RunAllRaw(); | |
|
bkonyi
2017/01/31 20:59:50
The raw tests are run after the VM is shutdown sin
| |
| 125 // Print a warning message if no tests or benchmarks were matched. | 134 // Print a warning message if no tests or benchmarks were matched. |
| 126 if (run_matches == 0) { | 135 if (run_matches == 0) { |
| 127 fprintf(stderr, "No tests matched: %s\n", run_filter); | 136 fprintf(stderr, "No tests matched: %s\n", run_filter); |
| 128 return 1; | 137 return 1; |
| 129 } | 138 } |
| 130 if (DynamicAssertionHelper::failed()) { | 139 if (DynamicAssertionHelper::failed()) { |
| 131 return 255; | 140 return 255; |
| 132 } | 141 } |
| 133 return 0; | 142 return 0; |
| 134 } | 143 } |
| 135 | 144 |
| 136 } // namespace dart | 145 } // namespace dart |
| 137 | 146 |
| 138 | 147 |
| 139 int main(int argc, const char** argv) { | 148 int main(int argc, const char** argv) { |
| 140 dart::bin::Platform::Exit(dart::Main(argc, argv)); | 149 dart::bin::Platform::Exit(dart::Main(argc, argv)); |
| 141 } | 150 } |
| OLD | NEW |