[education/rkward/testing/win_citest_timeout] /: Cleanup
Thomas Friedrichsmeier
null at kde.org
Sun Oct 2 21:40:27 BST 2022
Git commit 568d985d48bb0739925c245a57b61119fe4e71f7 by Thomas Friedrichsmeier.
Committed on 02/10/2022 at 20:40.
Pushed by tfry into branch 'testing/win_citest_timeout'.
Cleanup
M +2 -0 .gitlab-ci.yml
M +1 -1 .kde-ci.yml
M +38 -40 rkward/autotests/core_test.cpp
M +0 -3 rkward/rbackend/rkfrontendtransmitter.cpp
M +0 -4 rkward/rbackend/rkrbackendprotocol_frontend.cpp
https://invent.kde.org/education/rkward/commit/568d985d48bb0739925c245a57b61119fe4e71f7
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4c585377..2eb710e7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,4 +2,6 @@
# SPDX-License-Identifier: CC0-1.0
include:
+ - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
+ - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml
diff --git a/.kde-ci.yml b/.kde-ci.yml
index e4966e6e..5e58bc28 100644
--- a/.kde-ci.yml
+++ b/.kde-ci.yml
@@ -19,6 +19,6 @@ Dependencies:
'frameworks/kcrash': '@stable'
Options:
- require-passing-tests-on: [ 'Windows' ]
+ require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
tests-load-sensitve: True
per-test-timeout: 60
diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 5025671d..02287c01 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -210,46 +210,6 @@ private slots:
cleanGlobalenv();
}
- void restartRBackend() {
- auto restart_action = RKWardMainWindow::getMain()->actionCollection()->action("restart_r");
- QVERIFY(restart_action != nullptr);
- RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
- waitForAllFinished();
- QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
-
- QPointer<RInterface> oldiface = RInterface::instance();
- RK_Debug::RK_Debug_Level = DL_TRACE;
- restart_action->trigger();
- while (oldiface) { // action may be delayed until next event processing
- qApp->processEvents();
- }
- testLog("f");
- waitForBackendStarted();
- testLog("g");
-
- // backend should be clean after restart
- QVERIFY(!RObjectList::getGlobalEnv()->findObject("x"));
- // but of course it should also be functional...
- RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
- waitForAllFinished();
- QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
- }
-
- void priorityCommandTest() {
- bool priority_command_done = false;
- runCommandAsync(new RCommand("Sys.sleep(5)", RCommand::User), nullptr, [&priority_command_done](RCommand *command) {
- QVERIFY(priority_command_done);
- QVERIFY(command->failed());
- QVERIFY(command->wasCanceled());
- });
- auto priority_command = new RCommand("cat(\"something\\n\")", RCommand::PriorityCommand | RCommand::App);
- runCommandAsync(priority_command, nullptr, [&priority_command_done](RCommand *) {
- priority_command_done = true;
- RInterface::instance()->cancelAll();
- });
- waitForAllFinished(); // priority_command_done must remain in scope until done
- }
-
void commandOrderAndOutputTest() {
// commands shall run in the order 1, 3, 2, 5, 4, but also, of course, all different types of output shall be captured
QStringList output;
@@ -307,6 +267,44 @@ private slots:
testLog("%d out of %d commands were actually cancelled", cancelled_commands, commands_out);
}
+ void priorityCommandTest() {
+ bool priority_command_done = false;
+ runCommandAsync(new RCommand("Sys.sleep(5)", RCommand::User), nullptr, [&priority_command_done](RCommand *command) {
+ QVERIFY(priority_command_done);
+ QVERIFY(command->failed());
+ QVERIFY(command->wasCanceled());
+ });
+ auto priority_command = new RCommand("cat(\"something\\n\")", RCommand::PriorityCommand | RCommand::App);
+ runCommandAsync(priority_command, nullptr, [&priority_command_done](RCommand *) {
+ priority_command_done = true;
+ RInterface::instance()->cancelAll();
+ });
+ waitForAllFinished(); // priority_command_done must remain in scope until done
+ }
+
+ void restartRBackend() {
+ auto restart_action = RKWardMainWindow::getMain()->actionCollection()->action("restart_r");
+ QVERIFY(restart_action != nullptr);
+ RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
+ waitForAllFinished();
+ QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
+
+ QPointer<RInterface> oldiface = RInterface::instance();
+ RK_Debug::RK_Debug_Level = DL_TRACE;
+ restart_action->trigger();
+ while (oldiface) { // action may be delayed until next event processing
+ qApp->processEvents();
+ }
+ waitForBackendStarted();
+
+ // backend should be clean after restart
+ QVERIFY(!RObjectList::getGlobalEnv()->findObject("x"));
+ // but of course it should also be functional...
+ RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
+ waitForAllFinished();
+ QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
+ }
+
void cleanupTestCase()
{
// at least the backend should exit properly, to avoid creating emergency save files
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index dada81b0..5e232e25 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -54,11 +54,8 @@ RKFrontendTransmitter::~RKFrontendTransmitter () {
delete rkd_transmitter;
RK_ASSERT (!server->isListening ());
- RK_TRACE (RBACKEND);
delete server;
- RK_TRACE (RBACKEND);
delete backend;
- RK_TRACE (RBACKEND);
}
QString localeDir () {
diff --git a/rkward/rbackend/rkrbackendprotocol_frontend.cpp b/rkward/rbackend/rkrbackendprotocol_frontend.cpp
index f9609f77..f9630f0f 100644
--- a/rkward/rbackend/rkrbackendprotocol_frontend.cpp
+++ b/rkward/rbackend/rkrbackendprotocol_frontend.cpp
@@ -32,13 +32,9 @@ RKRBackendProtocolFrontend::~RKRBackendProtocolFrontend () {
terminateBackend ();
RKFrontendTransmitter::instance ()->wait(1000); // Wait for thread to catch the backend's exit request, and exit()
QMetaObject::invokeMethod(RKFrontendTransmitter::instance(), &RKFrontendTransmitter::quit, Qt::QueuedConnection); // tell it to quit, otherwise
- RK_TRACE (RBACKEND);
RKFrontendTransmitter::instance ()->wait(3000); // Wait for thread to quit and clean up.
- RK_TRACE (RBACKEND);
qApp->processEvents(QEventLoop::AllEvents, 500); // Not strictly needed, but avoids some mem leaks on exit by handling all posted BackendExit events
- RK_TRACE (RBACKEND);
delete RKFrontendTransmitter::instance ();
- RK_TRACE (RBACKEND);
_instance = nullptr;
}
More information about the rkward-tracker
mailing list