MCPcopy Create free account
hub / github.com/KDAB/GammaRay / testAttach

Method testAttach

tests/launchertest.cpp:130–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
160QTEST_MAIN(LauncherTest)

Callers

nothing calls this directly

Calls 12

kdScopeGuardClass · 0.85
findBestMatchingABIFunction · 0.85
waitForFinishedMethod · 0.80
setUiModeMethod · 0.80
setProbeSettingMethod · 0.80
setProbeABIMethod · 0.80
abiForProcessMethod · 0.80
startMethod · 0.45
setPidMethod · 0.45
pidMethod · 0.45
isValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected