SCons: rework test definition to link according to layer

tests used to be defined ad hoc and test definitions
are scattered confusingly over various directories.
Now built some simple rules into the buildsystem
to allow organising the tests into layers and
linking them accordingly.

Note: this switches to building shared objects
for the test classes too, which effectively speeds up
both re-building and re-running of test cases
re-arrange tests according to layer structure

the buildsystem will now pick up and link
all test cases according to the layer, e.g.
backend tests will automatically be linked
against the backend + library solely.