tests: Sockets: adapt to have reproducible output and enable autotest

Change-Id: I5414076c6846b849973bcdeb3f2358b28dcb004c
This commit is contained in:
Pau Espin 2018-01-09 19:45:15 +01:00
parent 2edbe4d366
commit 2f376a3edf
3 changed files with 13 additions and 10 deletions

View File

@ -44,7 +44,7 @@ void *testReaderIP(void *)
char buf[MAX_UDP_LENGTH];
int count = readSocket.read(buf, MAX_UDP_LENGTH);
if (count>0) {
COUT("read: " << buf);
CERR("read: " << buf);
rc++;
} else {
sleep(2);
@ -65,7 +65,7 @@ void *testReaderUnix(void *)
buf[MAX_UDP_LENGTH] = '\0';
int count = readSocket.read(buf, MAX_UDP_LENGTH);
if (count>0) {
COUT("read: " << buf);
CERR("read: " << buf);
rc++;
} else {
sleep(2);
@ -85,20 +85,22 @@ int main(int argc, char * argv[] )
UDPSocket socket1("127.0.0.1", 5061, "127.0.0.1", 5934);
UDDSocket socket1U("testSource","testDestination");
COUT("socket1: " << socket1.port());
CERR("socket1: " << socket1.port());
// give the readers time to open
sleep(1);
for (int i=0; i<gNumToSend; i++) {
socket1.write("Hello IP land");
socket1.write("Hello IP land");
socket1U.write("Hello Unix domain");
sleep(1);
}
readerThreadIP.join();
readerThreadUnix.join();
printf("Done\n");
}
// vim: ts=4 sw=4

View File

@ -0,0 +1 @@
Done

View File

@ -26,11 +26,11 @@ cat $abs_srcdir/CommonLibs/PRBSTest.ok > expout
AT_CHECK([$abs_top_builddir/tests/CommonLibs/PRBSTest], [], [expout], [])
AT_CLEANUP
#AT_SETUP([SocketsTest])
#AT_KEYWORDS([SocketsTest])
#cat $abs_srcdir/CommonLibs/SocketsTest.ok > expout
#AT_CHECK([$abs_top_builddir/tests/CommonLibs/SocketsTest], [], [expout], [])
#AT_CLEANUP
AT_SETUP([SocketsTest])
AT_KEYWORDS([SocketsTest])
cat $abs_srcdir/CommonLibs/SocketsTest.ok > expout
AT_CHECK([$abs_top_builddir/tests/CommonLibs/SocketsTest], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([TimevalTest])
AT_KEYWORDS([TimevalTest])