From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 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_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 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 534211F47C for ; Fri, 13 Jan 2023 14:57:04 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=Pqnula+5; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGKw1-00077J-6Y; Fri, 13 Jan 2023 09:21:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGKvz-00075l-3y for bug-gnulib@gnu.org; Fri, 13 Jan 2023 09:21:31 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.160]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGKvx-00067c-20 for bug-gnulib@gnu.org; Fri, 13 Jan 2023 09:21:30 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1673619685; cv=none; d=strato.com; s=strato-dkim-0002; b=KB+Riq78GKpxUe2giWvcQKK2inaxC0pmxlNZcNVsmKUszgGzMfHPUc+NUN5XltRUMy icwQtT6F+8RICWPWSm7nsYB3VGJsy7u/xWxmvlfoIbwneGMWPkk1/geSdZYA1+aObpLH nDxuhQgZHlphV87JKaNGxIT6O/duX905qzNwYG0skPZWuREkvBKBBt8QgW2er/Stc8B5 MYUgMeA/qbDZx2Daj6MCgHlEBvxt+9A4OZIrIaMXg6xwnz8LFc6iKb2w55Fnaf/Wj0Am kee1WOw7T+P5TtWGgnigk0tBp2t7UGcnqau1QotFE9Z9oOCr6XlArvGY7M8oQstCD62l 30Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1673619685; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=zRQBqtGX79gaW527vYzxKUfL8/7XMNtmuqtrlTyMIYY=; b=E5wIdt9EGy0UJQS9BP4exG1ely9wEMPaRcKI6SQ/A3ycMPH24TmqiH14gHSGHjiabB UfhKJB2k77FKge0chTVx28x0kDKoM8BzRxt+7ssuB/Fad6xj9yxXNOcdkNas8kryIAvE VxhwZn8gFslsGYxjw8Ss6IhWvpLPbp2uK0NaQKCygFb20hGCyX3Dc7830/nFAHknTMJu I/hegm7EtENdJ9xtb9nrTPIFQNquFnK67FPyb6yUSuFWmsLHMJTXLFsoTDTSMoveHjdR Krba8bXWIMjierARqDllgX3JsTBJQmyhDUQeysTVEmpbNBNdBPbIkjyU3Pu+Z9DFUoua rNrw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1673619685; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=zRQBqtGX79gaW527vYzxKUfL8/7XMNtmuqtrlTyMIYY=; b=Pqnula+5hxiMQsa5XDvXkgyO3Ob1hMDwC9FI+PU5n/Hn5/yItqfvOxHUvktS6f0t4R RB+bOGDX1RRsH9MqTqTwG3pD6PEp3DUJWn1KXKkiU5DZtP1tT3wqeTkiKdZd1s49VPfO j2lxynCutuL0SyhfFkkqMiYQbNghgqWPYVICT9thPuPultGN+6jMO2FOQTeimNrtKqK7 C/HuJCaiz7IocYFfjBKOjvKmcT2e1aXwnw6WTaGbL4Gwv11hc1G5pe1ZxAGou4FqWZ4i K0dhHhgy6IlFVPxGy4Hd/JNhnmtH1Yf+h3z7Lvfa49gA/OfZYNqKoDSz+fAognilVArI DGTA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPE3fb7Bhi/OceMDKqguFVqjZRzEA==" Received: from nimes.localnet by smtp.strato.de (RZmta 48.6.2 AUTH) with ESMTPSA id I8f358z0DELOCcA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 13 Jan 2023 15:21:24 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: login_tty tests: Be more verbose when the test fails Date: Fri, 13 Jan 2023 15:21:24 +0100 Message-ID: <3708541.zog1K27m0d@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.160; 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.29 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-bounces+normalperson=yhbt.net@gnu.org On Android 11, when I run the unit tests of a testdir: - './test-login_tty' yields "login_tty failed". - 'make check TESTS=test-login_tty' yields "Aborted". To get more information about the second case, I'm making this change. "tcgetsid(0) = -1 and errno = 13" is more information than nothing. 2023-01-13 Bruno Haible login_tty tests: Be more verbose when the test fails. * tests/test-login_tty.c (main): When the test fails, write a message into a file. diff --git a/tests/test-login_tty.c b/tests/test-login_tty.c index 7ed09f048b..294b46d63c 100644 --- a/tests/test-login_tty.c +++ b/tests/test-login_tty.c @@ -53,7 +53,8 @@ main () } /* From here on, we cannot use stderr for error messages any more. - If a test fails, just abort. */ + If a test fails, write error information into a file named 'err', + then abort. */ /* Check that fd = 0, 1, 2 are now open to the controlling terminal for the current process and that it is a session of its own. */ @@ -61,12 +62,38 @@ main () int fd; for (fd = 0; fd < 3; fd++) if (!(tcgetpgrp (fd) == getpid ())) - abort (); + { + freopen ("err", "w+", stderr); + fprintf (stderr, "tcgetpgrp(%d) = %ld whereas getpid() = %ld\n", + fd, (long) tcgetpgrp (fd), (long) getpid ()); + fflush (stderr); + abort (); + } for (fd = 0; fd < 3; fd++) { pid_t sid = tcgetsid (fd); - if (!(sid == -1 ? errno == ENOSYS : sid == getpid ())) - abort (); + if (sid == -1) + { + if (!(errno == ENOSYS)) + { + freopen ("err", "w+", stderr); + fprintf (stderr, "tcgetsid(%d) = -1 and errno = %d\n", + fd, errno); + fflush (stderr); + abort (); + } + } + else + { + if (!(sid == getpid ())) + { + freopen ("err", "w+", stderr); + fprintf (stderr, "tcgetsid(%d) = %ld whereas getpid() = %ld\n", + fd, (long) tcgetsid (fd), (long) getpid ()); + fflush (stderr); + abort (); + } + } } }