[RFC PATCH v2 23/56] test: Tidy up sandbox handling in test-main