[education/rkward] rkward/autotests: Try to get better diagnostics for test backend failing to start on CI

Thomas Friedrichsmeier null at kde.org
Sat Jun 11 15:24:21 BST 2022


Git commit 37f7e14f7794541c01d9bdcb2491a80902470037 by Thomas Friedrichsmeier.
Committed on 10/06/2022 at 21:50.
Pushed by tfry into branch 'master'.

Try to get better diagnostics for test backend failing to start on CI

M  +18   -4    rkward/autotests/core_test.cpp

https://invent.kde.org/education/rkward/commit/37f7e14f7794541c01d9bdcb2491a80902470037

diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 7ce0c68f..fd7d70dd 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -1,6 +1,8 @@
 #include <QObject>
 #include <QTest>
 #include <QApplication>
+#include <QFile>
+#include <QDir>
 
 #include <KAboutData>
 
@@ -41,16 +43,28 @@ private slots:
 	void initTestCase()
 	{
 		qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox"); // Allow test to be run as root, which, for some reason is being done on the SuSE CI.
-		KAboutData::setApplicationData(KAboutData("rkward")); // needed for .rc files to load0
-		RK_Debug::RK_Debug_Level = DL_WARNING;
+		KAboutData::setApplicationData(KAboutData("rkward")); // needed for .rc files to load
+		RK_Debug::RK_Debug_Level = DL_DEBUG;
 		qDebug(R_EXECUTABLE);
 		RKSessionVars::r_binary = R_EXECUTABLE;
 		main_win = new RKWardMainWindow();
 		main_win->testmode_suppress_dialogs = true;
+
+		QElapsedTimer t;
+		t.start();
 		while (!(RInterface::instance()->backendIsDead() || RInterface::instance()->backendIsIdle())) {
-			qApp->processEvents();
+			if (t.elapsed() > 20000) break;
+			qApp->processEvents(QEventLoop::AllEvents);
+		}
+		if (RInterface::instance()->backendIsIdle()) {
+			qDebug("Startup completed");
+		} else {
+			qDebug("Startup failed. Listing contents of /tmp/rkward.rbackend");
+			QFile f(QDir::tempPath() + "/rkward.rbackend");
+			f.open(QIODevice::ReadOnly);
+			auto output = f.readAll();
+			qDebug("%s", output.data());
 		}
-		qDebug("Startup completed");
 	}
 
 	void getIntVector() {



More information about the rkward-tracker mailing list