From: Reinhard Pfau Date: Fri, 6 Jun 2008 08:52:20 +0000 (+0000) Subject: libt2n: (reinhard) fixed unit test. X-Git-Tag: v0.4~29 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=d40453e855e244478c2c39e1459834f474a0ee30;hp=517d1214577af263bb4d6821e4e7ad9ba8c94901 libt2n: (reinhard) fixed unit test. --- 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);