From patchwork Thu May 5 06:59:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1626703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=wIcFuxJE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kv4PZ59HPz9sCq for ; Thu, 5 May 2022 17:01:54 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E3F13954420 for ; Thu, 5 May 2022 07:01:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E3F13954420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651734110; bh=u+RFq1Dit/uVdanv3e0GmxN/tXuLxDuep/zQfp1Wfcc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=wIcFuxJEZRHfVapCHx/DQA0XIBAbGSiqPFsTs5XAV+xO1HKz7q7MgSm0kyM4ezJ+Z Rd9Wa5I0gavw7z7sBEiZir9JiZnfAeixQ0IV3OhPKg1LAMSUjjgNOBFP4okdgAcajg 25mozy8cTMHrtzz/fv+vMwlRWNV6AVAN+b5wmPzU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10054.outbound.protection.outlook.com [40.107.1.54]) by sourceware.org (Postfix) with ESMTPS id 8CCC1383940F for ; Thu, 5 May 2022 06:59:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8CCC1383940F ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=J12ogOWarYKF+WoZ71XuJmywcG5WbPStwTyPElCC9fIYRLzX0xRwD4uIy5xO5Ig9xKAYfAad8GUKsy73WIRp5EnieVGjkerL0wrtwVlqrHN2IepsJomZXN1ms1E3w0BLWnWmG/DWqgzyYaVsN7KhdrBOFTN4FZZfPTesQIiLWF8DswUzu+aOqtOwCfkhEYApK1i1/H87e5jG6Ka9/JWlp2CN7vgNaBGva2FXr0nd/dAYIJgKxTh+eeqGe+xPZ7IwGaugubJyiuuxZBaM7MRy9/qmj9e8vbCxRLvBXlTVnd5J3tHkm4PIXuFBxxYHI+jpK/iQadGezunEJiYLTR2ssA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u+RFq1Dit/uVdanv3e0GmxN/tXuLxDuep/zQfp1Wfcc=; b=ZR1GzIBXvxuR9gzZQ7F6diOB9rxySYV5PRruIUmqAl0IwhaJpL+jAIyRvY0anAxgHGEEpS8k0/9DnrDSY0CSmZ1fU0tAe5/FMo6MuCSP6b1GiW7enpiEyWVEvVdf5DmbWItm+bjNgXcZzK+5+zMgTezM3QZkT8pz+nuHDtaxqKyP4Cw5Ca61ssuGkEEesBkFcFOMCB4ktjwXuSB0dPOkCWZNRErMBaAGA8hpHumogiIGFKJ+yQbIUY2xsEZmDiExaYlKx1n3BtncOVWMDiuRteIy6Gce6sStsng/H3Xvf+aWNc36pJUMYJOAvCEBviWWU+CWY5iP07W2NgKbekvGhw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from DB6P18901CA0013.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::23) by VE1PR08MB5709.eurprd08.prod.outlook.com (2603:10a6:800:1a7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Thu, 5 May 2022 06:59:18 +0000 Received: from DBAEUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:16:cafe::cd) by DB6P18901CA0013.outlook.office365.com (2603:10a6:4:16::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13 via Frontend Transport; Thu, 5 May 2022 06:59:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT026.mail.protection.outlook.com (100.127.142.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Thu, 5 May 2022 06:59:17 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Thu, 05 May 2022 06:59:17 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a45d2d09c0e4df9c X-CR-MTA-TID: 64aa7808 Received: from b1d6027c3532.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 012EDF73-8F9F-4CDB-B214-20D1B6A68094.1; Thu, 05 May 2022 06:59:10 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b1d6027c3532.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 05 May 2022 06:59:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ffQU8yRyyYn9mWyc5v9ocJx3lDmOhrQNGI5sH6SSHq4VllFO45aDdSno5aX4Ne0z2FI9Q3NlD6JEJiCSVE0cqZIahP4z5KJh1xYQTtkDooHT3c6PK9m7oFmDib5gd7Uq7tGc+aoUDB+LmbGvkFT1P4RfGmaGn+tf2l1caAqoELSFlw6URd4gdvWUAsvtCqrawGaHjmF6JNz4yGtZNclHCwclZC+WbvmJY9QxEnokAIsJqIWgxji7P6ulxK/833uYuWJDi7SkI3UXYFhYO85oLVx33nH+jaDTso4ari1rAaGtOAZhqvJgmK3uT9Z1iXJlDTLQYVc7ZW7MIkW34V4LEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u+RFq1Dit/uVdanv3e0GmxN/tXuLxDuep/zQfp1Wfcc=; b=fRqRESJV0Ed0C8xgMhS6omJm24Gu4RUh1L3zPFPD1vZb46SMacKDCMW+EudOzlvrmWC/MSex7+kLP+tK+hYgOxq1t4cniFQSTndwLC+mtVbJ4G0HhnoBoZYSTo7c7mi7G87tyQZU44niF7qpiEcjhH8c8Et+On8O/fozlyWecGtAyn1yTTtiQJvF9m7tp+xoTbUBBMeXf4ex8L6r39DL4Ovw+65cyVWNvgevRjezs513eQNrZqmF1I9OA+oqlJ+Bb7qsq6nZScBlCmOFXFdJPb5r53fwX7lMTegIGYT5R5qMul3YStVod6+kvbmw6a2i5PnWUnYv9f+4Wbq9rL3q2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS9PR06CA0240.eurprd06.prod.outlook.com (2603:10a6:20b:45e::9) by AM6PR08MB5286.eurprd08.prod.outlook.com (2603:10a6:20b:aa::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.25; Thu, 5 May 2022 06:59:08 +0000 Received: from AM5EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45e:cafe::1) by AS9PR06CA0240.outlook.office365.com (2603:10a6:20b:45e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.12 via Frontend Transport; Thu, 5 May 2022 06:59:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT012.mail.protection.outlook.com (10.152.16.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Thu, 5 May 2022 06:59:08 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Thu, 5 May 2022 06:59:12 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Thu, 5 May 2022 06:59:07 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Thu, 5 May 2022 06:59:12 +0000 To: Subject: [PATCH v5 3/4] linux: Add a getauxval test [BZ #23293] Date: Thu, 5 May 2022 07:59:07 +0100 Message-ID: <3f32aa2bdd587520534496b41a7225ea42804734.1651732417.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 7d1505e5-16ea-4e82-d575-08da2e64c58d X-MS-TrafficTypeDiagnostic: AM6PR08MB5286:EE_|DBAEUR03FT026:EE_|VE1PR08MB5709:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1cmG6duZtoKrl+DFSOHg1FJWKlcetr30LKFhwEWqHapo2jqG2sXxAdiZMJUybtcc2EGWmw4V4TrGu8CoItRi4BB/ZXUDdDIAACVukBPT9L0SSaOe9+djMtvLzvECinbj5i4TZMGwkFpy6NCsPrm8q1ocoDipIYg8luW1yBgkbDbDrwhTFe6pcP6ZpaLm+9wfTcg1wMp5PZwX/YzdexTcyqeIBmcKGIfqFMt7Mu8O/gbygzf4MD8L3tGQJaq3a+1lm/BUn0lStfqJUfbmUdRpwIkcH6erclG7i+1p1YgxGCugfUyozt7X50HWRcyUDvc2BlKCihHJlCTkU5nTrll31ODVXNd1nvuJ/Y50z4bg1/ipIQFFWyMcWy1qKILJgt2OS+ihHoWuR6WticLOfouWGJc/zp05VBupToALxCljuTKEO6Ch4lkNnZotvX4tm4UqMW1TD5WqrviPKkqEnUY6tW6RdHRTd9bm0984RPtiDQV4KZ0Z/bfkLAjvNKsOaEXFoBLy4WX1kqKNk4DHWmLHocGvtT1CrOGqvIZCtSZ2L3NVQeYijaKbIDAdaT7rlaPwDNeffVGRBDzVqxRzhBgSU4ljRR1q5YDpG6zvMwrbDFOKJ0B8z2HymTeEUNAuCYtVV/hmZBcmK0KcTaWOCm33Opx81Fd+X6gxYkd5RONnoQmzAhEDynkwTl7uWVBVl+lbuP8LQb05j3vc9MexMhiXmm5XNpHgcz9T9kk40o+dxdzLPC6N9bVCEyloDx2MVv6OYJF7gO35bHzgZiuW4g+UJsSb3SIxMkRkFnfkzsy6V/c2ycXtNL1Mhem9qDWaG3yD X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(5660300002)(40460700003)(36860700001)(8936002)(2616005)(44832011)(8676002)(82310400005)(7696005)(26005)(36756003)(426003)(186003)(2906002)(356005)(47076005)(336012)(70206006)(6666004)(6916009)(70586007)(4326008)(81166007)(316002)(86362001)(508600001)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5286 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 39ef21df-92bb-413e-a6eb-08da2e64c064 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XvEEFWeHFAH5y8LLIPS4IBUb+i9nbSbkA3r5TaKJPyaci98SMML8jf7Q0bq8YFpdEfwjSlE+53yZ35RBv4xMH1MFkeGG7Tbf4o5Cr1aCzHJwyR0khm1t016jp9WCp0bM9RvUMGoo89IwMtse+JsPSgFUeNnk/RamxOdBvZsv3UgyLCXYyjrwxCFW+GJLvYjAGCueOFCsNkCMivtCEyRO5aZcypzufsuCKJa7VICfWUtZ8y0emjbj25dLUNy7FyUpbxdnDDNpTskNzguuExiQM6qilziFC7FMhSoOKahT/Ytpyt98VOvwzw5FL8JR1jQpm6qfHlhg+DNWXqlpeADJIvAOLU7bCXefnHHPSVYaE/En6s+09CdBFhm2lET197Tz8IW/29IZXiDYDg1xfeRWlcZoCn1l6vHddyJ0icbQhEgVzIp6X8Hi2I5+NcqIXtC5Aob3oLmAVhwap9oWFXApW335Aem0QBlGm5TXyqxjmpBAC1wAhrCThooa2zQunMbbUWLeY4rK473i6VtZWgGQlDyAvGj1xgzgbqwYQX+0onV6bW3skiFA+/fXBblqXwiUvMFxp9C4rqWZVNJ3HZQasjl0XDpnmTfHssYhLyYhNcvrQT9C+NiwvvCnUpwr7XFaUHtma5W1lhp9skxFzPyiH4qF6czhIV3aSvKl5kY9yNP8SiFf7qJmzw2WismKw/lQDjXonge/PMKwOrjmx4ETAlxK7IXWwVsQVdfeHwPLag3ErP0uXiYJW52vBL4cyaRPozEo1ClOl1362uV1wxK5vQxUVV/UnnE9aTjGZVpCsYA= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(6666004)(47076005)(426003)(186003)(7696005)(336012)(2906002)(26005)(86362001)(81166007)(2616005)(82310400005)(40460700003)(107886003)(36860700001)(8936002)(316002)(6916009)(508600001)(36756003)(5660300002)(8676002)(4326008)(70586007)(70206006)(44832011)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 06:59:17.2204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d1505e5-16ea-4e82-d575-08da2e64c58d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5709 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Cc: Florian Weimer Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" This is for bug 23293 and it relies on the glibc test system running tests via explicit ld.so invokation by default. Reviewed-by: Florian Weimer --- v4: - New patch. --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/tst-getauxval.c | 74 +++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/tst-getauxval.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index ca953804d0..89cb005c7d 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -126,6 +126,7 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ tst-prctl \ tst-scm_rights \ tst-epoll \ + tst-getauxval \ # tests # For +depfiles in Makerules. diff --git a/sysdeps/unix/sysv/linux/tst-getauxval.c b/sysdeps/unix/sysv/linux/tst-getauxval.c new file mode 100644 index 0000000000..c4b6195743 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-getauxval.c @@ -0,0 +1,74 @@ +/* Basic test for getauxval. + Copyright (C) 2022 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 + +static int missing; +static int mismatch; + +static void +check_nonzero (unsigned long t, const char *s) +{ + unsigned long v = getauxval (t); + printf ("%s: %lu (0x%lx)\n", s, v, v); + if (v == 0) + missing++; +} + +static void +check_eq (unsigned long t, const char *s, unsigned long want) +{ + unsigned long v = getauxval (t); + printf ("%s: %lu want: %lu\n", s, v, want); + if (v != want) + mismatch++; +} + +#define NZ(x) check_nonzero (x, #x) +#define EQ(x, want) check_eq (x, #x, want) + +static int +do_test (void) +{ + /* These auxv entries should be non-zero on Linux. */ + NZ (AT_PHDR); + NZ (AT_PHENT); + NZ (AT_PHNUM); + NZ (AT_PAGESZ); + NZ (AT_ENTRY); + NZ (AT_CLKTCK); + NZ (AT_RANDOM); + NZ (AT_EXECFN); + if (missing) + FAIL_EXIT1 ("Found %d missing auxv entries.\n", missing); + + /* Check against syscalls. */ + EQ (AT_UID, getuid ()); + EQ (AT_EUID, geteuid ()); + EQ (AT_GID, getgid ()); + EQ (AT_EGID, getegid ()); + if (mismatch) + FAIL_EXIT1 ("Found %d mismatching auxv entries.\n", mismatch); + + return 0; +} + +#include