[PATCH v5 14/20] test: Improve handling of sending commands