Fix tests to work in both default and gadget mode (purely asynchronous).