Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "../dumpsys.h" |
| 18 | |
Devin Moore | cfeeda4 | 2020-12-08 12:50:58 -0800 | [diff] [blame] | 19 | #include <regex> |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 20 | #include <vector> |
| 21 | |
| 22 | #include <gmock/gmock.h> |
| 23 | #include <gtest/gtest.h> |
| 24 | |
| 25 | #include <android-base/file.h> |
Devin Moore | cfeeda4 | 2020-12-08 12:50:58 -0800 | [diff] [blame] | 26 | #include <binder/Binder.h> |
| 27 | #include <binder/ProcessState.h> |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 28 | #include <serviceutils/PriorityDumper.h> |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 29 | #include <utils/String16.h> |
Steven Moreland | a0f7f2d | 2017-03-09 22:59:32 -0800 | [diff] [blame] | 30 | #include <utils/String8.h> |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 31 | #include <utils/Vector.h> |
| 32 | |
| 33 | using namespace android; |
| 34 | |
| 35 | using ::testing::_; |
| 36 | using ::testing::Action; |
| 37 | using ::testing::ActionInterface; |
| 38 | using ::testing::DoAll; |
| 39 | using ::testing::Eq; |
| 40 | using ::testing::HasSubstr; |
| 41 | using ::testing::MakeAction; |
Felipe Leme | 5c8a98f | 2017-08-25 13:39:04 -0700 | [diff] [blame] | 42 | using ::testing::Mock; |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 43 | using ::testing::Not; |
| 44 | using ::testing::Return; |
| 45 | using ::testing::StrEq; |
| 46 | using ::testing::Test; |
| 47 | using ::testing::WithArg; |
| 48 | using ::testing::internal::CaptureStderr; |
| 49 | using ::testing::internal::CaptureStdout; |
| 50 | using ::testing::internal::GetCapturedStderr; |
| 51 | using ::testing::internal::GetCapturedStdout; |
| 52 | |
| 53 | class ServiceManagerMock : public IServiceManager { |
| 54 | public: |
| 55 | MOCK_CONST_METHOD1(getService, sp<IBinder>(const String16&)); |
| 56 | MOCK_CONST_METHOD1(checkService, sp<IBinder>(const String16&)); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 57 | MOCK_METHOD4(addService, status_t(const String16&, const sp<IBinder>&, bool, int)); |
| 58 | MOCK_METHOD1(listServices, Vector<String16>(int)); |
Steven Moreland | 1c47b58 | 2019-08-27 18:05:27 -0700 | [diff] [blame] | 59 | MOCK_METHOD1(waitForService, sp<IBinder>(const String16&)); |
Steven Moreland | b82b8f8 | 2019-10-28 10:52:34 -0700 | [diff] [blame] | 60 | MOCK_METHOD1(isDeclared, bool(const String16&)); |
Steven Moreland | 2e293aa | 2020-09-23 00:25:16 +0000 | [diff] [blame] | 61 | MOCK_METHOD1(getDeclaredInstances, Vector<String16>(const String16&)); |
Steven Moreland | edd4e07 | 2021-04-21 00:27:29 +0000 | [diff] [blame] | 62 | MOCK_METHOD1(updatableViaApex, std::optional<String16>(const String16&)); |
Jooyung Han | 76944fe | 2022-10-25 17:02:45 +0900 | [diff] [blame] | 63 | MOCK_METHOD1(getUpdatableNames, Vector<String16>(const String16&)); |
Devin Moore | 5e4c2f1 | 2021-09-09 22:36:33 +0000 | [diff] [blame] | 64 | MOCK_METHOD1(getConnectionInfo, std::optional<ConnectionInfo>(const String16&)); |
Jayant Chowdhary | 3070094 | 2022-01-31 14:12:40 -0800 | [diff] [blame] | 65 | MOCK_METHOD2(registerForNotifications, status_t(const String16&, |
| 66 | const sp<LocalRegistrationCallback>&)); |
| 67 | MOCK_METHOD2(unregisterForNotifications, status_t(const String16&, |
| 68 | const sp<LocalRegistrationCallback>&)); |
Jayant Chowdhary | a0a8eb2 | 2022-05-20 03:30:09 +0000 | [diff] [blame] | 69 | MOCK_METHOD0(getServiceDebugInfo, std::vector<ServiceDebugInfo>()); |
Parth Sane | dc20754 | 2024-11-14 11:49:08 +0000 | [diff] [blame] | 70 | MOCK_METHOD1(enableAddServiceCache, void(bool)); |
| 71 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 72 | protected: |
| 73 | MOCK_METHOD0(onAsBinder, IBinder*()); |
| 74 | }; |
| 75 | |
| 76 | class BinderMock : public BBinder { |
| 77 | public: |
| 78 | BinderMock() { |
| 79 | } |
| 80 | |
| 81 | MOCK_METHOD2(dump, status_t(int, const Vector<String16>&)); |
| 82 | }; |
| 83 | |
| 84 | // gmock black magic to provide a WithArg<0>(WriteOnFd(output)) matcher |
| 85 | typedef void WriteOnFdFunction(int); |
| 86 | |
| 87 | class WriteOnFdAction : public ActionInterface<WriteOnFdFunction> { |
| 88 | public: |
| 89 | explicit WriteOnFdAction(const std::string& output) : output_(output) { |
| 90 | } |
| 91 | virtual Result Perform(const ArgumentTuple& args) { |
Haibo Huang | 21f3655 | 2018-07-10 19:48:18 -0700 | [diff] [blame] | 92 | int fd = ::testing::get<0>(args); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 93 | android::base::WriteStringToFd(output_, fd); |
| 94 | } |
| 95 | |
| 96 | private: |
| 97 | std::string output_; |
| 98 | }; |
| 99 | |
| 100 | // Matcher used to emulate dump() by writing on its file descriptor. |
| 101 | Action<WriteOnFdFunction> WriteOnFd(const std::string& output) { |
| 102 | return MakeAction(new WriteOnFdAction(output)); |
| 103 | } |
| 104 | |
| 105 | // Matcher for args using Android's Vector<String16> format |
| 106 | // TODO: move it to some common testing library |
| 107 | MATCHER_P(AndroidElementsAre, expected, "") { |
| 108 | std::ostringstream errors; |
| 109 | if (arg.size() != expected.size()) { |
| 110 | errors << " sizes do not match (expected " << expected.size() << ", got " << arg.size() |
| 111 | << ")\n"; |
| 112 | } |
| 113 | int i = 0; |
| 114 | std::ostringstream actual_stream, expected_stream; |
Chih-Hung Hsieh | cb057c2 | 2017-08-03 15:48:25 -0700 | [diff] [blame] | 115 | for (const String16& actual : arg) { |
Steven Moreland | a0f7f2d | 2017-03-09 22:59:32 -0800 | [diff] [blame] | 116 | std::string actual_str = String8(actual).c_str(); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 117 | std::string expected_str = expected[i]; |
| 118 | actual_stream << "'" << actual_str << "' "; |
| 119 | expected_stream << "'" << expected_str << "' "; |
| 120 | if (actual_str != expected_str) { |
| 121 | errors << " element mismatch at index " << i << "\n"; |
| 122 | } |
| 123 | i++; |
| 124 | } |
| 125 | |
| 126 | if (!errors.str().empty()) { |
| 127 | errors << "\nExpected args: " << expected_stream.str() |
| 128 | << "\nActual args: " << actual_stream.str(); |
| 129 | *result_listener << errors.str(); |
| 130 | return false; |
| 131 | } |
| 132 | return true; |
| 133 | } |
| 134 | |
| 135 | // Custom action to sleep for timeout seconds |
| 136 | ACTION_P(Sleep, timeout) { |
| 137 | sleep(timeout); |
| 138 | } |
| 139 | |
| 140 | class DumpsysTest : public Test { |
| 141 | public: |
Steven Moreland | 2c3cd83 | 2017-02-13 23:44:17 +0000 | [diff] [blame] | 142 | DumpsysTest() : sm_(), dump_(&sm_), stdout_(), stderr_() { |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | void ExpectListServices(std::vector<std::string> services) { |
| 146 | Vector<String16> services16; |
| 147 | for (auto& service : services) { |
| 148 | services16.add(String16(service.c_str())); |
| 149 | } |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 150 | EXPECT_CALL(sm_, listServices(IServiceManager::DUMP_FLAG_PRIORITY_ALL)) |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 151 | .WillRepeatedly(Return(services16)); |
| 152 | } |
| 153 | |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 154 | void ExpectListServicesWithPriority(std::vector<std::string> services, int dumpFlags) { |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 155 | Vector<String16> services16; |
| 156 | for (auto& service : services) { |
| 157 | services16.add(String16(service.c_str())); |
| 158 | } |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 159 | EXPECT_CALL(sm_, listServices(dumpFlags)).WillRepeatedly(Return(services16)); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | sp<BinderMock> ExpectCheckService(const char* name, bool running = true) { |
| 163 | sp<BinderMock> binder_mock; |
| 164 | if (running) { |
| 165 | binder_mock = new BinderMock; |
| 166 | } |
| 167 | EXPECT_CALL(sm_, checkService(String16(name))).WillRepeatedly(Return(binder_mock)); |
| 168 | return binder_mock; |
| 169 | } |
| 170 | |
| 171 | void ExpectDump(const char* name, const std::string& output) { |
| 172 | sp<BinderMock> binder_mock = ExpectCheckService(name); |
| 173 | EXPECT_CALL(*binder_mock, dump(_, _)) |
| 174 | .WillRepeatedly(DoAll(WithArg<0>(WriteOnFd(output)), Return(0))); |
| 175 | } |
| 176 | |
| 177 | void ExpectDumpWithArgs(const char* name, std::vector<std::string> args, |
| 178 | const std::string& output) { |
| 179 | sp<BinderMock> binder_mock = ExpectCheckService(name); |
| 180 | EXPECT_CALL(*binder_mock, dump(_, AndroidElementsAre(args))) |
| 181 | .WillRepeatedly(DoAll(WithArg<0>(WriteOnFd(output)), Return(0))); |
| 182 | } |
| 183 | |
Felipe Leme | 5c8a98f | 2017-08-25 13:39:04 -0700 | [diff] [blame] | 184 | sp<BinderMock> ExpectDumpAndHang(const char* name, int timeout_s, const std::string& output) { |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 185 | sp<BinderMock> binder_mock = ExpectCheckService(name); |
| 186 | EXPECT_CALL(*binder_mock, dump(_, _)) |
| 187 | .WillRepeatedly(DoAll(Sleep(timeout_s), WithArg<0>(WriteOnFd(output)), Return(0))); |
Felipe Leme | 5c8a98f | 2017-08-25 13:39:04 -0700 | [diff] [blame] | 188 | return binder_mock; |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | void CallMain(const std::vector<std::string>& args) { |
| 192 | const char* argv[1024] = {"/some/virtual/dir/dumpsys"}; |
| 193 | int argc = (int)args.size() + 1; |
| 194 | int i = 1; |
| 195 | for (const std::string& arg : args) { |
| 196 | argv[i++] = arg.c_str(); |
| 197 | } |
| 198 | CaptureStdout(); |
| 199 | CaptureStderr(); |
| 200 | int status = dump_.main(argc, const_cast<char**>(argv)); |
| 201 | stdout_ = GetCapturedStdout(); |
| 202 | stderr_ = GetCapturedStderr(); |
| 203 | EXPECT_THAT(status, Eq(0)); |
| 204 | } |
| 205 | |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 206 | void CallSingleService(const String16& serviceName, Vector<String16>& args, int priorityFlags, |
| 207 | bool supportsProto, std::chrono::duration<double>& elapsedDuration, |
| 208 | size_t& bytesWritten) { |
| 209 | CaptureStdout(); |
| 210 | CaptureStderr(); |
| 211 | dump_.setServiceArgs(args, supportsProto, priorityFlags); |
Steven Moreland | cbd69fc | 2021-07-20 20:45:43 +0000 | [diff] [blame] | 212 | status_t status = dump_.startDumpThread(Dumpsys::TYPE_DUMP, serviceName, args); |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 213 | EXPECT_THAT(status, Eq(0)); |
| 214 | status = dump_.writeDump(STDOUT_FILENO, serviceName, std::chrono::milliseconds(500), false, |
| 215 | elapsedDuration, bytesWritten); |
| 216 | EXPECT_THAT(status, Eq(0)); |
| 217 | dump_.stopDumpThread(/* dumpCompleted = */ true); |
| 218 | stdout_ = GetCapturedStdout(); |
| 219 | stderr_ = GetCapturedStderr(); |
| 220 | } |
| 221 | |
Steven Moreland | 2c3cd83 | 2017-02-13 23:44:17 +0000 | [diff] [blame] | 222 | void AssertRunningServices(const std::vector<std::string>& services) { |
Steven Moreland | 31dac35 | 2020-03-05 09:46:45 -0800 | [diff] [blame] | 223 | std::string expected = "Currently running services:\n"; |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 224 | for (const std::string& service : services) { |
| 225 | expected.append(" ").append(service).append("\n"); |
| 226 | } |
| 227 | EXPECT_THAT(stdout_, HasSubstr(expected)); |
| 228 | } |
| 229 | |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 230 | void AssertOutput(const std::string& expected) { |
| 231 | EXPECT_THAT(stdout_, StrEq(expected)); |
| 232 | } |
| 233 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 234 | void AssertOutputContains(const std::string& expected) { |
| 235 | EXPECT_THAT(stdout_, HasSubstr(expected)); |
| 236 | } |
| 237 | |
Devin Moore | cfeeda4 | 2020-12-08 12:50:58 -0800 | [diff] [blame] | 238 | void AssertOutputFormat(const std::string format) { |
| 239 | EXPECT_THAT(stdout_, testing::MatchesRegex(format)); |
| 240 | } |
| 241 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 242 | void AssertDumped(const std::string& service, const std::string& dump) { |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 243 | EXPECT_THAT(stdout_, HasSubstr("DUMP OF SERVICE " + service + ":\n" + dump)); |
Vishnu Nair | e4f6174 | 2017-12-21 08:30:28 -0800 | [diff] [blame] | 244 | EXPECT_THAT(stdout_, HasSubstr("was the duration of dumpsys " + service + ", ending at: ")); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 245 | } |
| 246 | |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 247 | void AssertDumpedWithPriority(const std::string& service, const std::string& dump, |
| 248 | const char16_t* priorityType) { |
| 249 | std::string priority = String8(priorityType).c_str(); |
| 250 | EXPECT_THAT(stdout_, |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 251 | HasSubstr("DUMP OF SERVICE " + priority + " " + service + ":\n" + dump)); |
Vishnu Nair | e4f6174 | 2017-12-21 08:30:28 -0800 | [diff] [blame] | 252 | EXPECT_THAT(stdout_, HasSubstr("was the duration of dumpsys " + service + ", ending at: ")); |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 253 | } |
| 254 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 255 | void AssertNotDumped(const std::string& dump) { |
| 256 | EXPECT_THAT(stdout_, Not(HasSubstr(dump))); |
| 257 | } |
| 258 | |
| 259 | void AssertStopped(const std::string& service) { |
| 260 | EXPECT_THAT(stderr_, HasSubstr("Can't find service: " + service + "\n")); |
| 261 | } |
| 262 | |
| 263 | ServiceManagerMock sm_; |
| 264 | Dumpsys dump_; |
| 265 | |
| 266 | private: |
| 267 | std::string stdout_, stderr_; |
| 268 | }; |
| 269 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 270 | // Tests 'dumpsys -l' when all services are running |
| 271 | TEST_F(DumpsysTest, ListAllServices) { |
| 272 | ExpectListServices({"Locksmith", "Valet"}); |
| 273 | ExpectCheckService("Locksmith"); |
| 274 | ExpectCheckService("Valet"); |
| 275 | |
| 276 | CallMain({"-l"}); |
| 277 | |
| 278 | AssertRunningServices({"Locksmith", "Valet"}); |
| 279 | } |
| 280 | |
Steven Moreland | 31dac35 | 2020-03-05 09:46:45 -0800 | [diff] [blame] | 281 | TEST_F(DumpsysTest, ListServicesOneRegistered) { |
| 282 | ExpectListServices({"Locksmith"}); |
| 283 | ExpectCheckService("Locksmith"); |
| 284 | |
| 285 | CallMain({"-l"}); |
| 286 | |
| 287 | AssertRunningServices({"Locksmith"}); |
| 288 | } |
| 289 | |
| 290 | TEST_F(DumpsysTest, ListServicesEmpty) { |
| 291 | CallMain({"-l"}); |
| 292 | |
| 293 | AssertRunningServices({}); |
| 294 | } |
| 295 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 296 | // Tests 'dumpsys -l' when a service is not running |
| 297 | TEST_F(DumpsysTest, ListRunningServices) { |
| 298 | ExpectListServices({"Locksmith", "Valet"}); |
| 299 | ExpectCheckService("Locksmith"); |
| 300 | ExpectCheckService("Valet", false); |
| 301 | |
| 302 | CallMain({"-l"}); |
| 303 | |
| 304 | AssertRunningServices({"Locksmith"}); |
| 305 | AssertNotDumped({"Valet"}); |
| 306 | } |
| 307 | |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 308 | // Tests 'dumpsys -l --priority HIGH' |
| 309 | TEST_F(DumpsysTest, ListAllServicesWithPriority) { |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 310 | ExpectListServicesWithPriority({"Locksmith", "Valet"}, IServiceManager::DUMP_FLAG_PRIORITY_HIGH); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 311 | ExpectCheckService("Locksmith"); |
| 312 | ExpectCheckService("Valet"); |
| 313 | |
| 314 | CallMain({"-l", "--priority", "HIGH"}); |
| 315 | |
| 316 | AssertRunningServices({"Locksmith", "Valet"}); |
| 317 | } |
| 318 | |
| 319 | // Tests 'dumpsys -l --priority HIGH' with and empty list |
| 320 | TEST_F(DumpsysTest, ListEmptyServicesWithPriority) { |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 321 | ExpectListServicesWithPriority({}, IServiceManager::DUMP_FLAG_PRIORITY_HIGH); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 322 | |
| 323 | CallMain({"-l", "--priority", "HIGH"}); |
| 324 | |
| 325 | AssertRunningServices({}); |
| 326 | } |
| 327 | |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 328 | // Tests 'dumpsys -l --proto' |
| 329 | TEST_F(DumpsysTest, ListAllServicesWithProto) { |
| 330 | ExpectListServicesWithPriority({"Locksmith", "Valet", "Car"}, |
| 331 | IServiceManager::DUMP_FLAG_PRIORITY_ALL); |
| 332 | ExpectListServicesWithPriority({"Valet", "Car"}, IServiceManager::DUMP_FLAG_PROTO); |
| 333 | ExpectCheckService("Car"); |
| 334 | ExpectCheckService("Valet"); |
| 335 | |
| 336 | CallMain({"-l", "--proto"}); |
| 337 | |
| 338 | AssertRunningServices({"Car", "Valet"}); |
| 339 | } |
| 340 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 341 | // Tests 'dumpsys service_name' on a service is running |
| 342 | TEST_F(DumpsysTest, DumpRunningService) { |
| 343 | ExpectDump("Valet", "Here's your car"); |
| 344 | |
| 345 | CallMain({"Valet"}); |
| 346 | |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 347 | AssertOutput("Here's your car"); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | // Tests 'dumpsys -t 1 service_name' on a service that times out after 2s |
Vishnu Nair | 6921f80 | 2017-11-22 09:17:23 -0800 | [diff] [blame] | 351 | TEST_F(DumpsysTest, DumpRunningServiceTimeoutInSec) { |
Felipe Leme | 5c8a98f | 2017-08-25 13:39:04 -0700 | [diff] [blame] | 352 | sp<BinderMock> binder_mock = ExpectDumpAndHang("Valet", 2, "Here's your car"); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 353 | |
| 354 | CallMain({"-t", "1", "Valet"}); |
| 355 | |
Vishnu Nair | 6921f80 | 2017-11-22 09:17:23 -0800 | [diff] [blame] | 356 | AssertOutputContains("SERVICE 'Valet' DUMP TIMEOUT (1000ms) EXPIRED"); |
| 357 | AssertNotDumped("Here's your car"); |
| 358 | |
| 359 | // TODO(b/65056227): BinderMock is not destructed because thread is detached on dumpsys.cpp |
| 360 | Mock::AllowLeak(binder_mock.get()); |
| 361 | } |
| 362 | |
| 363 | // Tests 'dumpsys -T 500 service_name' on a service that times out after 2s |
| 364 | TEST_F(DumpsysTest, DumpRunningServiceTimeoutInMs) { |
| 365 | sp<BinderMock> binder_mock = ExpectDumpAndHang("Valet", 2, "Here's your car"); |
| 366 | |
| 367 | CallMain({"-T", "500", "Valet"}); |
| 368 | |
| 369 | AssertOutputContains("SERVICE 'Valet' DUMP TIMEOUT (500ms) EXPIRED"); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 370 | AssertNotDumped("Here's your car"); |
| 371 | |
Felipe Leme | 5c8a98f | 2017-08-25 13:39:04 -0700 | [diff] [blame] | 372 | // TODO(b/65056227): BinderMock is not destructed because thread is detached on dumpsys.cpp |
| 373 | Mock::AllowLeak(binder_mock.get()); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | // Tests 'dumpsys service_name Y U NO HAVE ARGS' on a service that is running |
| 377 | TEST_F(DumpsysTest, DumpWithArgsRunningService) { |
| 378 | ExpectDumpWithArgs("SERVICE", {"Y", "U", "NO", "HANDLE", "ARGS"}, "I DO!"); |
| 379 | |
| 380 | CallMain({"SERVICE", "Y", "U", "NO", "HANDLE", "ARGS"}); |
| 381 | |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 382 | AssertOutput("I DO!"); |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 383 | } |
| 384 | |
Vishnu Nair | 64afc02 | 2018-02-01 15:29:34 -0800 | [diff] [blame] | 385 | // Tests dumpsys passes the -a flag when called on all services |
| 386 | TEST_F(DumpsysTest, PassAllFlagsToServices) { |
| 387 | ExpectListServices({"Locksmith", "Valet"}); |
| 388 | ExpectCheckService("Locksmith"); |
| 389 | ExpectCheckService("Valet"); |
| 390 | ExpectDumpWithArgs("Locksmith", {"-a"}, "dumped1"); |
| 391 | ExpectDumpWithArgs("Valet", {"-a"}, "dumped2"); |
| 392 | |
| 393 | CallMain({"-T", "500"}); |
| 394 | |
| 395 | AssertDumped("Locksmith", "dumped1"); |
| 396 | AssertDumped("Valet", "dumped2"); |
| 397 | } |
| 398 | |
| 399 | // Tests dumpsys passes the -a flag when called on NORMAL priority services |
| 400 | TEST_F(DumpsysTest, PassAllFlagsToNormalServices) { |
| 401 | ExpectListServicesWithPriority({"Locksmith", "Valet"}, |
| 402 | IServiceManager::DUMP_FLAG_PRIORITY_NORMAL); |
| 403 | ExpectCheckService("Locksmith"); |
| 404 | ExpectCheckService("Valet"); |
Vishnu Nair | 3919e1c | 2018-05-01 17:01:00 -0700 | [diff] [blame] | 405 | ExpectDumpWithArgs("Locksmith", {"--dump-priority", "NORMAL", "-a"}, "dump1"); |
| 406 | ExpectDumpWithArgs("Valet", {"--dump-priority", "NORMAL", "-a"}, "dump2"); |
Vishnu Nair | 64afc02 | 2018-02-01 15:29:34 -0800 | [diff] [blame] | 407 | |
| 408 | CallMain({"--priority", "NORMAL"}); |
| 409 | |
| 410 | AssertDumped("Locksmith", "dump1"); |
| 411 | AssertDumped("Valet", "dump2"); |
| 412 | } |
| 413 | |
| 414 | // Tests dumpsys passes only priority flags when called on CRITICAL priority services |
| 415 | TEST_F(DumpsysTest, PassPriorityFlagsToCriticalServices) { |
| 416 | ExpectListServicesWithPriority({"Locksmith", "Valet"}, |
| 417 | IServiceManager::DUMP_FLAG_PRIORITY_CRITICAL); |
| 418 | ExpectCheckService("Locksmith"); |
| 419 | ExpectCheckService("Valet"); |
| 420 | ExpectDumpWithArgs("Locksmith", {"--dump-priority", "CRITICAL"}, "dump1"); |
| 421 | ExpectDumpWithArgs("Valet", {"--dump-priority", "CRITICAL"}, "dump2"); |
| 422 | |
| 423 | CallMain({"--priority", "CRITICAL"}); |
| 424 | |
| 425 | AssertDumpedWithPriority("Locksmith", "dump1", PriorityDumper::PRIORITY_ARG_CRITICAL); |
| 426 | AssertDumpedWithPriority("Valet", "dump2", PriorityDumper::PRIORITY_ARG_CRITICAL); |
| 427 | } |
| 428 | |
| 429 | // Tests dumpsys passes only priority flags when called on HIGH priority services |
| 430 | TEST_F(DumpsysTest, PassPriorityFlagsToHighServices) { |
| 431 | ExpectListServicesWithPriority({"Locksmith", "Valet"}, |
| 432 | IServiceManager::DUMP_FLAG_PRIORITY_HIGH); |
| 433 | ExpectCheckService("Locksmith"); |
| 434 | ExpectCheckService("Valet"); |
| 435 | ExpectDumpWithArgs("Locksmith", {"--dump-priority", "HIGH"}, "dump1"); |
| 436 | ExpectDumpWithArgs("Valet", {"--dump-priority", "HIGH"}, "dump2"); |
| 437 | |
| 438 | CallMain({"--priority", "HIGH"}); |
| 439 | |
| 440 | AssertDumpedWithPriority("Locksmith", "dump1", PriorityDumper::PRIORITY_ARG_HIGH); |
| 441 | AssertDumpedWithPriority("Valet", "dump2", PriorityDumper::PRIORITY_ARG_HIGH); |
| 442 | } |
| 443 | |
Felipe Leme | 343175a | 2016-08-02 18:57:37 -0700 | [diff] [blame] | 444 | // Tests 'dumpsys' with no arguments |
| 445 | TEST_F(DumpsysTest, DumpMultipleServices) { |
| 446 | ExpectListServices({"running1", "stopped2", "running3"}); |
| 447 | ExpectDump("running1", "dump1"); |
| 448 | ExpectCheckService("stopped2", false); |
| 449 | ExpectDump("running3", "dump3"); |
| 450 | |
| 451 | CallMain({}); |
| 452 | |
| 453 | AssertRunningServices({"running1", "running3"}); |
| 454 | AssertDumped("running1", "dump1"); |
| 455 | AssertStopped("stopped2"); |
| 456 | AssertDumped("running3", "dump3"); |
| 457 | } |
| 458 | |
| 459 | // Tests 'dumpsys --skip skipped3 skipped5', which should skip these services |
| 460 | TEST_F(DumpsysTest, DumpWithSkip) { |
| 461 | ExpectListServices({"running1", "stopped2", "skipped3", "running4", "skipped5"}); |
| 462 | ExpectDump("running1", "dump1"); |
| 463 | ExpectCheckService("stopped2", false); |
| 464 | ExpectDump("skipped3", "dump3"); |
| 465 | ExpectDump("running4", "dump4"); |
| 466 | ExpectDump("skipped5", "dump5"); |
| 467 | |
| 468 | CallMain({"--skip", "skipped3", "skipped5"}); |
| 469 | |
| 470 | AssertRunningServices({"running1", "running4", "skipped3 (skipped)", "skipped5 (skipped)"}); |
| 471 | AssertDumped("running1", "dump1"); |
| 472 | AssertDumped("running4", "dump4"); |
| 473 | AssertStopped("stopped2"); |
| 474 | AssertNotDumped("dump3"); |
| 475 | AssertNotDumped("dump5"); |
| 476 | } |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 477 | |
| 478 | // Tests 'dumpsys --skip skipped3 skipped5 --priority CRITICAL', which should skip these services |
| 479 | TEST_F(DumpsysTest, DumpWithSkipAndPriority) { |
| 480 | ExpectListServicesWithPriority({"running1", "stopped2", "skipped3", "running4", "skipped5"}, |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 481 | IServiceManager::DUMP_FLAG_PRIORITY_CRITICAL); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 482 | ExpectDump("running1", "dump1"); |
| 483 | ExpectCheckService("stopped2", false); |
| 484 | ExpectDump("skipped3", "dump3"); |
| 485 | ExpectDump("running4", "dump4"); |
| 486 | ExpectDump("skipped5", "dump5"); |
| 487 | |
| 488 | CallMain({"--priority", "CRITICAL", "--skip", "skipped3", "skipped5"}); |
| 489 | |
| 490 | AssertRunningServices({"running1", "running4", "skipped3 (skipped)", "skipped5 (skipped)"}); |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 491 | AssertDumpedWithPriority("running1", "dump1", PriorityDumper::PRIORITY_ARG_CRITICAL); |
| 492 | AssertDumpedWithPriority("running4", "dump4", PriorityDumper::PRIORITY_ARG_CRITICAL); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 493 | AssertStopped("stopped2"); |
| 494 | AssertNotDumped("dump3"); |
| 495 | AssertNotDumped("dump5"); |
| 496 | } |
| 497 | |
| 498 | // Tests 'dumpsys --priority CRITICAL' |
| 499 | TEST_F(DumpsysTest, DumpWithPriorityCritical) { |
| 500 | ExpectListServicesWithPriority({"runningcritical1", "runningcritical2"}, |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 501 | IServiceManager::DUMP_FLAG_PRIORITY_CRITICAL); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 502 | ExpectDump("runningcritical1", "dump1"); |
| 503 | ExpectDump("runningcritical2", "dump2"); |
| 504 | |
| 505 | CallMain({"--priority", "CRITICAL"}); |
| 506 | |
| 507 | AssertRunningServices({"runningcritical1", "runningcritical2"}); |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 508 | AssertDumpedWithPriority("runningcritical1", "dump1", PriorityDumper::PRIORITY_ARG_CRITICAL); |
| 509 | AssertDumpedWithPriority("runningcritical2", "dump2", PriorityDumper::PRIORITY_ARG_CRITICAL); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 510 | } |
| 511 | |
| 512 | // Tests 'dumpsys --priority HIGH' |
| 513 | TEST_F(DumpsysTest, DumpWithPriorityHigh) { |
| 514 | ExpectListServicesWithPriority({"runninghigh1", "runninghigh2"}, |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 515 | IServiceManager::DUMP_FLAG_PRIORITY_HIGH); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 516 | ExpectDump("runninghigh1", "dump1"); |
| 517 | ExpectDump("runninghigh2", "dump2"); |
| 518 | |
| 519 | CallMain({"--priority", "HIGH"}); |
| 520 | |
| 521 | AssertRunningServices({"runninghigh1", "runninghigh2"}); |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 522 | AssertDumpedWithPriority("runninghigh1", "dump1", PriorityDumper::PRIORITY_ARG_HIGH); |
| 523 | AssertDumpedWithPriority("runninghigh2", "dump2", PriorityDumper::PRIORITY_ARG_HIGH); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | // Tests 'dumpsys --priority NORMAL' |
| 527 | TEST_F(DumpsysTest, DumpWithPriorityNormal) { |
| 528 | ExpectListServicesWithPriority({"runningnormal1", "runningnormal2"}, |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 529 | IServiceManager::DUMP_FLAG_PRIORITY_NORMAL); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 530 | ExpectDump("runningnormal1", "dump1"); |
| 531 | ExpectDump("runningnormal2", "dump2"); |
| 532 | |
| 533 | CallMain({"--priority", "NORMAL"}); |
| 534 | |
| 535 | AssertRunningServices({"runningnormal1", "runningnormal2"}); |
Vishnu Nair | e4f6174 | 2017-12-21 08:30:28 -0800 | [diff] [blame] | 536 | AssertDumped("runningnormal1", "dump1"); |
| 537 | AssertDumped("runningnormal2", "dump2"); |
Vishnu Nair | 6a40853 | 2017-10-24 09:11:27 -0700 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | // Tests 'dumpsys --proto' |
| 541 | TEST_F(DumpsysTest, DumpWithProto) { |
| 542 | ExpectListServicesWithPriority({"run8", "run1", "run2", "run5"}, |
| 543 | IServiceManager::DUMP_FLAG_PRIORITY_ALL); |
| 544 | ExpectListServicesWithPriority({"run3", "run2", "run4", "run8"}, |
| 545 | IServiceManager::DUMP_FLAG_PROTO); |
| 546 | ExpectDump("run2", "dump1"); |
| 547 | ExpectDump("run8", "dump2"); |
| 548 | |
| 549 | CallMain({"--proto"}); |
| 550 | |
| 551 | AssertRunningServices({"run2", "run8"}); |
| 552 | AssertDumped("run2", "dump1"); |
| 553 | AssertDumped("run8", "dump2"); |
| 554 | } |
| 555 | |
| 556 | // Tests 'dumpsys --priority HIGH --proto' |
| 557 | TEST_F(DumpsysTest, DumpWithPriorityHighAndProto) { |
| 558 | ExpectListServicesWithPriority({"runninghigh1", "runninghigh2"}, |
| 559 | IServiceManager::DUMP_FLAG_PRIORITY_HIGH); |
| 560 | ExpectListServicesWithPriority({"runninghigh1", "runninghigh2", "runninghigh3"}, |
| 561 | IServiceManager::DUMP_FLAG_PROTO); |
| 562 | |
| 563 | ExpectDump("runninghigh1", "dump1"); |
| 564 | ExpectDump("runninghigh2", "dump2"); |
| 565 | |
| 566 | CallMain({"--priority", "HIGH", "--proto"}); |
| 567 | |
| 568 | AssertRunningServices({"runninghigh1", "runninghigh2"}); |
| 569 | AssertDumpedWithPriority("runninghigh1", "dump1", PriorityDumper::PRIORITY_ARG_HIGH); |
| 570 | AssertDumpedWithPriority("runninghigh2", "dump2", PriorityDumper::PRIORITY_ARG_HIGH); |
Vishnu Nair | f56042d | 2017-09-19 15:25:10 -0700 | [diff] [blame] | 571 | } |
Vishnu Nair | e4f6174 | 2017-12-21 08:30:28 -0800 | [diff] [blame] | 572 | |
Steven Moreland | 5a30d34 | 2019-10-08 13:53:28 -0700 | [diff] [blame] | 573 | // Tests 'dumpsys --pid' |
| 574 | TEST_F(DumpsysTest, ListAllServicesWithPid) { |
| 575 | ExpectListServices({"Locksmith", "Valet"}); |
| 576 | ExpectCheckService("Locksmith"); |
| 577 | ExpectCheckService("Valet"); |
| 578 | |
| 579 | CallMain({"--pid"}); |
| 580 | |
| 581 | AssertRunningServices({"Locksmith", "Valet"}); |
| 582 | AssertOutputContains(std::to_string(getpid())); |
| 583 | } |
| 584 | |
| 585 | // Tests 'dumpsys --pid service_name' |
| 586 | TEST_F(DumpsysTest, ListServiceWithPid) { |
| 587 | ExpectCheckService("Locksmith"); |
| 588 | |
| 589 | CallMain({"--pid", "Locksmith"}); |
| 590 | |
| 591 | AssertOutput(std::to_string(getpid()) + "\n"); |
| 592 | } |
| 593 | |
Steven Moreland | e5a6a87 | 2021-05-19 22:11:37 +0000 | [diff] [blame] | 594 | // Tests 'dumpsys --stability' |
| 595 | TEST_F(DumpsysTest, ListAllServicesWithStability) { |
| 596 | ExpectListServices({"Locksmith", "Valet"}); |
| 597 | ExpectCheckService("Locksmith"); |
| 598 | ExpectCheckService("Valet"); |
| 599 | |
| 600 | CallMain({"--stability"}); |
| 601 | |
| 602 | AssertRunningServices({"Locksmith", "Valet"}); |
| 603 | AssertOutputContains("stability"); |
| 604 | } |
| 605 | |
| 606 | // Tests 'dumpsys --stability service_name' |
| 607 | TEST_F(DumpsysTest, ListServiceWithStability) { |
| 608 | ExpectCheckService("Locksmith"); |
| 609 | |
| 610 | CallMain({"--stability", "Locksmith"}); |
| 611 | |
| 612 | AssertOutputContains("stability"); |
| 613 | } |
| 614 | |
Devin Moore | cfeeda4 | 2020-12-08 12:50:58 -0800 | [diff] [blame] | 615 | // Tests 'dumpsys --thread' |
| 616 | TEST_F(DumpsysTest, ListAllServicesWithThread) { |
| 617 | ExpectListServices({"Locksmith", "Valet"}); |
| 618 | ExpectCheckService("Locksmith"); |
| 619 | ExpectCheckService("Valet"); |
| 620 | |
| 621 | CallMain({"--thread"}); |
| 622 | |
| 623 | AssertRunningServices({"Locksmith", "Valet"}); |
| 624 | |
| 625 | const std::string format("(.|\n)*((Threads in use: [0-9]+/[0-9]+)?\n-(.|\n)*){2}"); |
| 626 | AssertOutputFormat(format); |
| 627 | } |
| 628 | |
| 629 | // Tests 'dumpsys --thread service_name' |
| 630 | TEST_F(DumpsysTest, ListServiceWithThread) { |
| 631 | ExpectCheckService("Locksmith"); |
| 632 | |
| 633 | CallMain({"--thread", "Locksmith"}); |
| 634 | // returns an empty string without root enabled |
| 635 | const std::string format("(^$|Threads in use: [0-9]/[0-9]+\n)"); |
| 636 | AssertOutputFormat(format); |
| 637 | } |
| 638 | |
Devin Moore | def9fae | 2021-08-05 19:05:45 +0000 | [diff] [blame] | 639 | // Tests 'dumpsys --clients' |
| 640 | TEST_F(DumpsysTest, ListAllServicesWithClients) { |
| 641 | ExpectListServices({"Locksmith", "Valet"}); |
| 642 | ExpectCheckService("Locksmith"); |
| 643 | ExpectCheckService("Valet"); |
| 644 | |
| 645 | CallMain({"--clients"}); |
| 646 | |
| 647 | AssertRunningServices({"Locksmith", "Valet"}); |
| 648 | |
| 649 | const std::string format("(.|\n)*((Client PIDs are not available for local binders.)(.|\n)*){2}"); |
| 650 | AssertOutputFormat(format); |
| 651 | } |
| 652 | |
| 653 | // Tests 'dumpsys --clients service_name' |
| 654 | TEST_F(DumpsysTest, ListServiceWithClients) { |
| 655 | ExpectCheckService("Locksmith"); |
| 656 | |
| 657 | CallMain({"--clients", "Locksmith"}); |
| 658 | |
| 659 | const std::string format("Client PIDs are not available for local binders.\n"); |
| 660 | AssertOutputFormat(format); |
| 661 | } |
Steven Moreland | cbd69fc | 2021-07-20 20:45:43 +0000 | [diff] [blame] | 662 | // Tests 'dumpsys --thread --stability' |
| 663 | TEST_F(DumpsysTest, ListAllServicesWithMultipleOptions) { |
| 664 | ExpectListServices({"Locksmith", "Valet"}); |
| 665 | ExpectCheckService("Locksmith"); |
| 666 | ExpectCheckService("Valet"); |
| 667 | |
| 668 | CallMain({"--pid", "--stability"}); |
| 669 | AssertRunningServices({"Locksmith", "Valet"}); |
| 670 | |
| 671 | AssertOutputContains(std::to_string(getpid())); |
| 672 | AssertOutputContains("stability"); |
| 673 | } |
| 674 | |
| 675 | // Tests 'dumpsys --pid --stability service_name' |
| 676 | TEST_F(DumpsysTest, ListServiceWithMultipleOptions) { |
| 677 | ExpectCheckService("Locksmith"); |
| 678 | CallMain({"--pid", "--stability", "Locksmith"}); |
| 679 | |
| 680 | AssertOutputContains(std::to_string(getpid())); |
| 681 | AssertOutputContains("stability"); |
| 682 | } |
| 683 | |
Steven Moreland | a6ddb9a | 2019-09-27 16:41:02 +0000 | [diff] [blame] | 684 | TEST_F(DumpsysTest, GetBytesWritten) { |
| 685 | const char* serviceName = "service2"; |
| 686 | const char* dumpContents = "dump1"; |
| 687 | ExpectDump(serviceName, dumpContents); |
| 688 | |
| 689 | String16 service(serviceName); |
| 690 | Vector<String16> args; |
| 691 | std::chrono::duration<double> elapsedDuration; |
| 692 | size_t bytesWritten; |
| 693 | |
| 694 | CallSingleService(service, args, IServiceManager::DUMP_FLAG_PRIORITY_ALL, |
| 695 | /* as_proto = */ false, elapsedDuration, bytesWritten); |
| 696 | |
| 697 | AssertOutput(dumpContents); |
| 698 | EXPECT_THAT(bytesWritten, Eq(strlen(dumpContents))); |
| 699 | } |
| 700 | |
Vishnu Nair | e4f6174 | 2017-12-21 08:30:28 -0800 | [diff] [blame] | 701 | TEST_F(DumpsysTest, WriteDumpWithoutThreadStart) { |
| 702 | std::chrono::duration<double> elapsedDuration; |
| 703 | size_t bytesWritten; |
| 704 | status_t status = |
| 705 | dump_.writeDump(STDOUT_FILENO, String16("service"), std::chrono::milliseconds(500), |
| 706 | /* as_proto = */ false, elapsedDuration, bytesWritten); |
| 707 | EXPECT_THAT(status, Eq(INVALID_OPERATION)); |
Steven Moreland | 5a30d34 | 2019-10-08 13:53:28 -0700 | [diff] [blame] | 708 | } |
Devin Moore | cfeeda4 | 2020-12-08 12:50:58 -0800 | [diff] [blame] | 709 | |
| 710 | int main(int argc, char** argv) { |
| 711 | ::testing::InitGoogleTest(&argc, argv); |
| 712 | |
| 713 | // start a binder thread pool for testing --thread option |
| 714 | android::ProcessState::self()->setThreadPoolMaxThreadCount(8); |
| 715 | ProcessState::self()->startThreadPool(); |
| 716 | |
| 717 | return RUN_ALL_TESTS(); |
| 718 | } |