changeset 751:c7d9c5477d2f

Add a test for timeout on fifo
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 22 Sep 2011 21:10:00 +0200
parents 80cfbacdee40
children 9e9840ccf059
files tests/testfifo.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/testfifo.c	Thu Aug 25 20:05:49 2011 +0200
+++ b/tests/testfifo.c	Thu Sep 22 21:10:00 2011 +0200
@@ -187,6 +187,17 @@
 		CHECK( 0, fd_fifo_length(queue, &count) );
 		CHECK( 0, count);
 		
+		/* Check the timedget actually timesout */
+		CHECK(0, clock_gettime(CLOCK_REALTIME, &ts));
+		ts.tv_nsec += 1000000; /* 1 millisecond */
+		if (ts.tv_nsec >= 1000000000L) {
+			ts.tv_nsec -= 1000000000L;
+			ts.tv_sec += 1;
+		}
+		CHECK( ETIMEDOUT, fd_fifo_timedget(queue, &msg, &ts) );
+		CHECK( 0, fd_fifo_length(queue, &count) );
+		CHECK( 0, count);
+		
 		/* We're done for basic tests */
 		CHECK( 0, fd_fifo_del(&queue) );
 	}
"Welcome to our mercurial repository"