[education/rkward] rkward/autotests: Try to get better diagnostics on intermittent failure in cancelCommandStressTest.

Thomas Friedrichsmeier null at kde.org
Wed Oct 5 16:43:47 BST 2022


Git commit 3947f35708927afffcfbc552f2e4e2562640cb3e by Thomas Friedrichsmeier.
Committed on 05/10/2022 at 15:43.
Pushed by tfry into branch 'master'.

Try to get better diagnostics on intermittent failure in cancelCommandStressTest.

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

https://invent.kde.org/education/rkward/commit/3947f35708927afffcfbc552f2e4e2562640cb3e

diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 095e0aeb..27ccdc23 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -87,6 +87,14 @@ class RKWardCoreTest: public QObject {
 		RInterface::issueCommand(new RCommand("rm(list=ls(all.names=TRUE))", RCommand::User));
 	}
 
+	void listBackendLog() {
+		testLog("Listing contents of /tmp/rkward.rbackend");
+		QFile f(QDir::tempPath() + "/rkward.rbackend");
+		f.open(QIODevice::ReadOnly);
+		auto output = f.readAll();
+		testLog("%s", output.data());
+	}
+
 	void waitForBackendStarted() {
 		QElapsedTimer t;
 		t.start();
@@ -97,11 +105,8 @@ class RKWardCoreTest: public QObject {
 		if (RInterface::instance()->backendIsIdle()) {
 			testLog("Backend startup completed");
 		} else {
-			testLog("Backend startup failed. Listing contents of /tmp/rkward.rbackend");
-			QFile f(QDir::tempPath() + "/rkward.rbackend");
-			f.open(QIODevice::ReadOnly);
-			auto output = f.readAll();
-			testLog("%s", output.data());
+			testLog("Backend startup failed");
+			listBackendLog();
 		}
 	}
 
@@ -252,8 +257,16 @@ private slots:
 			if (i % 4 == 0) {
 				RInterface::instance()->cancelAll();
 			} else if (i % 4 == 1) {
+				QElapsedTimer t;
+				t.start();
 				while (commands_out <= i) {
 					qApp->processEvents();
+					if (t.elapsed() > 10000) {
+						testLog("Timeout waiting for backend");
+						listBackendLog();
+						QFAIL("Timeout waiting for backend");
+						break;
+					}
 				}
 			} else if (i % 4 == 2) {
 				qApp->processEvents();


More information about the rkward-tracker mailing list