From patchwork Mon Sep 4 13:33:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 75221 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E90E33858428 for ; Mon, 4 Sep 2023 13:33:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E90E33858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693834423; bh=2wQHGvcfQpYVzwugEec5YMUUrs+sunHwI3zTpmnqADw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XGf1246WTM6KjcYUaD5rlBUsNivXHSMhNO0twboH3vmsqjrBCexYo7JKwecjC4rp5 uOsZCxFB+2DdztIdM/DaB1plKAU1EJLhmnc2zEj+gvjM+YDhM6dKALlfKBWXFxZTsV 2dLTRGW55lEGK0QE3LRRw7znQeRIhQpG86boPjzQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DF6E33858425 for ; Mon, 4 Sep 2023 13:33:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF6E33858425 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-DGynikBIPQ-7d2tpM5651Q-1; Mon, 04 Sep 2023 09:33:20 -0400 X-MC-Unique: DGynikBIPQ-7d2tpM5651Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4B7F38041D1 for ; Mon, 4 Sep 2023 13:33:19 +0000 (UTC) Received: from oldenburg3.str.redhat.com (unknown [10.39.194.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E386140E963 for ; Mon, 4 Sep 2023 13:33:19 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] intl: Add test case for bug 16621 Date: Mon, 04 Sep 2023 15:33:18 +0200 Message-ID: <87o7iiukpt.fsf@oldenburg3.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-34.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" --- intl/Makefile | 6 +++++- intl/tst-gettext-c-utf8.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) base-commit: 2897b231a6b71ee17d47d3d63f1112b2641a476c Reviewed-by: Adhemerval Zanella diff --git a/intl/Makefile b/intl/Makefile index d7223256eb..a6dd138dad 100644 --- a/intl/Makefile +++ b/intl/Makefile @@ -32,7 +32,10 @@ test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3 ifeq ($(have-thread-library),yes) test-srcs += $(multithread-test-srcs) endif -tests = tst-ngettext +tests = \ + tst-gettext-c-utf8 \ + tst-ngettext \ + # tests before-compile += $(objpfx)msgs.h @@ -117,6 +120,7 @@ $(objpfx)tst-gettext3.out: $(gen-locales) $(objpfx)tst-gettext4.out: $(gen-locales) $(objpfx)tst-gettext5.out: $(gen-locales) $(objpfx)tst-gettext6.out: $(gen-locales) +$(objpfx)tst-gettext-c-utf8.out: $(gen-locales) $(objpfx)tst-translit.out: $(gen-locales) endif diff --git a/intl/tst-gettext-c-utf8.c b/intl/tst-gettext-c-utf8.c new file mode 100644 index 0000000000..bdb9b5396c --- /dev/null +++ b/intl/tst-gettext-c-utf8.c @@ -0,0 +1,37 @@ +/* Check that C.UTF-8 uses C translations (bug 16621). + Copyright (C) 2021-2023 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include + +static int +do_test (void) +{ + if (setenv ("LANGUAGE", "de_DE.UTF-8", 1) != 0) + FAIL_EXIT1 ("setenv"); + if (setenv ("LC_ALL", "C.UTF-8", 1) != 0) + FAIL_EXIT1 ("setenv"); + xsetlocale (LC_ALL, ""); + TEST_COMPARE_STRING (strerror (ENOENT), "No such file or directory"); + return 0; +} + +#include