From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D18731F4B4 for ; Thu, 31 Dec 2020 22:39:20 +0000 (UTC) Received: from localhost ([::1]:38914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kv6bH-0006Dq-Do for normalperson@yhbt.net; Thu, 31 Dec 2020 17:39:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kv6bE-0006Dg-BQ for bug-gnulib@gnu.org; Thu, 31 Dec 2020 17:39:16 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.21]:22517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kv6bC-0002dq-4e for bug-gnulib@gnu.org; Thu, 31 Dec 2020 17:39:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1609454351; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:From:Subject:Sender; bh=gDXOkuOR3zOyFP7qCNBXlyMvJ6SI/wm7UQjQF3uhWgM=; b=lUI2JhgQ7PPIMTSa4qvcilSH5Hz8DUCN9B3sn4HgDWjVM2baePOHQ5Cd8Ct1S5JCwe Mg9WPxqTbzA5cYgVvfGtpN1AgxRok3wkdWlmZGVAKycYzB0xJy4IIJtfV4XgT/Qxra44 tx2FAACUPWt5VRwKv+OLGpBmRD1a8Bs939grTL16tAXZpxIPy22htvzE+PRY4IziSuF2 A/338pBRMLkyfmqeZZbfZJ7xBfVRx8pDmfE/RIHwdpoupLFOmqkNzCyosKjyaTIGhdyS Z4eFmnUFPcmZPOJR/Y+2kALdErJ5bukJGBfDpOG6YzwgRe9m2tg4zu7azzSIYK6kfZnA KTGw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6f3z/s=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.10.7 DYNA|AUTH) with ESMTPSA id e012d5wBVMdAWYW (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Thu, 31 Dec 2020 23:39:10 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: poll tests: Avoid test failure on BSD and Solaris systems Date: Thu, 31 Dec 2020 23:39:09 +0100 Message-ID: <6145955.M0qUDR3Ujj@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.21; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" The poll test fails on *BSD and Solaris systems, already for years: Unconnected socket test... passed Connected sockets test... failed (expecting POLLHUP after shutdown) General socket test with fork... failed (expecting POLLHUP after shutdown) Pipe test... passed FAIL test-poll (exit status: 2) The test apparently expects POLLHUP for sockets. This is not backed by POSIX , which requires POLLHUP to occur only for disconnected devices, pipes, or FIFOs. So, this part of the test is a Linux-ism. This patch fixes it. 2020-12-31 Bruno Haible poll tests: Avoid test failure on BSD and Solaris systems. * tests/test-poll.c (test_accept_first, test_socket_pair): Disable the "expecting POLLHUP after shutdown" test on all platforms except Linux. diff --git a/tests/test-poll.c b/tests/test-poll.c index 3566031..05248d8 100644 --- a/tests/test-poll.c +++ b/tests/test-poll.c @@ -280,8 +280,13 @@ test_accept_first (void) failed ("cannot read data left in the socket by closed process"); ASSERT (read (c, buf, 3) == 3); ASSERT (write (c, "foo", 3) == 3); - if ((poll1_wait (c, POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0) + int revents = poll1_wait (c, POLLIN | POLLOUT); +# ifdef __linux__ + if ((revents & (POLLHUP | POLLERR)) == 0) failed ("expecting POLLHUP after shutdown"); +# else + (void) revents; +# endif close (c); } #endif @@ -335,8 +340,13 @@ test_socket_pair (void) test_pair (c1, c2); close (c1); ASSERT (write (c2, "foo", 3) == 3); - if ((poll1_nowait (c2, POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0) + int revents = poll1_nowait (c2, POLLIN | POLLOUT); +#ifdef __linux__ + if ((revents & (POLLHUP | POLLERR)) == 0) failed ("expecting POLLHUP after shutdown"); +#else + (void) revents; +#endif close (c2); }