Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src After a comedy of errors, move t_mbtowc to its final resting...



details:   https://anonhg.NetBSD.org/src/rev/414fa8182ea8
branches:  trunk
changeset: 1011458:414fa8182ea8
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Jun 30 16:09:40 2020 +0000

description:
After a comedy of errors, move t_mbtowc to its final resting place.

diffstat:

 distrib/sets/lists/debug/mi      |   4 +-
 distrib/sets/lists/tests/mi      |   4 +-
 tests/lib/libc/locale/t_mbtowc.c |  84 +++++++++++++++++++++++++++++++++++----
 tests/lib/libc/stdlib/Makefile   |   3 +-
 tests/lib/libc/stdlib/t_mbtowc.c |  75 -----------------------------------
 5 files changed, 80 insertions(+), 90 deletions(-)

diffs (268 lines):

diff -r 8f40a87cbfc8 -r 414fa8182ea8 distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi       Tue Jun 30 15:02:55 2020 +0000
+++ b/distrib/sets/lists/debug/mi       Tue Jun 30 16:09:40 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.320 2020/06/29 23:44:01 riastradh Exp $
+# $NetBSD: mi,v 1.321 2020/06/30 16:09:40 jruoho 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
@@ -2090,7 +2090,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_getenv.debug           tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_getenv_thread.debug    tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_hsearch.debug          tests-lib-debug         debug,atf,compattestfile
-./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mbtowc.debug           tests-lib-debug         debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mbtowc.debug           tests-obsolete          obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mi_vector_hash.debug   tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mktemp.debug           tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_posix_memalign.debug   tests-lib-debug         debug,atf,compattestfile
diff -r 8f40a87cbfc8 -r 414fa8182ea8 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Jun 30 15:02:55 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Jun 30 16:09:40 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.865 2020/06/30 14:30:49 jruoho Exp $
+# $NetBSD: mi,v 1.866 2020/06/30 16:09:40 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3075,7 +3075,7 @@
 ./usr/tests/lib/libc/stdlib/t_getenv_thread    tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libc/stdlib/t_getopt           tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libc/stdlib/t_hsearch          tests-lib-tests         compattestfile,atf
-./usr/tests/lib/libc/stdlib/t_mbtowc           tests-lib-tests         compattestfile,atf
+./usr/tests/lib/libc/stdlib/t_mbtowc           tests-obsolete          obsolete
 ./usr/tests/lib/libc/stdlib/t_mi_vector_hash   tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libc/stdlib/t_mktemp           tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libc/stdlib/t_posix_memalign   tests-lib-tests         compattestfile,atf
diff -r 8f40a87cbfc8 -r 414fa8182ea8 tests/lib/libc/locale/t_mbtowc.c
--- a/tests/lib/libc/locale/t_mbtowc.c  Tue Jun 30 15:02:55 2020 +0000
+++ b/tests/lib/libc/locale/t_mbtowc.c  Tue Jun 30 16:09:40 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mbtowc.c,v 1.2 2017/05/25 18:28:54 perseant Exp $ */
+/* $NetBSD: t_mbtowc.c,v 1.3 2020/06/30 16:09:40 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -53,13 +53,42 @@
  *
  */
 
+/*-
+ * Copyright (c) 2005 Miloslav Trmac
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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>
 __COPYRIGHT("@(#) Copyright (c) 2011\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mbtowc.c,v 1.2 2017/05/25 18:28:54 perseant Exp $");
+__RCSID("$NetBSD: t_mbtowc.c,v 1.3 2020/06/30 16:09:40 jruoho Exp $");
 
 #include <errno.h>
+#include <langinfo.h>
 #include <locale.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -69,7 +98,8 @@
 #include <atf-c.h>
 
 static void
-h_mbtowc(const char *locale, const char *illegal, const char *legal, size_t stateful)
+h_mbtowc(const char *locale, const char *illegal,
+    const char *legal, size_t stateful)
 {
        char buf[64];
        size_t ret;
@@ -97,7 +127,10 @@
        (void)printf("errno: %s\n", strerror(errno));
        ATF_REQUIRE_EQ(errno, EILSEQ);
 
-       /* if this is stateless encoding, this re-initialization is not required. */
+       /*
+        * If this is stateless encoding, this
+        * re-initialization is not required.
+        */
        if (stateful) {
                /* re-initialize internal state */
                mbtowc(NULL, NULL, 0);
@@ -117,12 +150,13 @@
        (void)printf("Ok.\n");
 }
 
-ATF_TC(mbtowc);
-ATF_TC_HEAD(mbtowc, tc)
+ATF_TC(mbtowc_basic);
+ATF_TC_HEAD(mbtowc_basic, tc)
 {
-       atf_tc_set_md_var(tc, "descr", "Checks mbtowc(3)");
+       atf_tc_set_md_var(tc, "descr", "A basic test of mbtowc(3)");
 }
