Module Name: src
Committed By: pgoyette
Date: Thu Jan 6 17:20:48 UTC 2011
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libc: Makefile
Added Files:
src/tests/lib/libc: t_mktime.c
Log Message:
Atf-ify test for mktime(3)
To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.21 -r1.22 src/tests/lib/libc/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/t_mktime.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.213 src/distrib/sets/lists/tests/mi:1.214
--- src/distrib/sets/lists/tests/mi:1.213 Thu Jan 6 15:19:09 2011
+++ src/distrib/sets/lists/tests/mi Thu Jan 6 17:20:48 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.213 2011/01/06 15:19:09 njoly Exp $
+# $NetBSD: mi,v 1.214 2011/01/06 17:20:48 pgoyette Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -388,6 +388,7 @@
./usr/libdata/debug/usr/tests/lib/libc/t_gdtoa.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/t_hsearch.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/t_inet.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/t_mktime.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/t_ptm.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/t_randomid.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/t_strptime.debug tests-lib-debug debug,atf
@@ -1684,6 +1685,7 @@
./usr/tests/lib/libc/t_gdtoa tests-lib-tests atf
./usr/tests/lib/libc/t_hsearch tests-lib-tests atf
./usr/tests/lib/libc/t_inet tests-lib-tests atf
+./usr/tests/lib/libc/t_mktime tests-lib-tests atf
./usr/tests/lib/libc/t_nsdispatch tests-lib-tests atf
./usr/tests/lib/libc/t_protoent tests-lib-tests atf
./usr/tests/lib/libc/t_ptm tests-lib-tests atf
Index: src/tests/lib/libc/Makefile
diff -u src/tests/lib/libc/Makefile:1.21 src/tests/lib/libc/Makefile:1.22
--- src/tests/lib/libc/Makefile:1.21 Wed Jan 5 21:17:04 2011
+++ src/tests/lib/libc/Makefile Thu Jan 6 17:20:48 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2011/01/05 21:17:04 pgoyette Exp $
+# $NetBSD: Makefile,v 1.22 2011/01/06 17:20:48 pgoyette Exp $
.include <bsd.own.mk>
.include <bsd.sys.mk>
@@ -17,6 +17,7 @@
TESTS_C+= t_gdtoa
TESTS_C+= t_hsearch
TESTS_C+= t_inet
+TESTS_C+= t_mktime
TESTS_C+= t_ptm
TESTS_C+= t_randomid
TESTS_C+= t_strptime
Added files:
Index: src/tests/lib/libc/t_mktime.c
diff -u /dev/null src/tests/lib/libc/t_mktime.c:1.1
--- /dev/null Thu Jan 6 17:20:48 2011
+++ src/tests/lib/libc/t_mktime.c Thu Jan 6 17:20:48 2011
@@ -0,0 +1,65 @@
+/* $NetBSD: t_mktime.c,v 1.1 2011/01/06 17:20:48 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <atf-c.h>
+
+#include <err.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+
+ATF_TC(mktime);
+
+ATF_TC_HEAD(mktime, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Test mktime(3) with negative year");
+}
+
+ATF_TC_BODY(mktime, tc)
+{
+ struct tm tms;
+
+ (void)memset(&tms, 0, sizeof(tms));
+ tms.tm_year = ~0;
+
+ errno = 0;
+
+ ATF_REQUIRE_ERRNO(errno, mktime(&tms) != (time_t)-1);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, mktime);
+
+ return atf_no_error();
+}