[PATCH v8 06/11] test: Improve handling of sending commands