Add a simple test.
Refactor quite a lot, and thus test failure of some commands and of server startup.
Merge bug26256