The first commit adds a new command sethdseed which allows you to either set or generate a new HD seed to be used. The second commit adds a test for this.
Partial (2/4) backport of Core PR12560
https://github.com/bitcoin/bitcoin/pull/12560/commits/b5ba01a18707b1d50c4d073bd40e1e92d78d04c1
https://github.com/bitcoin/bitcoin/pull/12560/commits/2bcf2b52aea07c778b439e6d6931bb4a1733304
Depends on D4201