OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <launchpad/launchpad.h> | 6 #include <launchpad/launchpad.h> |
7 #include <launchpad/vmo.h> | 7 #include <launchpad/vmo.h> |
| 8 #include <magenta/status.h> |
8 #include <magenta/syscalls.h> | 9 #include <magenta/syscalls.h> |
9 #include <magenta/syscalls/object.h> | 10 #include <magenta/syscalls/object.h> |
10 #include <mxio/util.h> | 11 #include <mxio/util.h> |
11 #include <pthread.h> | 12 #include <pthread.h> |
12 #include <runtime/status.h> | |
13 #include <runtime/sysinfo.h> | |
14 #include <stdbool.h> | 13 #include <stdbool.h> |
15 #include <stdio.h> | 14 #include <stdio.h> |
16 #include <stdlib.h> | 15 #include <stdlib.h> |
17 #include <string.h> | 16 #include <string.h> |
18 #include <unistd.h> | 17 #include <unistd.h> |
19 | 18 |
20 // This program runs Dart VM unit tests. The Dart VM unit tests are contained | 19 // This program runs Dart VM unit tests. The Dart VM unit tests are contained |
21 // in a separate binary whose location is defined in kRunVmTestsPath below. | 20 // in a separate binary whose location is defined in kRunVmTestsPath below. |
22 // That program accepts a command line argument --list to list all the available | 21 // That program accepts a command line argument --list to list all the available |
23 // tests, or the name of a single test to run. This program grabs the list of | 22 // tests, or the name of a single test to run. This program grabs the list of |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 static bool isExpectFail(const char* test) { | 133 static bool isExpectFail(const char* test) { |
135 return contains( | 134 return contains( |
136 kExpectFail, sizeof(kExpectFail) / sizeof(kExpectFail[0]), test); | 135 kExpectFail, sizeof(kExpectFail) / sizeof(kExpectFail[0]), test); |
137 } | 136 } |
138 | 137 |
139 | 138 |
140 static bool isBug(const char* test) { | 139 static bool isBug(const char* test) { |
141 return contains(kBugs, sizeof(kBugs) / sizeof(kBugs[0]), test); | 140 return contains(kBugs, sizeof(kBugs) / sizeof(kBugs[0]), test); |
142 } | 141 } |
143 | 142 |
144 | |
145 #define RETURN_IF_ERROR(status) \ | 143 #define RETURN_IF_ERROR(status) \ |
146 if (status < 0) { \ | 144 if (status < 0) { \ |
147 fprintf(stderr, "%s:%d: Magenta call failed: %s\n", \ | 145 fprintf(stderr, "%s:%d: Magenta call failed: %s\n", __FILE__, __LINE__, \ |
148 __FILE__, __LINE__, mx_strstatus(static_cast<mx_status_t>(status))); \ | 146 mx_status_get_string(static_cast<mx_status_t>(status))); \ |
149 fflush(0); \ | 147 fflush(0); \ |
150 return status; \ | 148 return status; \ |
151 } \ | 149 } |
152 | |
153 | 150 |
154 // This is mostly taken from //magenta/system/uapp/mxsh with the addtion of | 151 // This is mostly taken from //magenta/system/uapp/mxsh with the addtion of |
155 // launchpad_add_pipe calls to setup pipes for stdout and stderr. | 152 // launchpad_add_pipe calls to setup pipes for stdout and stderr. |
156 static mx_status_t lp_setup(launchpad_t** lp_out, mx_handle_t binary_vmo, | 153 static mx_status_t lp_setup(launchpad_t** lp_out, mx_handle_t binary_vmo, |
157 int argc, const char* const* argv, | 154 int argc, const char* const* argv, |
158 int *stdout_out, int *stderr_out) { | 155 int *stdout_out, int *stderr_out) { |
159 if ((lp_out == NULL) || (stdout_out == NULL) || (stderr_out == NULL)) { | 156 if ((lp_out == NULL) || (stdout_out == NULL) || (stderr_out == NULL)) { |
160 return ERR_INVALID_ARGS; | 157 return ERR_INVALID_ARGS; |
161 } | 158 } |
162 launchpad_t* lp; | 159 launchpad_t* lp; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 RETURN_IF_ERROR(status); | 440 RETURN_IF_ERROR(status); |
444 | 441 |
445 // Complain if we didn't try to run all of the tests. | 442 // Complain if we didn't try to run all of the tests. |
446 if (test_list_index != lines_count) { | 443 if (test_list_index != lines_count) { |
447 fprintf(stderr, "Failed to attempt all the tests!\n"); | 444 fprintf(stderr, "Failed to attempt all the tests!\n"); |
448 fflush(0); | 445 fflush(0); |
449 return -1; | 446 return -1; |
450 } | 447 } |
451 return 0; | 448 return 0; |
452 } | 449 } |
OLD | NEW |