Fix test/profiling tools

* use dummy-backend (don't expect engine to be running)
* add required TestUI / Receiver

Lots of regions: add scope to prevent SessionHandleRef
  existing across session deletion

RunPC: take process-lock before processing, prevents various
  assert() and concurrency issues.
This commit is contained in:
Robin Gareus 2021-07-16 14:52:54 +02:00
parent efb0d077d1
commit 82c536ec81
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 32 additions and 4 deletions

View File

@ -1,3 +1,4 @@
#include "test_ui.h"
#include "test_util.h"
#include "pbd/failed_constructor.h"
#include "ardour/ardour.h"
@ -19,6 +20,8 @@ int main (int argc, char* argv[])
}
ARDOUR::init (false, true, localedir);
TestUI* test_ui = new TestUI();
create_and_start_dummy_backend ();
Session* s = 0;
@ -41,8 +44,8 @@ int main (int argc, char* argv[])
AudioEngine::instance()->remove_session ();
delete s;
AudioEngine::instance()->stop ();
AudioEngine::destroy ();
delete test_ui;
ARDOUR::cleanup ();
return 0;
}

View File

@ -1,3 +1,4 @@
#include "test_ui.h"
#include "test_util.h"
#include "ardour/ardour.h"
#include "ardour/midi_track.h"
@ -16,10 +17,14 @@ int
main (int argc, char* argv[])
{
ARDOUR::init (false, true, localedir);
TestUI* test_ui = new TestUI();
create_and_start_dummy_backend ();
Session* session = load_session ("../libs/ardour/test/profiling/sessions/1region", "1region");
assert (session->get_routes()->size() == 2);
{
/* Find the track */
boost::shared_ptr<MidiTrack> track = boost::dynamic_pointer_cast<MidiTrack> (session->get_routes()->back());
assert (track);
@ -48,4 +53,12 @@ main (int argc, char* argv[])
playlist->duplicate (region, region->last_sample() + 1, 1000);
session->add_command (new StatefulDiffCommand (playlist));
session->commit_reversible_command ();
}
delete session;
stop_and_destroy_backend ();
delete test_ui;
ARDOUR::cleanup ();
return 0;
}

View File

@ -4,6 +4,7 @@
#include "pbd/enumwriter.h"
#include "ardour/session.h"
#include "ardour/audioengine.h"
#include "test_ui.h"
#include "test_util.h"
using namespace std;
@ -21,6 +22,8 @@ main (int argc, char* argv[])
}
ARDOUR::init (false, true, localedir);
TestUI* test_ui = new TestUI();
create_and_start_dummy_backend ();
Session* session = load_session (
string_compose ("../libs/ardour/test/profiling/sessions/%1", argv[1]),
@ -29,9 +32,16 @@ main (int argc, char* argv[])
cout << "INFO: " << session->get_routes()->size() << " routes.\n";
for (int i = 0; i < 32768; ++i) {
session->process (session->engine().samples_per_cycle ());
{
Glib::Threads::Mutex::Lock lm (AudioEngine::instance ()->process_lock ());
for (int i = 0; i < 32768; ++i) {
session->process (session->engine().samples_per_cycle ());
}
}
delete session;
stop_and_destroy_backend ();
delete test_ui;
ARDOUR::cleanup ();
return 0;
}

View File

@ -10,4 +10,5 @@
<RegionList sort-type="ByEndInFile" sort-ascending="yes" show-all="no" show-automatic-regions="yes"/>
</Editor>
<Mixer narrow-strips="no" show-mixer="no"/>
<LastUsedSnapshot name="1region.ardour"/>
</instant>

View File

@ -660,6 +660,7 @@ def build(bld):
profilingobj.source = '''
test/dummy_lxvst.cc
test/test_util.cc
test/test_ui.cc
'''.split()
profilingobj.source.append('test/profiling/%s.cc' % p)