From 3956d6ab4a4e0100a0ec979024c75b9c3945ba06 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Thu, 6 Dec 2018 12:05:08 +0200 Subject: [PATCH] [autotests] Fix failing of testDontCrashReinitializeCompositor Summary: Currently, testDontCrashReinitializeCompositor is unstable because it doesn't take into account that effects can be loaded asynchronously. In general, we don't need all default effects in this test, so let's disable them. Test Plan: This should fix ASan issues. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D17386 --- .../dont_crash_reinitialize_compositor.cpp | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/autotests/integration/dont_crash_reinitialize_compositor.cpp b/autotests/integration/dont_crash_reinitialize_compositor.cpp index f09e2705c6..c5fda6ca4a 100644 --- a/autotests/integration/dont_crash_reinitialize_compositor.cpp +++ b/autotests/integration/dont_crash_reinitialize_compositor.cpp @@ -23,6 +23,7 @@ along with this program. If not, see . #include "abstract_client.h" #include "composite.h" #include "deleted.h" +#include "effectloader.h" #include "effects.h" #include "platform.h" #include "screens.h" @@ -30,6 +31,8 @@ along with this program. If not, see . #include "wayland_server.h" #include "workspace.h" +#include "effect_builtins.h" + #include #include @@ -64,6 +67,16 @@ void DontCrashReinitializeCompositorTest::initTestCase() QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); + auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); + KConfigGroup plugins(config, QStringLiteral("Plugins")); + ScriptedEffectLoader loader; + const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects(); + for (const QString &name : builtinNames) { + plugins.writeEntry(name + QStringLiteral("Enabled"), false); + } + config->sync(); + kwinApp()->setConfig(config); + qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2")); qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1")); @@ -82,6 +95,12 @@ void DontCrashReinitializeCompositorTest::init() void DontCrashReinitializeCompositorTest::cleanup() { + // Unload all effects. + auto effectsImpl = qobject_cast(effects); + QVERIFY(effectsImpl); + effectsImpl->unloadAllEffects(); + QVERIFY(effectsImpl->loadedEffects().isEmpty()); + Test::destroyWaylandConnection(); } @@ -104,10 +123,6 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor() auto effectsImpl = qobject_cast(effects); QVERIFY(effectsImpl); - // Unload all effects. - effectsImpl->unloadAllEffects(); - QVERIFY(effectsImpl->loadedEffects().isEmpty()); - // Create the test client. using namespace KWayland::Client;