View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004911 | ardour | bugs | public | 2012-06-06 11:27 | 2020-04-19 20:16 |
| Reporter | timbyr | Assigned To | cth103 | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Summary | 0004911: Remove redundant init and cleanup from libardour testsuite | ||||
| Description | I have a couple of test cases(out of tree) that were failing when building the libardour testsuite as a single executable. I believe it is because TestNeedingSession::setUp and TestNeedingSession::tearDown are calling code that they probably shouldn't be(or don't need to which has side effects). Calling EnumWriter::destroy () in tearDown means any further code that depends on PBD::EnumWriter will have to call ARDOUR::init and setup_libpbd_enums to setup the types in the EnumWriter type registry. If you don't call EnumWriter::destroy then you don't need to call ARDOUR::init and setup_libpbd_enums I've attached a few patches that I think should fix the issue. All the tests should still pass etc. | ||||
| Tags | No tags attached. | ||||
|
2012-06-06 11:28
|
0001-Remove-redundant-init-and-cleanup-code-from-common-t.patch (1,798 bytes)
From cba1bb6de508bdf0c57994947c83d5b7af0cfc96 Mon Sep 17 00:00:00 2001
From: Tim Mayberry <mojofunk@gmail.com>
Date: Wed, 6 Jun 2012 20:16:25 +1000
Subject: [PATCH 1/3] Remove redundant init and cleanup code from common test
code
Calling PBD::EnumWriter::destroy means ARDOUR::init and setup_libpbd_enums need to be called again
to register types. If the call to EnumWriter::destroy is removed then ARDOUR::init and setup_libpbd_enums
no longer need to be called. EnumWriter::destroy should probably be added to ARDOUR::cleanup(or better yet PBD::cleanup)
and then called at the end of main. __attribute__ ((destructor)) could be used but that is not portable between
compilers so I'd prefer it wasn't.
---
libs/ardour/test/test_needing_session.cc | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/libs/ardour/test/test_needing_session.cc b/libs/ardour/test/test_needing_session.cc
index 625d573..70e3362 100644
--- a/libs/ardour/test/test_needing_session.cc
+++ b/libs/ardour/test/test_needing_session.cc
@@ -6,8 +6,6 @@
#include "ardour/audioengine.h"
#include "test_needing_session.h"
-extern void setup_libpbd_enums ();
-
using namespace std;
using namespace ARDOUR;
using namespace PBD;
@@ -56,11 +54,8 @@ TestNeedingSession::setUp ()
string const test_session_path = "libs/ardour/test/test_session";
system (string_compose ("rm -rf %1", test_session_path).c_str());
- init (false, true);
SessionEvent::create_per_thread_pool ("test", 512);
- setup_libpbd_enums ();
-
test_receiver.listen_to (error);
test_receiver.listen_to (info);
test_receiver.listen_to (fatal);
@@ -83,7 +78,6 @@ TestNeedingSession::tearDown ()
delete _session;
- EnumWriter::destroy ();
MIDI::Manager::destroy ();
AudioEngine::destroy ();
}
--
1.7.7.6
|
|
2012-06-06 11:28
|
0002-Call-ARDOUR-cleanup-at-the-end-of-libardour-tests.patch (753 bytes)
From 844a77ee101a53a596a6a608c7b5b3d42ec8058f Mon Sep 17 00:00:00 2001 From: Tim Mayberry <mojofunk@gmail.com> Date: Wed, 6 Jun 2012 20:42:41 +1000 Subject: [PATCH 2/3] Call ARDOUR::cleanup at the end of libardour tests --- libs/ardour/test/testrunner.cc | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/libs/ardour/test/testrunner.cc b/libs/ardour/test/testrunner.cc index 4024490..05b7a9f 100644 --- a/libs/ardour/test/testrunner.cc +++ b/libs/ardour/test/testrunner.cc @@ -60,6 +60,8 @@ main(int argc, char* argv[]) CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr); compileroutputter.write (); + + ARDOUR::cleanup (); return collectedresults.wasSuccessful () ? 0 : 1; } -- 1.7.7.6 |
|
2012-06-06 11:28
|
0003-Call-PBD-EnumWriter-destroy-in-ARDOUR-cleanup.patch (597 bytes)
From f215972f84ad5234fc5340975fe2218d250540fb Mon Sep 17 00:00:00 2001 From: Tim Mayberry <mojofunk@gmail.com> Date: Wed, 6 Jun 2012 20:43:47 +1000 Subject: [PATCH 3/3] Call PBD::EnumWriter::destroy in ARDOUR::cleanup --- libs/ardour/globals.cc | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 56aab1e..35aef9d 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -378,6 +378,7 @@ ARDOUR::cleanup () #ifdef LXVST_SUPPORT vstfx_exit(); #endif + EnumWriter::destroy (); return 0; } -- 1.7.7.6 |
|
|
Applied to SVN 12578, 12579, 12580. Thanks! |
|
|
Issue has been closed automatically, by Trigger Close Plugin. Feel free to re-open with additional information if you think the issue is not resolved. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-06-06 11:27 | timbyr | New Issue | |
| 2012-06-06 11:27 | timbyr | cost | => 0.00 |
| 2012-06-06 11:28 | timbyr | File Added: 0001-Remove-redundant-init-and-cleanup-code-from-common-t.patch | |
| 2012-06-06 11:28 | timbyr | File Added: 0002-Call-ARDOUR-cleanup-at-the-end-of-libardour-tests.patch | |
| 2012-06-06 11:28 | timbyr | File Added: 0003-Call-PBD-EnumWriter-destroy-in-ARDOUR-cleanup.patch | |
| 2012-06-06 11:58 | cth103 | Note Added: 0013392 | |
| 2012-06-06 11:58 | cth103 | Status | new => resolved |
| 2012-06-06 11:58 | cth103 | Resolution | open => fixed |
| 2012-06-06 11:58 | cth103 | Assigned To | => cth103 |
| 2020-04-19 20:16 | system | Note Added: 0023071 | |
| 2020-04-19 20:16 | system | Status | resolved => closed |