From patchwork Fri Jun 19 13:43:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 39682 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 6C9D63938C3B; Fri, 19 Jun 2020 13:44:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C9D63938C3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1592574254; 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=EyvW/sFG2JDrJlF8TEWHy2BhLJ7wFPhA0RC4B/rH8pilfNDnwr3JtbOb6qKgtzU0w fRBChMLtAMx0QUfaf2BorEalFGdWgkJ4gsZg6BYuQcJ3LJQhSOTY529HySQjL8P7/K YrgulpGT/NyPUqeSmUUjhXymwVxzlylAF+7n++s4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by sourceware.org (Postfix) with ESMTPS id 26429393C8B4 for ; Fri, 19 Jun 2020 13:44:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 26429393C8B4 Received: by mail-qt1-x844.google.com with SMTP id z2so5111677qts.5 for ; Fri, 19 Jun 2020 06:44:12 -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:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A27sSM+v4F/jOrKQp3CVijN1npFniMor9oE8PzFH++I=; b=d+MgnhjezIHYWV3G/Oft9/csA5P9BQFCZaR8MtbhNjiTZgRit66om+8SG+ulYfkpLC cLbHS5IZ10N8XoqCr3Eq1O8iSrollf/a2+iuEsEhyMvI4X/tppGJiomdumMRRkBooAmu YRXm6YBpp+YUBM2GfCGz/2RydFn2FivHvRguJYWLNXSMNHggho4Epp7x9ZebWExbzwNO 7GwvBRil8Z6CJBOuD69GUgAJZzd+e4unHxD2LLQfL315/eX0NIfmIp+4ddvo3+gSOc22 Sl6KU5WIWOqgv0gHuIfr8FWprNalxjIA85tvGz3sdlxB7o+6vcSN2oiB3cQVo40U5Ctr +M8A== X-Gm-Message-State: AOAM531Zi6mD8U7XefCHpnTrrIqFaWwpuLFrg7l+lrb0pGxI7Z9QoO+5 NE9XjLK9Cjgujv0T97uzIbj8kmEl3WY= X-Google-Smtp-Source: ABdhPJwqBdbBArrkxBFrQ0Mn1HXlBd2naD0nTfnHqANCWeg/Gx7yyC49sfjPrbKgN5IFgKS5VQR7qw== X-Received: by 2002:ac8:4ccb:: with SMTP id l11mr3339300qtv.18.1592574251406; Fri, 19 Jun 2020 06:44:11 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id p203sm6379435qke.132.2020.06.19.06.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 06:44:11 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v5 09/13] string: Add strsignal test Date: Fri, 19 Jun 2020 10:43:48 -0300 Message-Id: <20200619134352.297146-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200619134352.297146-1-adhemerval.zanella@linaro.org> References: <20200619134352.297146-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.7 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 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. Tested-by: Carlos O'Donell Reviewed-by: Carlos O'Donell --- 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