From d40453e855e244478c2c39e1459834f474a0ee30 Mon Sep 17 00:00:00 2001 From: Reinhard Pfau Date: Fri, 6 Jun 2008 08:52:20 +0000 Subject: [PATCH] libt2n: (reinhard) fixed unit test. --- test/comm.cpp | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-) diff --git a/test/comm.cpp b/test/comm.cpp index 5bba916..688cbf0 100644 --- a/test/comm.cpp +++ b/test/comm.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -76,8 +77,10 @@ class test_comm : public TestFixture { socket_server ss("./socket"); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -106,8 +109,10 @@ class test_comm : public TestFixture socket_server ss("./socket"); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -176,8 +181,10 @@ class test_comm : public TestFixture socket_server ss("./socket"); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -194,6 +201,7 @@ class test_comm : public TestFixture con->write(string().insert(0,100*1024,'y')); } } + std::cerr << "child: OVER" << std::endl; // don't call atexit and stuff _exit(0); } @@ -247,8 +255,10 @@ class test_comm : public TestFixture { socket_server ss(6666); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -277,8 +287,10 @@ class test_comm : public TestFixture socket_server ss(6666); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -347,8 +359,10 @@ class test_comm : public TestFixture socket_server ss(6666); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); -- 1.7.1