From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f62b552751so6409576e87.3 for ; Tue, 13 Jun 2023 03:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686650944; x=1689242944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Tl8XhT9K0NCH7CY/qj+Vg9i7q1z1NHBVR1YgJk0v5Io=; b=IGeeADRJOYvJigrXyCTIl0/7dBVaP5ShN8ykl9RRC3582gliM/InWOyu5Ji83gR4rZ fLQpDq8bGYlmemXYAjHg+0j1H29ntPo/sv8UHQe3elNXnNfzJt4SYPjW5MbGLUpVrcKW 2FaPR2oVnnp7RoUIb9rPxmocluZMa424K76IkW+V4FfrnmAC54K3x1f/OtvWrF2JxvJZ UeI0qwwvZCMkla8eYVSM0EHUvDUhZEUbK6G0KVV340IqbIDOotbQ3VrItetuXaMZ0qS/ xsZBLfOd9S/Ya8UESflUMNkSs9ALiBYA3dES9vJPrhVPa7YmvYVfDzGPE7BamTusb3kz jkog== 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) From: Dridi Boukelmoune 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 Content-Transfer-Encoding: 8bit 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 List-Id: Signed-off-by: Dridi Boukelmoune --- 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 -- 2.40.1