Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys add more test cases for nanosleep
details: https://anonhg.NetBSD.org/src/rev/fc9e2c7dfdd0
branches: trunk
changeset: 785828:fc9e2c7dfdd0
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 31 16:47:16 2013 +0000
description:
add more test cases for nanosleep
diffstat:
tests/lib/libc/sys/t_nanosleep.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (43 lines):
diff -r 4568912fc32c -r fc9e2c7dfdd0 tests/lib/libc/sys/t_nanosleep.c
--- a/tests/lib/libc/sys/t_nanosleep.c Sun Mar 31 16:46:29 2013 +0000
+++ b/tests/lib/libc/sys/t_nanosleep.c Sun Mar 31 16:47:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_nanosleep.c,v 1.2 2012/03/31 11:41:33 jruoho Exp $ */
+/* $NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_nanosleep.c,v 1.2 2012/03/31 11:41:33 jruoho Exp $");
+__RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $");
#include <sys/time.h>
#include <sys/wait.h>
@@ -104,12 +104,21 @@
{
struct timespec ts;
- ts.tv_sec = -1;
- ts.tv_nsec = 1000;
-
+ ts.tv_sec = 1;
+ ts.tv_nsec = -1;
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, nanosleep(&ts, NULL) == -1);
+ ts.tv_sec = 1;
+ ts.tv_nsec = 1000000000;
+ errno = 0;
+ ATF_REQUIRE_ERRNO(EINVAL, nanosleep(&ts, NULL) == -1);
+
+ ts.tv_sec = -1;
+ ts.tv_nsec = 0;
+ errno = 0;
+ ATF_REQUIRE_ERRNO(0, nanosleep(&ts, NULL) == 0);
+
errno = 0;
ATF_REQUIRE_ERRNO(EFAULT, nanosleep((void *)-1, NULL) == -1);
}
Home |
Main Index |
Thread Index |
Old Index