Avoid compiling source files for tests multiple times
Instead use a static lib for the files and link against that.
Considering that this is not a bugfix but a minor refactoring it should probably wait for 5.22 branching? (Just a question, no strong feelings from my side)