From patchwork Wed Jun 3 18:34:40 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: 39463 X-Patchwork-Delegate: carlos@redhat.com 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 B5EFB388C038; Wed, 3 Jun 2020 18:35:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5EFB388C038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591209305; bh=A27sSM+v4F/jOrKQp3CVijN1npFniMor9oE8PzFH++I=; 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=gWntzfyPqb0dDpJkYQzlAlEhjeTQU/c0toWbOCQOoqRi3RV8Bq83iiBHTax/HybzN uasbBAgvh/EX11wFK6cYV4N/M/y6pih0bcrTMQhe0YQC7KoIJgwFqC+N0KDfCCMjHa k9w2uTgkY3vrav472lw7YYmy/zKXMVTFqoMBeYuc= 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 B7A22388C023 for ; Wed, 3 Jun 2020 18:35:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B7A22388C023 Received: by mail-qk1-x744.google.com with SMTP id n141so3258320qke.2 for ; Wed, 03 Jun 2020 11:35:03 -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=A27sSM+v4F/jOrKQp3CVijN1npFniMor9oE8PzFH++I=; b=FCB3caPWZQ6hkrLb2U88DIm6R2dPy0ACQMu+JSpZjIu8lGqKZshtDe5Wjmy3i5NG9Y 0b0n4RmYLBvzWecP8zLJka7CEjhsci2n30aHB/c5ROuDn2TyTqvL5YnYkD9Y63gy+QrQ iB0WOMqNKE8KzxfB3Ezqdi5Gb3GGFSoavC8Imq5gReu3bnYpI1ryUtnBwF5ATtYWi6i2 rXN0Oyfgb6R92GU7lleb1HE1kbggIXCI4Rj5V9O/Mo7jsN9L7byqBz4NNlJoi0t8Q2LD 9OonLAZGg2wx9rLy1SxokJpHBtoLqRuTRVSnkqYrBnv2mzWDszci2krJn6Nma2kolRca 9YtQ== X-Gm-Message-State: AOAM531EKVBj1DBcIN+M38Swd1owpHk84/unXVUDaj8D18LaEqC7kKjO 92l4jD7yUxF2+f6dtSQXVg0H5j+IiWU= X-Google-Smtp-Source: ABdhPJzcX1mKrzaXJDuZ7Jt/iwaAKWm0vAWLLN8jZZLEMLD0peZfS9o/OPYacT4lw3YgKEw7VstMoA== X-Received: by 2002:ae9:f80f:: with SMTP id x15mr1083201qkh.52.1591209303018; Wed, 03 Jun 2020 11:35:03 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id z77sm1507361qka.59.2020.06.03.11.35.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 11:35:02 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 09/13] string: Add strsignal test Date: Wed, 3 Jun 2020 15:34:40 -0300 Message-Id: <20200603183444.587742-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200603183444.587742-1-adhemerval.zanella@linaro.org> References: <20200603183444.587742-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-15.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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" Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. --- string/Makefile | 5 +++- string/tst-strsignal.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 string/tst-strsignal.c diff --git a/string/Makefile b/string/Makefile index e1cca5516b..470ff77ded 100644 --- a/string/Makefile +++ b/string/Makefile @@ -65,6 +65,8 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \ # This test allocates a lot of memory and can run for a long time. xtests = tst-strcoll-overflow +tests-container += tst-strsignal + # This test needs libdl. ifeq (yes,$(build-shared)) tests += test-strerror-errno @@ -105,7 +107,7 @@ $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \ tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \ - da_DK.ISO-8859-1 en_GB.UTF-8 + da_DK.ISO-8859-1 en_GB.UTF-8 pt_BR.UTF-8 include ../gen-locales.mk $(objpfx)test-strcasecmp.out: $(gen-locales) @@ -115,5 +117,6 @@ $(objpfx)tst-strxfrm2.out: $(gen-locales) # bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1. $(objpfx)bug-strcoll2.out: $(gen-locales) $(objpfx)tst-strcoll-overflow.out: $(gen-locales) +$(objpfx)tst-strsignal.out: $(gen-locales) endif diff --git a/string/tst-strsignal.c b/string/tst-strsignal.c new file mode 100644 index 0000000000..93a46dbc78 --- /dev/null +++ b/string/tst-strsignal.c @@ -0,0 +1,57 @@ +/* Test for strsignal. + + Copyright (C) 2020 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 + +#include +#include + +static int +do_test (void) +{ + xsetlocale (LC_ALL, "C"); + + TEST_COMPARE_STRING (strsignal (SIGINT), "Interrupt"); + TEST_COMPARE_STRING (strsignal (-1), "Unknown signal -1"); +#ifdef SIGRTMIN + TEST_COMPARE_STRING (strsignal (SIGRTMIN), "Real-time signal 0"); +#endif +#ifdef SIGRTMAX + TEST_COMPARE_STRING (strsignal (SIGRTMAX+1), "Unknown signal 65"); +#endif + + xsetlocale (LC_ALL, "pt_BR.UTF-8"); + + TEST_COMPARE_STRING (strsignal (SIGINT), "Interrup\xc3\xa7\xc3\xa3\x6f"); + TEST_COMPARE_STRING (strsignal (-1), "Sinal desconhecido -1"); +#ifdef SIGRTMI + TEST_COMPARE_STRING (strsignal (SIGRTMIN), "Sinal de tempo-real 0"); +#endif +#ifdef SIGRTMAX + TEST_COMPARE_STRING (strsignal (SIGRTMAX+1), "Sinal desconhecido 65"); +#endif + + return 0; +} + +#include