Fixed some bad bugs + improved tests
This commit is contained in:
parent
2a40419b2b
commit
04f7a03780
4 changed files with 49 additions and 42 deletions
|
@ -479,6 +479,9 @@ static PurpleCoreUiOps coreUiOps =
|
|||
};
|
||||
|
||||
static void signed_on(PurpleConnection *gc, gpointer unused) {
|
||||
for (int i = 0; i<1500; i++) {
|
||||
std::cout << "A\n";
|
||||
}
|
||||
PurpleAccount *account = purple_connection_get_account(gc);
|
||||
np->handleConnected(np->m_accounts[account]);
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ void NetworkPlugin::handleVCardPayload(const std::string &data) {
|
|||
}
|
||||
|
||||
void NetworkPlugin::handleDataRead(const Swift::SafeByteArray &data) {
|
||||
m_data.insert(m_data.begin(), data.begin(), data.end());
|
||||
m_data.insert(m_data.end(), data.begin(), data.end());
|
||||
|
||||
while (m_data.size() != 0) {
|
||||
unsigned int expected_size;
|
||||
|
|
|
@ -90,7 +90,7 @@ static int exec_(const char *path, const char *host, const char *port, const cha
|
|||
if ( pid == 0 ) {
|
||||
// child process
|
||||
execlp(path, path, "--host", host, "--port", port, config, NULL);
|
||||
exit(1);
|
||||
abort();
|
||||
} else if ( pid < 0 ) {
|
||||
// fork failed
|
||||
status = -1;
|
||||
|
@ -195,13 +195,9 @@ void NetworkPluginServer::handleDisconnectedPayload(const std::string &data) {
|
|||
return;
|
||||
}
|
||||
|
||||
User *user = m_userManager->getUser(payload.user());
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_component->m_userRegistry->onPasswordInvalid(payload.user());
|
||||
user = m_userManager->getUser(payload.user());
|
||||
|
||||
User *user = m_userManager->getUser(payload.user());
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
@ -230,7 +226,7 @@ void NetworkPluginServer::handleBuddyChangedPayload(const std::string &data) {
|
|||
// TODO: ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << payload.buddyname() << "\n";
|
||||
User *user = m_userManager->getUser(payload.username());
|
||||
if (!user)
|
||||
return;
|
||||
|
@ -326,8 +322,8 @@ void NetworkPluginServer::handleConvMessagePayload(const std::string &data, bool
|
|||
}
|
||||
|
||||
void NetworkPluginServer::handleDataRead(Client *c, const Swift::SafeByteArray &data) {
|
||||
c->data.insert(c->data.begin(), data.begin(), data.end());
|
||||
|
||||
c->data.insert(c->data.end(), data.begin(), data.end());
|
||||
std::cout << "READ\n";
|
||||
while (c->data.size() != 0) {
|
||||
unsigned int expected_size;
|
||||
|
||||
|
@ -343,11 +339,12 @@ void NetworkPluginServer::handleDataRead(Client *c, const Swift::SafeByteArray &
|
|||
|
||||
pbnetwork::WrapperMessage wrapper;
|
||||
if (wrapper.ParseFromArray(&c->data[4], expected_size) == false) {
|
||||
std::cout << "PARSING ERROR " << expected_size << "\n";
|
||||
c->data.erase(c->data.begin(), c->data.begin() + 4 + expected_size);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
c->data.erase(c->data.begin(), c->data.begin() + 4 + expected_size);
|
||||
|
||||
std::cout << "TYPE " << wrapper.type() << " " << (int) pbnetwork::WrapperMessage_Type_TYPE_CONNECTED << " " << c->data.size() << "\n";
|
||||
switch(wrapper.type()) {
|
||||
case pbnetwork::WrapperMessage_Type_TYPE_CONNECTED:
|
||||
handleConnectedPayload(wrapper.payload());
|
||||
|
@ -403,6 +400,10 @@ void NetworkPluginServer::pingTimeout() {
|
|||
|
||||
void NetworkPluginServer::handleUserCreated(User *user) {
|
||||
Client *c = getFreeClient();
|
||||
if (!c) {
|
||||
user->handleDisconnected("Internal Server Error, please reconnect.");
|
||||
return;
|
||||
}
|
||||
user->setData(c);
|
||||
c->users.push_back(user);
|
||||
|
||||
|
|
|
@ -23,43 +23,46 @@ def run_spectrum(backend, test):
|
|||
)
|
||||
f.close()
|
||||
p = Popen("../spectrum/src/spectrum sample.cfg > " + backend + "_" + test + ".log 2>&1", shell=True)
|
||||
time.sleep(2)
|
||||
time.sleep(3)
|
||||
return p
|
||||
|
||||
def one_test_run():
|
||||
os.system("killall spectrum 2> /dev/null")
|
||||
os.system("rm *.log")
|
||||
|
||||
os.system("killall spectrum 2> /dev/null")
|
||||
os.system("rm *.log")
|
||||
|
||||
for backend in os.listdir("../backends"):
|
||||
if not os.path.isdir("../backends/" + backend) or backend == "CMakeFiles":
|
||||
continue
|
||||
|
||||
for d in os.listdir("."):
|
||||
binary = d + "/" + d + "_test"
|
||||
if not os.path.exists(binary):
|
||||
for backend in os.listdir("../backends"):
|
||||
if not os.path.isdir("../backends/" + backend) or backend == "CMakeFiles" or backend.startswith("libirc"):
|
||||
continue
|
||||
|
||||
p = run_spectrum(backend, d)
|
||||
for d in os.listdir("."):
|
||||
binary = d + "/" + d + "_test"
|
||||
if not os.path.exists(binary) or d.find("bad") != -1:
|
||||
continue
|
||||
|
||||
if backend.find("purple") >= 0:
|
||||
p = Popen(binary + " pyjim%jabber.cz@localhost test", shell=True)
|
||||
|
||||
else:
|
||||
p = Popen(binary + " testnickname%irc.freenode.net@localhost test", shell=True)
|
||||
p = run_spectrum(backend, d)
|
||||
|
||||
seconds = 0
|
||||
while p.poll() is None and seconds < 20:
|
||||
time.sleep(1)
|
||||
seconds += 1
|
||||
|
||||
if p.returncode == 0:
|
||||
print "[ PASS ]", backend, binary
|
||||
else:
|
||||
if seconds == 20:
|
||||
print "[ TIME ]", backend, binary
|
||||
if backend.find("purple") >= 0:
|
||||
p = Popen(binary + " pyjim%jabber.cz@localhost test", shell=True)
|
||||
|
||||
else:
|
||||
print "[ FAIL ]", backend, binary
|
||||
p = Popen(binary + " testnickname%irc.freenode.net@localhost test", shell=True)
|
||||
|
||||
os.system("killall spectrum 2> /dev/null")
|
||||
seconds = 0
|
||||
while p.poll() is None and seconds < 20:
|
||||
time.sleep(1)
|
||||
seconds += 1
|
||||
|
||||
if p.returncode == 0 and seconds < 20:
|
||||
print "[ PASS ]", backend, binary
|
||||
else:
|
||||
if seconds == 20:
|
||||
print "[ TIME ]", backend, binary
|
||||
else:
|
||||
print "[ FAIL ]", backend, binary
|
||||
|
||||
os.system("killall spectrum 2> /dev/null")
|
||||
|
||||
while True:
|
||||
one_test_run()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue