OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <fcntl.h> | 5 #include <fcntl.h> |
6 #include <poll.h> | 6 #include <poll.h> |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
10 #include <sys/time.h> | 10 #include <sys/time.h> |
(...skipping 23 matching lines...) Expand all Loading... |
34 if (task_d != 0 || task_stat.st_nlink < 3) | 34 if (task_d != 0 || task_stat.st_nlink < 3) |
35 return -1; | 35 return -1; |
36 const int num_threads = task_stat.st_nlink - 2; | 36 const int num_threads = task_stat.st_nlink - 2; |
37 return num_threads; | 37 return num_threads; |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 namespace sandbox { | 42 namespace sandbox { |
43 | 43 |
44 bool IsAndroid() { | |
45 #if defined(OS_ANDROID) | |
46 return true; | |
47 #else | |
48 return false; | |
49 #endif | |
50 } | |
51 | |
52 bool IsArchitectureArm() { | |
53 #if defined(ARCH_CPU_ARM_FAMILY) | |
54 return true; | |
55 #else | |
56 return false; | |
57 #endif | |
58 } | |
59 | |
60 // TODO(jln): figure out why base/.../dynamic_annotations.h's | 44 // TODO(jln): figure out why base/.../dynamic_annotations.h's |
61 // RunningOnValgrind() cannot link. | 45 // RunningOnValgrind() cannot link. |
62 bool IsRunningOnValgrind() { return RUNNING_ON_VALGRIND; } | 46 bool IsRunningOnValgrind() { return RUNNING_ON_VALGRIND; } |
63 | 47 |
64 static const int kExpectedValue = 42; | 48 static const int kExpectedValue = 42; |
65 static const int kIgnoreThisTest = 43; | 49 static const int kIgnoreThisTest = 43; |
66 static const int kExitWithAssertionFailure = 1; | 50 static const int kExitWithAssertionFailure = 1; |
67 static const int kExitForTimeout = 2; | 51 static const int kExitForTimeout = 2; |
68 | 52 |
69 static void SigAlrmHandler(int) { | 53 static void SigAlrmHandler(int) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 fflush(stderr); | 236 fflush(stderr); |
253 _exit(kExitWithAssertionFailure); | 237 _exit(kExitWithAssertionFailure); |
254 } | 238 } |
255 | 239 |
256 void UnitTests::IgnoreThisTest() { | 240 void UnitTests::IgnoreThisTest() { |
257 fflush(stderr); | 241 fflush(stderr); |
258 _exit(kIgnoreThisTest); | 242 _exit(kIgnoreThisTest); |
259 } | 243 } |
260 | 244 |
261 } // namespace | 245 } // namespace |
OLD | NEW |