Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add tests for missing libc catalog entries
details: https://anonhg.NetBSD.org/src/rev/2df0c25e3b5b
branches: trunk
changeset: 970010:2df0c25e3b5b
user: mgorny <mgorny%NetBSD.org@localhost>
date: Sun Mar 08 22:08:46 2020 +0000
description:
Add tests for missing libc catalog entries
diffstat:
distrib/sets/lists/debug/mi | 3 +-
distrib/sets/lists/tests/mi | 7 ++-
etc/mtree/NetBSD.dist.tests | 4 +-
tests/lib/libc/Makefile | 6 +-
tests/lib/libc/nls/Makefile | 9 +++
tests/lib/libc/nls/t_catalog.c | 97 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 120 insertions(+), 6 deletions(-)
diffs (204 lines):
diff -r 1d62ee579fc1 -r 2df0c25e3b5b distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi Sun Mar 08 22:06:05 2020 +0000
+++ b/distrib/sets/lists/debug/mi Sun Mar 08 22:08:46 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.297 2020/03/06 18:32:35 kamil Exp $
+# $NetBSD: mi,v 1.298 2020/03/08 22:08:46 mgorny Exp $
./etc/mtree/set.debug comp-sys-root
./usr/lib comp-sys-usr compatdir
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
@@ -2027,6 +2027,7 @@
./usr/libdata/debug/usr/tests/lib/libc/net/t_ether_aton.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/net/t_getprotoent.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/net/t_if_nametoindex.debug tests-lib-debug debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/nls/t_catalog.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/regex/h_regex.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/regex/h_regex_att.debug tests-obsolete obsolete,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/regex/t_exhaust.debug tests-lib-debug debug,atf,compattestfile
diff -r 1d62ee579fc1 -r 2df0c25e3b5b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Mar 08 22:06:05 2020 +0000
+++ b/distrib/sets/lists/tests/mi Sun Mar 08 22:08:46 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.832 2020/03/08 17:23:55 christos Exp $
+# $NetBSD: mi,v 1.833 2020/03/08 22:08:46 mgorny Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -107,6 +107,7 @@
./usr/libdata/debug/usr/tests/lib/libc/misc tests-lib-debug compattestfile,atf
./usr/libdata/debug/usr/tests/lib/libc/net tests-lib-debug compattestfile,atf
./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo tests-lib-debug compattestfile,atf
+./usr/libdata/debug/usr/tests/lib/libc/nls tests-lib-debug compattestfile,atf
./usr/libdata/debug/usr/tests/lib/libc/regex tests-lib-debug compattestfile,atf
./usr/libdata/debug/usr/tests/lib/libc/rpc tests-lib-debug compattestfile,atf
./usr/libdata/debug/usr/tests/lib/libc/setjmp tests-lib-debug compattestfile,atf
@@ -2965,6 +2966,10 @@
./usr/tests/lib/libc/net/t_nsdispatch tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/net/t_protoent tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/net/t_servent tests-lib-tests compattestfile,atf
+./usr/tests/lib/libc/nls tests-lib-tests compattestfile,atf
+./usr/tests/lib/libc/nls/Atffile tests-lib-tests compattestfile,atf
+./usr/tests/lib/libc/nls/Kyuafile tests-lib-tests compattestfile,atf,kyua
+./usr/tests/lib/libc/nls/t_catalog tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/regex tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/regex/Atffile tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/regex/Kyuafile tests-lib-tests compattestfile,atf,kyua
diff -r 1d62ee579fc1 -r 2df0c25e3b5b etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests Sun Mar 08 22:06:05 2020 +0000
+++ b/etc/mtree/NetBSD.dist.tests Sun Mar 08 22:08:46 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.dist.tests,v 1.160 2020/01/17 16:09:11 christos Exp $
+# $NetBSD: NetBSD.dist.tests,v 1.161 2020/03/08 22:08:46 mgorny Exp $
./usr/libdata/debug/usr/tests
./usr/libdata/debug/usr/tests/atf
@@ -88,6 +88,7 @@
./usr/libdata/debug/usr/tests/lib/libc/misc
./usr/libdata/debug/usr/tests/lib/libc/net
./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo
+./usr/libdata/debug/usr/tests/lib/libc/nls
./usr/libdata/debug/usr/tests/lib/libc/regex
./usr/libdata/debug/usr/tests/lib/libc/rpc
./usr/libdata/debug/usr/tests/lib/libc/setjmp
@@ -278,6 +279,7 @@
./usr/tests/lib/libc/net
./usr/tests/lib/libc/net/getaddrinfo
./usr/tests/lib/libc/net/getaddrinfo/data
+./usr/tests/lib/libc/nls
./usr/tests/lib/libc/regex
./usr/tests/lib/libc/regex/data
./usr/tests/lib/libc/rpc
diff -r 1d62ee579fc1 -r 2df0c25e3b5b tests/lib/libc/Makefile
--- a/tests/lib/libc/Makefile Sun Mar 08 22:06:05 2020 +0000
+++ b/tests/lib/libc/Makefile Sun Mar 08 22:08:46 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.49 2019/02/17 12:24:17 isaki Exp $
+# $NetBSD: Makefile,v 1.50 2020/03/08 22:08:46 mgorny Exp $
.include "Makefile.inc"
.include <bsd.own.mk>
@@ -6,8 +6,8 @@
SUBDIR+= tls_dso .WAIT sync
TESTS_SUBDIRS+= atomic
-TESTS_SUBDIRS+= c063 db gen hash inet locale misc net regex rpc setjmp stdlib
-TESTS_SUBDIRS+= stdio string sys termios time tls ttyio
+TESTS_SUBDIRS+= c063 db gen hash inet locale misc net nls regex rpc setjmp
+TESTS_SUBDIRS+= stdlib stdio string sys termios time tls ttyio
.if ${HAVE_SSP} == "yes"
TESTS_SUBDIRS+= ssp
diff -r 1d62ee579fc1 -r 2df0c25e3b5b tests/lib/libc/nls/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/nls/Makefile Sun Mar 08 22:08:46 2020 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2020/03/08 22:08:46 mgorny Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/lib/libc/nls
+
+TESTS_C+= t_catalog
+
+.include <bsd.test.mk>
diff -r 1d62ee579fc1 -r 2df0c25e3b5b tests/lib/libc/nls/t_catalog.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/nls/t_catalog.c Sun Mar 08 22:08:46 2020 +0000
@@ -0,0 +1,97 @@
+/* $NetBSD: t_catalog.c,v 1.1 2020/03/08 22:08:46 mgorny Exp $ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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 <sys/cdefs.h>
+__RCSID("$NetBSD: t_catalog.c,v 1.1 2020/03/08 22:08:46 mgorny Exp $");
+
+#include <atf-c.h>
+#include <errno.h>
+#include <stdio.h> /* Needed for sys_nerr on FreeBSD */
+#include <limits.h>
+#include <locale.h>
+#include <nl_types.h>
+#include <signal.h>
+#include <string.h>
+
+ATF_TC(catalog_errno);
+ATF_TC_HEAD(catalog_errno, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test whether C catalog covers all "
+ "errno values");
+}
+
+ATF_TC_BODY(catalog_errno, tc)
+{
+ int i;
+ nl_catd catd = catopen("libc", NL_CAT_LOCALE);
+ ATF_REQUIRE(catd);
+
+ for (i = 1; i < sys_nerr; i++) {
+ const char *strerr = sys_errlist[i];
+ const char *caterr = catgets(catd, 1, i, "");
+ ATF_CHECK_MSG(!strcmp(strerr, caterr),
+ "Catalog message mismatch for errno=%d (sys_errlist: '%s', "
+ "catalog: '%s')\n", i, strerr, caterr);
+ }
+
+ catclose(catd);
+}
+
+ATF_TC(catalog_signal);
+ATF_TC_HEAD(catalog_signal, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test whether C catalog covers all "
+ "signal values");
+}
+
+ATF_TC_BODY(catalog_signal, tc)
+{
+ int i;
+ nl_catd catd = catopen("libc", NL_CAT_LOCALE);
+ ATF_REQUIRE(catd);
+
+ for (i = 1; i < SIGRTMIN-1; i++) {
+ const char *strerr = sys_siglist[i];
+ const char *caterr = catgets(catd, 2, i, "");
+ ATF_CHECK_MSG(!strcmp(strerr, caterr),
+ "Catalog message mismatch for signal=%d (sys_siglist: '%s', "
+ "catalog: '%s')\n", i, strerr, caterr);
+ }
+
+ catclose(catd);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ (void)setlocale(LC_ALL, "C");
+
+ ATF_TP_ADD_TC(tp, catalog_errno);
+ ATF_TP_ADD_TC(tp, catalog_signal);
+
+ return atf_no_error();
+}
+
Home |
Main Index |
Thread Index |
Old Index