-ATF_TC_BODY(mbtowc, tc)
+
+ATF_TC_BODY(mbtowc_basic, tc)
 {
        h_mbtowc("en_US.UTF-8", "\240", "\302\240", 0);
        h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B", 1);
@@ -133,9 +167,41 @@
        h_mbtowc("zh_TW.eucTW", "\241", "\241\241", 0);
 }
 
+ATF_TC(mbtowc_sign);
+ATF_TC_HEAD(mbtowc_sign, tc)
+{
+       atf_tc_set_md_var(tc, "descr", "Test mbtowc(3) sign conversion");
+}
+
+ATF_TC_BODY(mbtowc_sign, tc)
+{
+       char back[MB_LEN_MAX];
+       wchar_t wc;
+       size_t i;
+       int ret;
+
+       (void)setlocale(LC_ALL, "");
+       (void)printf("Charset: %s\n", nl_langinfo(CODESET));
+       ret = mbtowc(&wc, "\xe4", 1);
+       (void)printf("mbtowc(): %d\n", ret);
+
+       if (ret > 0) {
+               (void)printf("Result: 0x%08lX\n",(unsigned long)wc);
+               ret = wctomb(back, wc);
+               (void)printf("wctomb(): %d\n", ret);
+               for(i = 0; ret > 0 && i < (size_t)ret; i++)
+                       printf("%02X ",(unsigned char)back[i]);
+               putchar('\n');
+       }
+
+       ATF_REQUIRE(ret > 0);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
-       ATF_TP_ADD_TC(tp, mbtowc);
+
+       ATF_TP_ADD_TC(tp, mbtowc_basic);
+       ATF_TP_ADD_TC(tp, mbtowc_sign);
 
        return atf_no_error();
 }
diff -r 8f40a87cbfc8 -r 414fa8182ea8 tests/lib/libc/stdlib/Makefile
--- a/tests/lib/libc/stdlib/Makefile    Tue Jun 30 15:02:55 2020 +0000
+++ b/tests/lib/libc/stdlib/Makefile    Tue Jun 30 16:09:40 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.31 2020/06/29 14:22:11 jruoho Exp $
+# $NetBSD: Makefile,v 1.32 2020/06/30 16:09:40 jruoho Exp $
 
 .include <bsd.own.mk>
 
@@ -11,7 +11,6 @@
 TESTS_C+=      t_getenv_thread
 TESTS_C+=      t_exit
 TESTS_C+=      t_hsearch
-TESTS_C+=      t_mbtowc
 TESTS_C+=      t_mktemp
 TESTS_C+=      t_mi_vector_hash
 TESTS_C+=      t_posix_memalign
diff -r 8f40a87cbfc8 -r 414fa8182ea8 tests/lib/libc/stdlib/t_mbtowc.c
--- a/tests/lib/libc/stdlib/t_mbtowc.c  Tue Jun 30 15:02:55 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*     $NetBSD: t_mbtowc.c,v 1.3 2020/06/29 20:53:40 maya Exp $ */
-
-/*-
- * Copyright (c) 2005 Miloslav Trmac
- * 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
- */
-
-/* From: Miloslav Trmac <mitr%volny.cz@localhost> */
-
-#include <atf-c.h>
-#include <langinfo.h>
-#include <limits.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-ATF_TC(mbtowc_sign);
-ATF_TC_HEAD(mbtowc_sign, tc)
-{
-       atf_tc_set_md_var(tc, "descr", "Test mbtowc(3) sign conversion");
-}
-
-ATF_TC_BODY(mbtowc_sign, tc)
-{
-       char back[MB_LEN_MAX];
-       wchar_t wc;
-       size_t i;
-       int ret;
-
-       (void)setlocale(LC_ALL, "");
-       (void)printf("Charset: %s\n", nl_langinfo(CODESET));
-       ret = mbtowc(&wc, "\xe4", 1);
-       (void)printf("mbtowc(): %d\n", ret);
-
-       if (ret > 0) {
-               (void)printf("Result: 0x%08lX\n",(unsigned long)wc);
-               ret = wctomb(back, wc);
-               (void)printf("wctomb(): %d\n", ret);
-               for(i = 0; ret > 0 && i < (size_t)ret; i++)
-                       printf("%02X ",(unsigned char)back[i]);
-               putchar('\n');
-       }
-
-       ATF_REQUIRE(ret > 0);
-}
-
-ATF_TP_ADD_TCS(tp)
-{
-
-       ATF_TP_ADD_TC(tp, mbtowc_sign);
-
-       return atf_no_error();
-}



Home | Main Index | Thread Index | Old Index