From patchwork Thu Jul 9 18:28:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40009 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 09A5C3844033; Thu, 9 Jul 2020 18:28:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09A5C3844033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594319314; bh=qymiTa9XmrMT1ebXJMW/qAs9d0ZUUtokrAbGHTLc+vk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=aBm6jjR3H501EozU+r1QIyLgIqyT/L2GWX0kdSRM3HAcqr5BG0YP9J7tYYXgshtWr htWZYLWvdKCGw++ZPObxJpkZaEPavRM3XGfga+zFComKWAk2KNeN1IKVrK/VUTL7d8 HnnVSJiQ4MFG1ub0b71aBqBUMiVZ80WC7tgi9YTM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by sourceware.org (Postfix) with ESMTPS id 56656384B13D for ; Thu, 9 Jul 2020 18:28:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56656384B13D Received: by mail-qk1-x744.google.com with SMTP id e11so2785138qkm.3 for ; Thu, 09 Jul 2020 11:28:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qymiTa9XmrMT1ebXJMW/qAs9d0ZUUtokrAbGHTLc+vk=; b=l6JQ42BUwaIXt6lcEBiOAirF7gy/LNBTbhjBr2ABJwFiMz51q97bm9ou5hEl8FyEpq KRmbkapOkn/4Lu4qZaWd7gNKQXWoBVj3FxOPHpnqTYs2doOH/GDwk3gzn5xggl2ziRII 2eTJDApJns5c50GPvPxMKr3Q+yD9tB8wePEtTrxAWo/gxFDYCIgRZFVlUUgvn0GQSLeO HqurnJrpBaEzYdD6fjbA0IUK9Q4roy8lbjFhg7LGYn7EtP2eO+FJyT5gfdfhbt/C/xpf gkzGx0QSx/FGG3c03Un7nK9xfkdDXi1iDjt/gOIakbOtmWzg3hzZ5bT3DgkPY5swe46/ 2eHg== X-Gm-Message-State: AOAM532Zw38S7yWudn8S/H6XCcqHojkTTNo31hm9LwYQbZe+uKXxFJkg k9mAXeKGwOxQrSU2UkJ9rasosDsK+wc= X-Google-Smtp-Source: ABdhPJwa3h4hXDBiVIBu/ckCFfCdJ72s9qWUUjpJ6SPaDbtSAyoW9oniAL+fg5cOyHnTJ7nkkpEukA== X-Received: by 2002:a37:c50:: with SMTP id 77mr57064001qkm.445.1594319309664; Thu, 09 Jul 2020 11:28:29 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id u6sm4910355qtc.34.2020.07.09.11.28.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 11:28:29 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2] string: Make tst-strerror/tst-strsignal unsupported if msgfmt is not installed Date: Thu, 9 Jul 2020 15:28:25 -0300 Message-Id: <20200709182825.3437433-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Without msgfmt libc.mo files are not generated and its loading failure is silent ignored with xsetlocale. Also unset LANGUAGE environment variable to avoid it taking precedence when loading the message catalog. Although not strictly required (since the test is issued with test-container and it sets a strict environment variable) it follows other tests that deal with translation. Checked on x86_64-linux-gnu. --- string/Makefile | 11 ++++++++++- string/tst-strerror.c | 3 +++ string/tst-strsignal.c | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/string/Makefile b/string/Makefile index 206c9b103c..e958431f60 100644 --- a/string/Makefile +++ b/string/Makefile @@ -65,7 +65,16 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \ test-endian-sign-conversion tst-memmove-overflow \ test-sig_np -tests-container += tst-strsignal tst-strerror +# Both tests require the .mo translation files generated by msgfmt. +tests-translation := tst-strsignal \ + tst-strerror + +ifneq ($(MSGFMT),:) +tests-container += $(tests-translation) +else +tests += $(tests-translation) +tests-unsupported += $(tests-translation) +endif # This test allocates a lot of memory and can run for a long time. xtests = tst-strcoll-overflow diff --git a/string/tst-strerror.c b/string/tst-strerror.c index 3af51236d7..1fc202e4ea 100644 --- a/string/tst-strerror.c +++ b/string/tst-strerror.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -29,6 +30,8 @@ static int do_test (void) { + unsetenv ("LANGUAGE"); + xsetlocale (LC_ALL, "C"); TEST_COMPARE_STRING (strerror (EINVAL), "Invalid argument"); diff --git a/string/tst-strsignal.c b/string/tst-strsignal.c index 3f6764989f..2c549f4620 100644 --- a/string/tst-strsignal.c +++ b/string/tst-strsignal.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,8 @@ static int do_test (void) { + unsetenv ("LANGUAGE"); + xsetlocale (LC_ALL, "C"); TEST_COMPARE_STRING (strsignal (SIGINT), "Interrupt");