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

Change-Id: I5414076c6846b849973bcdeb3f2358b28dcb004c
changes/11/5711/2
Pau Espin 5 years ago
parent 2edbe4d366
commit 2f376a3edf
  1. 12
      tests/CommonLibs/SocketsTest.cpp
  2. 1
      tests/CommonLibs/SocketsTest.ok
  3. 10
      tests/testsuite.at

@ -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

@ -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])

Loading…
Cancel
Save