Changeset - 04f7a0378047
[Not reviewed]
0 4 0
Jan Kaluza - 14 years ago 2011-06-08 16:36:30
hanzz.k@gmail.com
Fixed some bad bugs + improved tests
4 files changed with 25 insertions and 18 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -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]);
 
}
src/networkplugin.cpp
Show inline comments
 
@@ -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;
src/networkpluginserver.cpp
Show inline comments
 
@@ -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);
 

	
tests/runtests.py
Show inline comments
 
@@ -23,20 +23,20 @@ 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")
 

	
 
	for backend in os.listdir("../backends"):
 
	if not os.path.isdir("../backends/" + backend) or backend == "CMakeFiles":
 
		if not os.path.isdir("../backends/" + backend) or backend == "CMakeFiles" or backend.startswith("libirc"):
 
			continue
 

	
 
		for d in os.listdir("."):
 
			binary = d + "/" + d + "_test"
 
		if not os.path.exists(binary):
 
			if not os.path.exists(binary) or d.find("bad") != -1:
 
				continue
 

	
 
			p = run_spectrum(backend, d)
 
@@ -52,7 +52,7 @@ for backend in os.listdir("../backends"):
 
				time.sleep(1)
 
				seconds += 1
 

	
 
		if p.returncode == 0:
 
			if p.returncode == 0 and seconds < 20:
 
				print "[ PASS ]", backend, binary
 
			else:
 
				if seconds == 20:
 
@@ -62,4 +62,7 @@ for backend in os.listdir("../backends"):
 

	
 
			os.system("killall spectrum 2> /dev/null")
 

	
 
while True:
 
	one_test_run()
 

	
 

	
0 comments (0 inline, 0 general)