From patchwork Thu Nov 21 23:00:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 101710 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 82ED13857358 for ; Thu, 21 Nov 2024 23:01:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82ED13857358 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1732230093; bh=2w32HDm7sFv2cWUCRz9NJyyiP5F2Vbxw9E0FLEhwi04=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=U3xVxz8crVwMLscpyqpu/EePTgWw0HbRCNdzvfQ0HoZzskWtQmSmfhaksFxS8jHuV X0dqpgWw0yOcENL2srR5VhceYgjrF8gCcNrcb/qmxoSt9P3hw7xNkj6Jkh8ze6IsjD JVL/l5qYlD9h7+04kkqPtZPgUetcCtMgdUjL+sNY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from bactrian.oak.relay.mailchannels.net (bactrian.oak.relay.mailchannels.net [23.83.215.9]) by sourceware.org (Postfix) with ESMTPS id 2A340385802C for ; Thu, 21 Nov 2024 23:00:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A340385802C Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=sourceware.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=sourceware.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A340385802C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=23.83.215.9 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1732230052; cv=pass; b=gfSY86R5bB7irVm4Qj/XJKTstkHNn6cyosyNt6TkJasH8AEe+TzkT8kBJ6jwtpMR1AjnUNjlgIrWF3nhlBbHxuwkx8UozJkG3LE2EKgJ4mk8swGZoJCgdxXp0+5R6M8PVOzDW9KvIE3LYDD7NkLuIC8nEEsS0XP95r6TlhLZVsU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1732230052; c=relaxed/simple; bh=DzBNhyKwCkmYDJWOeHoZ+7/BsRGlGVlLcd8Li0n1470=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ly0w74QuoshetI8bHkvbS3q4eNklLQXblMwLfelx72Wxa1LRt6LnJiI+Myy7KjdcYFqFbIXrMDJgmf0avZejX8pvPLQn5Uxo8TcedB+Q7vk1RKaKpeDu1SaUx2uUjMSL6rT3Zb0iR41RHg6j3aP+jUNWXlEdMmiZMrqQeDmHvGA= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A340385802C X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3061B8A4393; Thu, 21 Nov 2024 23:00:51 +0000 (UTC) Received: from pdx1-sub0-mail-a234.dreamhost.com (trex-10.trex.outbound.svc.cluster.local [100.118.29.195]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C300B8A40AD; Thu, 21 Nov 2024 23:00:50 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1732230050; a=rsa-sha256; cv=none; b=bJeYo0oCxzvksHpw722HzQbLl6JkJdxtBWNJGcx1tHGSfeeC/VcieW84Le8T7TnigFbbN2 9xmFQmnNCPnKw+5dNj7/zGLL4Qo4wgJhAkGD5VilJLObW9xnS1T0o7sJbnVaosqEckG556 AjhFqlUDZsXwv1AAeaAx9RKl3PTLIF8rNLvKEz9pcW9o2CCKRhzmRm3HqygEoG//OAtxSJ 9MKk0kfbePxL4n1PbFyN13rcP/Pn39LrYyDWOSP7YHUpJ/0tibnpNJjyMRtoBmR4bV4nD6 pfz/Tk+nibw2HFYCcTYp5sjeUJfjkqKfUBFLPdFGEe8Kd2vUu5MnS3WeOuGhlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1732230050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2w32HDm7sFv2cWUCRz9NJyyiP5F2Vbxw9E0FLEhwi04=; b=2sbCf4BmThzJXIiDtEuDLHofB59QA7nZ+rPSXSxuhihahlpq0e+e4CK/HJcHdEVhjRUv+2 Czpjmxp6DSn06aU3ZaUdUL3pYutJUpAQDMkSb893LtLOyT6x0GxJ9zabi4XrfLlP9XqoPP m2LRdKSNdUIslQvsnXjFpI+9I/WVwYMCi4m2RgwhXucGADAAp8GcCY2GKaFpXAOMcABcAi iInhuayMcBokTh5YRtkEHfvmtaidalEOGV3mwnMb8QrdM/SDxm4e0/36mAWjsU1+b6QKUR KTls55wd9v3XmzbpZYXhpXBTitb8hFYZvJAbHmfutgXW7GmCmNcLzKP3wremFA== ARC-Authentication-Results: i=1; rspamd-868968d99d-4frh2; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Bad X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Cooperative-Wipe: 762629e133a2d413_1732230051026_2522191878 X-MC-Loop-Signature: 1732230051025:898371839 X-MC-Ingress-Time: 1732230051025 Received: from pdx1-sub0-mail-a234.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.118.29.195 (trex/7.0.2); Thu, 21 Nov 2024 23:00:51 +0000 Received: from fedora.redhat.com (bras-base-toroon4859w-grc-89-184-146-156-41.dsl.bell.ca [184.146.156.41]) (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) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a234.dreamhost.com (Postfix) with ESMTPSA id 4XvYcL33mwz38; Thu, 21 Nov 2024 15:00:50 -0800 (PST) From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: josmyers@redhat.com Subject: [PATCH] nptl: Add smoke test for pthread_getcpuclockid failure Date: Thu, 21 Nov 2024 18:00:47 -0500 Message-ID: <20241121230047.2997929-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1166.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP 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.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Exercise the invalid thread descriptor case to ensure full test coverage for the function. Signed-off-by: Siddhesh Poyarekar --- nptl/Makefile | 1 + nptl/tst-pthread-getcpuclockid-invalid.c | 47 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 nptl/tst-pthread-getcpuclockid-invalid.c diff --git a/nptl/Makefile b/nptl/Makefile index ceb91afafc..9faad1964c 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -317,6 +317,7 @@ tests = \ tst-pthread-attr-affinity-fail \ tst-pthread-attr-sigmask \ tst-pthread-defaultattr-free \ + tst-pthread-getcpuclockid-invalid \ tst-pthread-gdb-attach \ tst-pthread-gdb-attach-static \ tst-pthread-key1-static \ diff --git a/nptl/tst-pthread-getcpuclockid-invalid.c b/nptl/tst-pthread-getcpuclockid-invalid.c new file mode 100644 index 0000000000..f1720687a7 --- /dev/null +++ b/nptl/tst-pthread-getcpuclockid-invalid.c @@ -0,0 +1,47 @@ +/* Smoke test to verify that pthread_getcpuclockid fails with invalid thread + IDs. + 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 + +void * +thr (void *in) +{ + return in; +} + +int +do_test (void) +{ + pthread_t t = xpthread_create (NULL, thr, NULL); + xpthread_join (t); + + clockid_t c; + TEST_COMPARE (pthread_getcpuclockid (t, &c), ESRCH); + + return 0; +} + +#include