Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: bin/run_vm_tests.cc

Issue 8673002: - Refactor the isolate callback mechanism to also include creation of the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bin/main.cc ('k') | include/dart_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 // TODO(iposva, asiva): This is a placeholder for the real unittest framework. 10 // TODO(iposva, asiva): This is a placeholder for the real unittest framework.
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 } 38 }
39 39
40 40
41 static void PrintUsage() { 41 static void PrintUsage() {
42 fprintf(stderr, "run_vm_tests [--list | --all | <test name>]\n"); 42 fprintf(stderr, "run_vm_tests [--list | --all | <test name>]\n");
43 fprintf(stderr, "run_vm_tests <test name> [vm-flags ...]\n"); 43 fprintf(stderr, "run_vm_tests <test name> [vm-flags ...]\n");
44 } 44 }
45 45
46 46
47 static void* TestIsolateInitCallback(void* data) {
48 ASSERT(data == NULL);
49 return reinterpret_cast<void*>(0);
50 }
51
52
53 static int Main(int argc, const char** argv) { 47 static int Main(int argc, const char** argv) {
54 // Flags being passed to the Dart VM. 48 // Flags being passed to the Dart VM.
55 int dart_argc = 0; 49 int dart_argc = 0;
56 const char** dart_argv = NULL; 50 const char** dart_argv = NULL;
57 51
58 if (argc < 2) { 52 if (argc < 2) {
59 // Bad parameter count. 53 // Bad parameter count.
60 PrintUsage(); 54 PrintUsage();
61 return 1; 55 return 1;
62 } else if (argc == 2) { 56 } else if (argc == 2) {
63 if (strcmp(argv[1], "--list") == 0) { 57 if (strcmp(argv[1], "--list") == 0) {
64 test_filter = kListTests; 58 test_filter = kListTests;
65 // List all the tests and exit without initializing the VM at all. 59 // List all the tests and exit without initializing the VM at all.
66 TestCaseBase::RunAll(); 60 TestCaseBase::RunAll();
67 return 0; 61 return 0;
68 } else if (strcmp(argv[1], "--all") == 0) { 62 } else if (strcmp(argv[1], "--all") == 0) {
69 test_filter = kAllTests; 63 test_filter = kAllTests;
70 } else { 64 } else {
71 test_filter = argv[1]; 65 test_filter = argv[1];
72 } 66 }
73 } else { 67 } else {
74 // First argument is the test name, the rest are vm flags. 68 // First argument is the test name, the rest are vm flags.
75 test_filter = argv[1]; 69 test_filter = argv[1];
76 // Remove the first two values from the arguments. 70 // Remove the first two values from the arguments.
77 dart_argc = argc - 2; 71 dart_argc = argc - 2;
78 dart_argv = &argv[2]; 72 dart_argv = &argv[2];
79 } 73 }
80 bool init_success = Dart::InitOnce(dart_argc, dart_argv, 74 bool init_success = Dart::InitOnce(dart_argc, dart_argv, NULL);
81 TestIsolateInitCallback);
82 ASSERT(init_success); 75 ASSERT(init_success);
83 // Apply the test filter to all registered tests. 76 // Apply the test filter to all registered tests.
84 TestCaseBase::RunAll(); 77 TestCaseBase::RunAll();
85 // Print a warning message if no tests were matched. 78 // Print a warning message if no tests were matched.
86 if (test_matches == 0) { 79 if (test_matches == 0) {
87 fprintf(stderr, "No tests matched: %s\n", test_filter); 80 fprintf(stderr, "No tests matched: %s\n", test_filter);
88 return 1; 81 return 1;
89 } 82 }
90 return 0; 83 return 0;
91 } 84 }
92 85
93 } // namespace dart 86 } // namespace dart
94 87
95 88
96 int main(int argc, const char** argv) { 89 int main(int argc, const char** argv) {
97 return dart::Main(argc, argv); 90 return dart::Main(argc, argv);
98 } 91 }
OLDNEW
« no previous file with comments | « bin/main.cc ('k') | include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698