[education/rkward] rkward: Add more diagnostics on fragile test

Thomas Friedrichsmeier null at kde.org
Sat May 18 16:28:48 BST 2024


Git commit 91c4a0c5253a36de940350a0915ab154363f5579 by Thomas Friedrichsmeier.
Committed on 18/05/2024 at 15:28.
Pushed by tfry into branch 'master'.

Add more diagnostics on fragile test

M  +2    -2    rkward/autotests/core_test.cpp
M  +2    -0    rkward/rbackend/rkrinterface.cpp

https://invent.kde.org/education/rkward/-/commit/91c4a0c5253a36de940350a0915ab154363f5579

diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index c01f70544..8a1f959a6 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -83,7 +83,7 @@ class RKWardCoreTest: public QObject {
 	}
 
 	void waitForAllFinished(int timeoutms = 2000) {
-		runCommandWithTimeout(new RCommand(QString(), RCommand::App | RCommand::EmptyCommand | RCommand::Sync), nullptr, [](RCommand*){}, timeoutms);
+		runCommandWithTimeout(new RCommand("# waitForAllFinished", RCommand::App | RCommand::EmptyCommand | RCommand::Sync), nullptr, [](RCommand*){}, timeoutms);
 	}
 
 	void cleanGlobalenv() {
@@ -372,7 +372,7 @@ private Q_SLOTS:
 			priority_command_done = true;
 			RInterface::instance()->cancelAll();
 		});
-		waitForAllFinished();  // priority_command_done must remain in scope until done
+		waitForAllFinished(5000);  // priority_command_done must remain in scope until done (even if interrupting fails for some reason)
 	}
 
 	void RKConsoleHistoryTest() {
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 1cf057277..bc1ca6249 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -560,8 +560,10 @@ void RInterface::cancelCommand (RCommand *command) {
 		command->status |= RCommand::Canceled;
 		if (command->status & RCommand::Running) {
 			if ((RKDebugHandler::instance ()->state () == RKDebugHandler::InDebugPrompt) && (command == RKDebugHandler::instance ()->command ())) {
+				RK_DEBUG(RBACKEND, DL_DEBUG, "Interrupting debug prompt");
 				RKDebugHandler::instance ()->sendCancel ();
 			} else {
+				RK_DEBUG(RBACKEND, DL_DEBUG, "Interrupting running command %d", command->id());
 				RKRBackendProtocolFrontend::instance ()->interruptCommand (command->id ());
 			}
 		}


More information about the rkward-tracker mailing list