martin3's picture

Beginning to work with this very nice and important API. In fact I'm studying it as an example of good coding and project management. So I also am setting up unit testing the same way for my plugin development reusing the WebServerTests_F fixture.

Runnning into: it starts up the WebServer, loads my plugin and then the thread scheduler starts and then goes no further. version 2.0.10

Running 1 test case...
me checkSendRequestsAndReceiveResponses
1250263964 INFO pion.net.WebServer Added request handler for HTTP resource: /divcon
1250263964 INFO pion.net.WebServer Loaded web service plug-in for resource (/divcon): QBDivconService
1250263964 INFO pion.net.WebServer Starting server on port 8080
1250263964 INFO pion.PionScheduler Starting thread scheduler

Not sure how to get more information about what is going on. Is there a permissions problem? I'm using boost 1.39. Is there a config issue? Do I need to set up my own security key and authentication or can I use the one that comes with pion for testing?

testservices.conf

##
## Simple configuration file to test qb divcon web services
##

## Adds path to compiled web service
##
path ./dist/Debug/GNU-Linux-x86

## QB Divcon Service
##
service /divcon DivconService

##
## define type of authentication
##
## MUST be a first command in configuration file
## auth type can be defined once and only once!
##
auth cookie

##
## Add /auth resource to set of password protected
##
restrict /auth

##
## Add /protected resource to set of password protected
##
restrict /protected

##
## define user
##
user stas 123456

##
## define user
##
user mike 123456

also tried with version 2.1.4 and no better. When I run Pion's make check I get

...
argv[0] = /net/frodo/home/roger/Software/pion-net-2.1.4/net/tests/.libs/lt-PionNetUnitTests
Running 163 test cases...
global teardown for all pion unit tests
global teardown specific to pion-net

*** No errors detected
PASS: PionNetUnitTests
==================
All 1 tests passed
==================
...

I would expect more messages for the 163 test cases?

Mike Dickey's picture
We removed all output from

We removed all output from the unit tests, so as long as it says "All 1 tests passed" you should be good. To get the old verbose output, cd to "net/tests" and run "./PionNetUnitTests -v", or for even more try "./PionNetUnitTests --log_level=all"

Submitted by Mike Dickey on Mon, 08/17/2009 - 12:39.
martin3's picture
FYI I've now traced through

FYI

I've now traced through to

void PionScheduler::keepRunning(boost::asio::io_service& my_service,
boost::asio::deadline_timer& my_timer)
{
if (m_is_running) {
// schedule this again to make sure the service doesn't complete
std::cout << " PionScheduler::keepRunning <<KEEP_RUNNING_TIMER_SECONDS<<std::endl;
my_timer.expires_from_now(boost::posix_time::seconds(KEEP_RUNNING_TIMER_SECONDS));
std::cout << " async_wait <<KEEP_RUNNING_TIMER_SECONDS<<std::endl;
my_timer.async_wait(boost::bind(&PionScheduler::keepRunning, this,
boost::ref(my_service), boost::ref(my_timer)));
std::cout << " async_wait'ed <<KEEP_RUNNING_TIMER_SECONDS<<std::endl;
}
}


where it never comes out of the my_timer.async_wait. This is with boost 1.39 with which I've run all the builds and pion unit tests.

Now in my own unit test I'm running the

BOOST_AUTO_TEST_CASE(checkWebServerIsListening) {
cout << "me checkWebServerIsListening "<<endl;
BOOST_CHECK(! m_server.isListening());
cout << "me checkWebServerIsListening start "<<endl;
m_server.start();
BOOST_CHECK(m_server.isListening());
cout << "me checkWebServerIsListening listened"<<endl;
m_server.stop();
BOOST_CHECK(! m_server.isListening());
}

where it is hung at m_server.start(); Appears to be more a boost issue so I'm now trying to setup a small test case to learn about the boost deadline_timer.

Submitted by martin3 on Mon, 08/24/2009 - 06:37.