Module Name: src
Committed By: mgorny
Date: Sun Mar 8 22:08:46 UTC 2020
Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib/libc: Makefile
Added Files:
src/tests/lib/libc/nls: Makefile t_catalog.c
Log Message:
Add tests for missing libc catalog entries
To generate a diff of this commit:
cvs rdiff -u -r1.297 -r1.298 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.832 -r1.833 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.160 -r1.161 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.49 -r1.50 src/tests/lib/libc/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/nls/Makefile \
src/tests/lib/libc/nls/t_catalog.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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.297 src/distrib/sets/lists/debug/mi:1.298
--- src/distrib/sets/lists/debug/mi:1.297 Fri Mar 6 18:32:35 2020
+++ src/distrib/sets/lists/debug/mi Sun Mar 8 22:08:46 2020
@@ -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
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.832 src/distrib/sets/lists/tests/mi:1.833
--- src/distrib/sets/lists/tests/mi:1.832 Sun Mar 8 17:23:55 2020
+++ src/distrib/sets/lists/tests/mi Sun Mar 8 22:08:46 2020
@@ -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
Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.160 src/etc/mtree/NetBSD.dist.tests:1.161
--- src/etc/mtree/NetBSD.dist.tests:1.160 Fri Jan 17 16:09:11 2020
+++ src/etc/mtree/NetBSD.dist.tests Sun Mar 8 22:08:46 2020
@@ -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
Index: src/tests/lib/libc/Makefile
diff -u src/tests/lib/libc/Makefile:1.49 src/tests/lib/libc/Makefile:1.50
--- src/tests/lib/libc/Makefile:1.49 Sun Feb 17 12:24:17 2019
+++ src/tests/lib/libc/Makefile Sun Mar 8 22:08:46 2020
@@ -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
Added files:
Index: src/tests/lib/libc/nls/Makefile
diff -u /dev/null src/tests/lib/libc/nls/Makefile:1.1
--- /dev/null Sun Mar 8 22:08:46 2020
+++ src/tests/lib/libc/nls/Makefile Sun Mar 8 22:08:46 2020
@@ -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>
Index: src/tests/lib/libc/nls/t_catalog.c
diff -u /dev/null src/tests/lib/libc/nls/t_catalog.c:1.1
--- /dev/null Sun Mar 8 22:08:46 2020
+++ src/tests/lib/libc/nls/t_catalog.c Sun Mar 8 22:08:46 2020
@@ -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();
+}
+