From bf7f6386d540900f9ef46b93e843e1808f2ecca8 Mon Sep 17 00:00:00 2001 From: Marijn Kruisselbrink Date: Thu, 29 Dec 2022 19:50:03 -0800 Subject: [PATCH] Re-enable lib/ardour/test/session_test. This test seems to be compiling and passing just fine (when run in isolation), so turning it back on seems like a good idea. To make it pass when run as part of the full ardour test suite, this does remove the WebSockets control surface from the control surfaces test though, as that control surface messes up the event loop of the main thread, which would otherwise cause use-after-free crashes in the session test. --- libs/ardour/test/control_surfaces_test.cc | 7 +++++++ libs/ardour/wscript | 4 ++-- libs/surfaces/websockets/feedback.cc | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libs/ardour/test/control_surfaces_test.cc b/libs/ardour/test/control_surfaces_test.cc index da47d20bf2..86fff66b9f 100644 --- a/libs/ardour/test/control_surfaces_test.cc +++ b/libs/ardour/test/control_surfaces_test.cc @@ -45,6 +45,13 @@ ControlSurfacesTest::instantiateAndTeardownTest () continue; } #endif + // The WebSockets control surface replaces the global event loop, causing + // crashes in later tests once it is deactivates. Until that is fixed, skip + // it. + if ((*i)->name == "WebSockets Server (Experimental)") { + continue; + } + std::cout << "ControlSurfacesTest: " << (*i)->name << "\n"; if ((*i)->protocol && (*i)->protocol->active()) { /* may already be active because of user preferences */ diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 4248fbcdac..fb001afce5 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -585,7 +585,7 @@ def build(bld): create_ardour_test_program(bld, obj.includes, 'unit-test-control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc']) create_ardour_test_program(bld, obj.includes, 'unit-test-mtdm', 'test_mtdm', ['test/mtdm_test.cc']) create_ardour_test_program(bld, obj.includes, 'unit-test-sha1', 'test_sha1', ['test/sha1_test.cc']) - #create_ardour_test_program(bld, obj.includes, 'unit-test-session', 'test_session', ['test/session_test.cc']) + create_ardour_test_program(bld, obj.includes, 'unit-test-session', 'test_session', ['test/session_test.cc']) create_ardour_test_program(bld, obj.includes, 'unit-test-dsp_load_calculator', 'test_dsp_load_calculator', ['test/dsp_load_calculator_test.cc']) test_sources = [ @@ -607,7 +607,7 @@ def build(bld): 'test/control_surfaces_test.cc', 'test/mtdm_test.cc', 'test/sha1_test.cc', - #'test/session_test.cc', + 'test/session_test.cc', ] # Tests that don't work diff --git a/libs/surfaces/websockets/feedback.cc b/libs/surfaces/websockets/feedback.cc index 77cbc8ca9d..5e73337d5f 100644 --- a/libs/surfaces/websockets/feedback.cc +++ b/libs/surfaces/websockets/feedback.cc @@ -102,6 +102,11 @@ struct PluginParamValueObserver { FeedbackHelperUI::FeedbackHelperUI() : AbstractUI ("WS_FeedbackHelperUI") { + // This renames and changes the event loop for the main thread, presumably + // this is not the actually desired behavior. If this is intentional, at + // least the event loop should be set back when this FeedbackHelperUI is + // destroyed, as otherwise future access to the event loop is likely going + // to crash. char name[64]; snprintf (name, 64, "WS-%p", (void*)DEBUG_THREAD_SELF); pthread_set_name (name);