Remove rare flakieness from protocol tests
There was a race in the debugger protocol tests which send bad commands to the proxy and expect it to disconnect. If the proxy thread was fast enough it would mark the client as stopped, and we'd skip trying to get a new message after sending the bad command. This means missing one line of output in very rare cases. I've put in a wait to ensure that the client settles in the stopped state before continuing, to remove the race.
Esse commit está contido em:
@@ -71,6 +71,15 @@ void CmdInternalTesting::onClientImpl(DebuggerClient &client) {
|
||||
// disconnect from us.
|
||||
m_type = KindOfInternalTestingBad;
|
||||
client.sendToServer(this);
|
||||
// Spin here and wait for the client to be marked as stopped
|
||||
// before going back to the event loop. This will give the local
|
||||
// proxy time to recgonize the bad cmd, terminate, and wait for
|
||||
// the client to stop. This will ensure that we always exit on the
|
||||
// same path on both proxy and client threads, and remove any
|
||||
// spurious output form ths test case.
|
||||
while (!client.internalTestingIsClientStopped()) {
|
||||
sleep(1);
|
||||
}
|
||||
throw DebuggerConsoleExitException(); // Expect no response
|
||||
} else if (client.arg(1, "badcmdtypereceive")) {
|
||||
client.xend<CmdInternalTesting>(this);
|
||||
@@ -78,6 +87,10 @@ void CmdInternalTesting::onClientImpl(DebuggerClient &client) {
|
||||
} else if (client.arg(1, "shortcmdsend")) {
|
||||
m_arg = "shortcmd"; // Force send to drop a field.
|
||||
client.sendToServer(this);
|
||||
// See note above about this wait.
|
||||
while (!client.internalTestingIsClientStopped()) {
|
||||
sleep(1);
|
||||
}
|
||||
throw DebuggerConsoleExitException(); // Expect no response
|
||||
} else if (client.arg(1, "shortcmdreceive")) {
|
||||
client.xend<CmdInternalTesting>(this);
|
||||
|
||||
@@ -351,6 +351,9 @@ public:
|
||||
|
||||
std::string getZendExecutable() const { return m_zendExe; }
|
||||
|
||||
// Internal testing helpers. Only used by internal tests!!!
|
||||
bool internalTestingIsClientStopped() const { return m_stopped; }
|
||||
|
||||
private:
|
||||
enum InputState {
|
||||
TakingCommand,
|
||||
|
||||
@@ -11,4 +11,3 @@ Breakpoint 1 reached on line 3 of %s/error_bad_cmd_type_send.php
|
||||
internaltesting badcmdtypesend
|
||||
Executing internal test...
|
||||
DebuggerProxy::processInterrupt(): received bad cmd type: 20001
|
||||
Unable to communicate with server. Server's down?
|
||||
|
||||
@@ -12,4 +12,3 @@ internaltesting shortcmdsend
|
||||
Executing internal test...
|
||||
DebuggerCommand::recv(): a socket error has happened
|
||||
DebuggerProxy::processInterrupt(): socket error receiving command
|
||||
Unable to communicate with server. Server's down?
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário