From patchwork Sun Aug 30 11:44:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corinna Vinschen X-Patchwork-Id: 40340 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 A13F03857C60; Sun, 30 Aug 2020 11:45:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A13F03857C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1598787951; bh=ac+SPe9qa1hsArcjShqqv7vE/zCHGzXzlLni29vILHM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=V3k9pZHXITx947deBuRE60St52b9jGQmdtUbcG20erR4RYhQDzhXCI4oSaK1KF94l N3/xIP+iQoVeg+6OALE62LQgkK1faV8F4K+fQmOtCs6AOLvH6Qy0LA82/P7H6HFadu 2ZiJkVL8ZydwM3go5a5el9K+P56sIEwRBwSUAlz0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 43ACC3857C4E for ; Sun, 30 Aug 2020 11:45:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 43ACC3857C4E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-63-9jpJsUaVO9aoyUgn5nkI9g-1; Sun, 30 Aug 2020 07:45:38 -0400 X-MC-Unique: 9jpJsUaVO9aoyUgn5nkI9g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EDE2218A2257 for ; Sun, 30 Aug 2020 11:44:37 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-113-99.ams2.redhat.com [10.36.113.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0EE57A422 for ; Sun, 30 Aug 2020 11:44:37 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 4CC14A83A7E; Sun, 30 Aug 2020 13:44:36 +0200 (CEST) To: libc-alpha@sourceware.org Subject: [PATCH] C11 threads: Fix inaccuracies in testsuite Date: Sun, 30 Aug 2020 13:44:36 +0200 Message-Id: <20200830114436.1171468-1-vinschen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Corinna Vinschen via Libc-alpha From: Corinna Vinschen Reply-To: Corinna Vinschen Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" - tst-mtx-recursive.c: mtx_init fails to use mtx_plain. Per C11 specs, using mtx_recursive alone is not supported. This isn't catched because mtx_plain is defined as 0. - tst-thrd-sleep.c: thrd_sleep() returns 0 on success, a negative value on failure. Testing against thrd_success is incorrect. - tst-tss-basic.c: tss_set() is incorrectly checkd for a non-0 value. The test should test aginst C11 threads error codes. This isn't catched because thrd_success is defined as 0. Note that all three tests fail on FreeBSD, which defines all mutex type values, as well as all C11 threads error codes with non-0 values. Signed-off-by: Corinna Vinschen --- sysdeps/pthread/tst-mtx-recursive.c | 2 +- sysdeps/pthread/tst-thrd-sleep.c | 2 +- sysdeps/pthread/tst-tss-basic.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/pthread/tst-mtx-recursive.c b/sysdeps/pthread/tst-mtx-recursive.c index 6b471ac724df..aca8cee6eb99 100644 --- a/sysdeps/pthread/tst-mtx-recursive.c +++ b/sysdeps/pthread/tst-mtx-recursive.c @@ -27,7 +27,7 @@ do_test (void) { static mtx_t mutex; - if (mtx_init (&mutex, mtx_recursive) != thrd_success) + if (mtx_init (&mutex, mtx_plain | mtx_recursive) != thrd_success) FAIL_EXIT1 ("mtx_init failed"); if (mtx_lock (&mutex) != thrd_success) diff --git a/sysdeps/pthread/tst-thrd-sleep.c b/sysdeps/pthread/tst-thrd-sleep.c index 39d5fc707945..8cc4bb2690c4 100644 --- a/sysdeps/pthread/tst-thrd-sleep.c +++ b/sysdeps/pthread/tst-thrd-sleep.c @@ -27,7 +27,7 @@ static int sleep_thrd (void *arg) { struct timespec const *tl = (struct timespec const *) arg; - if (thrd_sleep (tl, NULL) != thrd_success) + if (thrd_sleep (tl, NULL) != 0) FAIL_EXIT1 ("thrd_sleep failed"); thrd_exit (thrd_success); diff --git a/sysdeps/pthread/tst-tss-basic.c b/sysdeps/pthread/tst-tss-basic.c index 3b06abc5cfe5..5a2c1bd1ee3e 100644 --- a/sysdeps/pthread/tst-tss-basic.c +++ b/sysdeps/pthread/tst-tss-basic.c @@ -33,7 +33,7 @@ tss_thrd (void *arg) if (tss_create (&key, NULL) != thrd_success) FAIL_EXIT1 ("tss_create failed"); - if (tss_set (key, TSS_VALUE)) + if (tss_set (key, TSS_VALUE) != thrd_success) FAIL_EXIT1 ("tss_set failed"); void *value = tss_get (key);