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

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, 1 month 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
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) { 47 static bool TestIsolateCreationCallback(void* data, Dart_ErrorBuffer error) {
48 ASSERT(data == NULL); 48 Dart_Isolate isolate = Dart_CreateIsolate(NULL, data, error);
49 return reinterpret_cast<void*>(0); 49 ASSERT(isolate != NULL);
50 return true;
50 } 51 }
51 52
52 53
53 static int Main(int argc, const char** argv) { 54 static int Main(int argc, const char** argv) {
54 // Flags being passed to the Dart VM. 55 // Flags being passed to the Dart VM.
55 int dart_argc = 0; 56 int dart_argc = 0;
56 const char** dart_argv = NULL; 57 const char** dart_argv = NULL;
57 58
58 if (argc < 2) { 59 if (argc < 2) {
59 // Bad parameter count. 60 // Bad parameter count.
(...skipping 11 matching lines...) Expand all
71 test_filter = argv[1]; 72 test_filter = argv[1];
72 } 73 }
73 } else { 74 } else {
74 // First argument is the test name, the rest are vm flags. 75 // First argument is the test name, the rest are vm flags.
75 test_filter = argv[1]; 76 test_filter = argv[1];
76 // Remove the first two values from the arguments. 77 // Remove the first two values from the arguments.
77 dart_argc = argc - 2; 78 dart_argc = argc - 2;
78 dart_argv = &argv[2]; 79 dart_argv = &argv[2];
79 } 80 }
80 bool init_success = Dart::InitOnce(dart_argc, dart_argv, 81 bool init_success = Dart::InitOnce(dart_argc, dart_argv,
81 TestIsolateInitCallback); 82 TestIsolateCreationCallback);
82 ASSERT(init_success); 83 ASSERT(init_success);
83 // Apply the test filter to all registered tests. 84 // Apply the test filter to all registered tests.
84 TestCaseBase::RunAll(); 85 TestCaseBase::RunAll();
85 // Print a warning message if no tests were matched. 86 // Print a warning message if no tests were matched.
86 if (test_matches == 0) { 87 if (test_matches == 0) {
87 fprintf(stderr, "No tests matched: %s\n", test_filter); 88 fprintf(stderr, "No tests matched: %s\n", test_filter);
88 return 1; 89 return 1;
89 } 90 }
90 return 0; 91 return 0;
91 } 92 }
92 93
93 } // namespace dart 94 } // namespace dart
94 95
95 96
96 int main(int argc, const char** argv) { 97 int main(int argc, const char** argv) {
97 return dart::Main(argc, argv); 98 return dart::Main(argc, argv);
98 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698