Testing Plugins

From MOD Wiki
Revision as of 13:36, 3 September 2018 by Jkbd (talk | contribs) (Stress testing LV2 plug-ins)
Jump to navigation Jump to search

WARNING: This page is currently being written, please check in later!

Error checking

Using SDK, needs py3lilv out of scope of this, see lilvlib for debian and osx

Plugin Data Validation

With RDF data it is possible to check the syntax and semantics. Syntax means, for example, you have not written a comma where ought to be a semicolon. Valid semantic means, for example, there is no AudioPort which is InputPort and OutputPort at the same time.

Preparation

Assuming you have installed sord_validate with your system package manager. On Arch Linux the package is called lv2.

We clone the upstream LV2 repository:

$ cd ~/Downloads
$ git clone http://lv2plug.in/git/cgit.cgi/lv2.git/
$ cd lv2

The reason is linux distribution are probably not up to date. We don't want to waste time with errors that are fixed upstream!

First let's check the release itself is not broken. The following should give no errors:

$ sord_validate $(find . -name '*.ttl')
Found 0 errors among 88 files (checked 1834 restrictions)

Second we need to have the definitions of the MOD extentions (which are documented at [1] and [2]).

$ cd ~/Downloads
$ mkdir ns-mod-ttl
$ cd ns-mod-ttl
$ wget http://moddevices.com/ns/mod/mod.doap.ttl
$ wget http://moddevices.com/ns/mod/mod.ttl
$ wget http://moddevices.com/ns/modgui/modgui.ttl
$ wget http://moddevices.com/ns/modgui/modgui.doap.ttl

Let's also check if the set union of the two is still valid:

$ sord_validate $(find ~/Downloads/lv2/ -name '*.ttl') $(find ~/Downloads/ns-mod-ttl/ -name '*.ttl')
Found 0 errors among 92 files (checked 1889 restrictions)

Now we are prepared.

Validate Your Plugin

What sord_validate does is, reading in the whole world of triples and proving that there are no conflicts with the rules. The rules are stated in the definitions you downloaded above.

If you can list your created Turtle files like this

$ find ~/.lv2/mybundle.lv2 -name '*.ttl'
/home/username/.lv2/mybundle.lv2/manifest.ttl
/home/username/.lv2/mybundle.lv2/seealso.ttl
...

then you can validate them by adding this command in the back:

$ sord_validate $(find ~/Downloads/lv2/ -name '*.ttl') $(find ~/Downloads/ns-mod-ttl/ -name '*.ttl') $(find ~/.lv2/mybundle.lv2 -name '*.ttl')

The result should be 0 errors. That's it.

Stress tests

Your plugin builds, runs and can be found on the LV2PATH. Let's test the code.

Testing with lv2bm

Download and compile the tool with

$ cd $MY_GITHUB_DIR
$ git clone git@github.com:moddevices/lv2bm.git
$ cd lv2bm
$ make DEBUG=1

Optionally you can install it on your system path. Make sure, you also built your plugin with debug symbols.


If your plugin has the URI http://example.org/mybundle then you run the tool with:

$ ./lv2bm --full-test http://example.org/mybundle
...
[Inferior 1 (process 5735) exited normally]

If your plugin crashes you can investigate it with

$ gdb --args ./lv2bm --full-test http://example.org/mybundle
...
(gdb) run
...

for example.

Torture tester

There is another tool to test LV2 plug-ins called Torture tester. Install and build it:

$ cd $MY_GITHUB_DIR
$ git clone git@github.com:cth103/plugin-torture.git
$ cd plugin-torture
$ make

Again we don't install it on the system path.

Run it with

$ ./plugin-torture -d -a -e --lv2 -p ~/.lv2/alo.lv2/manifest.ttl

Of course, you can wrap this with GDB as well. See ./plugin-torture -h for the arguments explained.

Does it load on MOD?

mod-host trick