| 128 | #endif |
| 129 | |
| 130 | static void testAttach() |
| 131 | { |
| 132 | QProcess target; |
| 133 | auto cleanup = kdScopeGuard([&target] { |
| 134 | target.kill(); |
| 135 | target.waitForFinished(); |
| 136 | }); |
| 137 | |
| 138 | target.setProcessChannelMode(QProcess::ForwardedChannels); |
| 139 | target.start(QLatin1String(TESTBIN_DIR "/minimalcoreapplication"), {}, QProcess::ReadWrite); |
| 140 | QVERIFY(target.waitForStarted()); |
| 141 | |
| 142 | LaunchOptions options; |
| 143 | options.setUiMode(LaunchOptions::NoUi); |
| 144 | options.setProbeSetting(QStringLiteral("ServerAddress"), GAMMARAY_DEFAULT_LOCAL_TCP_URL); |
| 145 | options.setPid(target.processId()); |
| 146 | QTest::qWait(5000); // give the target some time to actually load the QtCore DLL, otherwise ABI detection fails |
| 147 | ProbeABIDetector detector; |
| 148 | options.setProbeABI(ProbeFinder::findBestMatchingABI(detector.abiForProcess(options.pid()))); |
| 149 | Launcher launcher(options); |
| 150 | |
| 151 | QSignalSpy spy(&launcher, &Launcher::attached); |
| 152 | QVERIFY(spy.isValid()); |
| 153 | QVERIFY(launcher.start()); |
| 154 | |
| 155 | spy.wait(30000); |
| 156 | QCOMPARE(spy.size(), 1); |
| 157 | } |
| 158 | }; |
| 159 | |
| 160 | QTEST_MAIN(LauncherTest) |
nothing calls this directly
no test coverage detected