From patchwork Tue Jun 13 10:08:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dridi Boukelmoune X-Patchwork-Id: 71030 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 EF3DF3857728 for ; Tue, 13 Jun 2023 10:09:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF3DF3857728 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686650970; bh=Tl8XhT9K0NCH7CY/qj+Vg9i7q1z1NHBVR1YgJk0v5Io=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=R12ua8xcu5EBSBOW8n45dhBbZgsI2XWNrKYp5wjr2f+BHLqrvD52+9lTHe5IfB9Cq KR95DDdz8RnyuQmfUg19NnpXmc4gu2PmWgTpLqAYCUbixQr4+dO/wrzKQ5X944vTPB uKMCLc/tatH47LoBMVLoO0RK0lDNBJTN2aAg+PN0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 5AD153858020 for ; Tue, 13 Jun 2023 10:09:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AD153858020 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f62b552751so6409576e87.3 for ; Tue, 13 Jun 2023 03:09:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686650944; x=1689242944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tl8XhT9K0NCH7CY/qj+Vg9i7q1z1NHBVR1YgJk0v5Io=; b=K/qFvMsn2rrsPbOq1sXOKr1rvcGQdl+CIPxkEeUc1bSp9qYiaBddfAifiN9Fh8hjus FkXiLQFSil8e5nCJt3iU8VUwf5v1sXVgmgVCO0wpvofn+tdcm0h263FE11EZDnQAG2QJ PfAX0EHYL1Ucd1zNObhhR+AX5mhps4vLF1cYaZwFbeKvJnXeWS8HLaVXGsNBrQYSWuXD eQr8prJgpSb5Za42NTNFjkIyNeV2KO0BV+6cDI98CDL15GnECgqlxlQ8TmILbTRSG1YS s1FraapGG81W5pjCYFbJLCnDltsM0yeVU7ZaDMl65QvkbTR534p++0gmzZBmoKzpRLDQ /qeQ== X-Gm-Message-State: AC+VfDzMNYZut0hnaWM7glcUbKusLMjfbDgpuJKihbnHWWR3E+UWhfE+ mybwQ7OvwyCgzuYeFiwelni0qeSB6qk= X-Google-Smtp-Source: ACHHUZ58YQJTtwMjKz+NvCxsBjd4oMkuUxdXiFz5v0No4mUouX4YRZyCwSmWbgCsrSHD/mdvuk6q6w== X-Received: by 2002:a19:ca0a:0:b0:4f4:d45d:1616 with SMTP id a10-20020a19ca0a000000b004f4d45d1616mr4809840lfg.67.1686650943725; Tue, 13 Jun 2023 03:09:03 -0700 (PDT) Received: from 3uFjGV4mFr2mP6Bw.. ([79.143.250.144]) by smtp.gmail.com with ESMTPSA id i10-20020a05600c290a00b003f819dfa0ddsm6730620wmd.28.2023.06.13.03.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 03:09:03 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Dridi Boukelmoune Subject: [PATCH v2 2/2] posix: Add test case for gai_strerror() Date: Tue, 13 Jun 2023 12:08:28 +0200 Message-Id: <20230613100828.47611-2-dridi.boukelmoune@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230613100828.47611-1-dridi.boukelmoune@gmail.com> References: <20230613100828.47611-1-dridi.boukelmoune@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dridi Boukelmoune via Libc-alpha From: Dridi Boukelmoune Reply-To: Dridi Boukelmoune Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Dridi Boukelmoune Reviewed-by: Arjun Shankar --- posix/Makefile | 1 + posix/tst-gai_strerror.c | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 posix/tst-gai_strerror.c diff --git a/posix/Makefile b/posix/Makefile index e19b74cd67..ad43cbdec6 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -275,6 +275,7 @@ tests := \ tst-fnmatch6 \ tst-fnmatch7 \ tst-fork \ + tst-gai_strerror \ tst-getaddrinfo \ tst-getaddrinfo2 \ tst-getaddrinfo3 \ diff --git a/posix/tst-gai_strerror.c b/posix/tst-gai_strerror.c new file mode 100644 index 0000000000..7d886df2a4 --- /dev/null +++ b/posix/tst-gai_strerror.c @@ -0,0 +1,43 @@ +/* Test for gai_strerror() + Copyright The GNU Toolchain Authors. + 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) +{ + unsetenv ("LANGUAGE"); + + xsetlocale (LC_ALL, "C"); + + TEST_COMPARE_STRING (gai_strerror (1), "Unknown error"); + TEST_COMPARE_STRING (gai_strerror (0), "Success"); + TEST_COMPARE_STRING (gai_strerror (EAI_OVERFLOW), + "Result too large for supplied buffer"); + + return 0; +} + +#include