From patchwork Fri Jul 13 06:52:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kemi X-Patchwork-Id: 943309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-94242-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ax20uAIW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Rk9S2XM1z9ryt for ; Fri, 13 Jul 2018 16:56:12 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=W//Wgfg1D9HDx8gbzY00/SuYuGaRrsp TVK7t8GL87FmsDS6bUj3Gc2MPAaCTBYeWks7Vq/0QVb5+equyQKUrvnGCeBYY3N5 wM5A6Sc4AMFGGhQiGOv3xD63M0HfgNA3ZRi9oMxI+pnTsxOAY8bCeVzh5Trr+ODY O8K2Pq5uwCtA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=HjUnHCf5tsjcNJN1sO+Kddt4B40=; b=ax20u AIW1Sch/7rVqJBvt6KwaWrD2FfitKYGA+bPnC/eN+YpywKT5Gh+ek5feTgv780AH ruxc8GJczY4wVyxU/UeYJDPkRpsd7w8/mhQv7+cHnBWiMWz+hyVoUJMd8nnoIGnh TCa+BcUbnaVNib/zgOXrVivh3HmywA9WvrgxjI= Received: (qmail 13486 invoked by alias); 13 Jul 2018 06:55:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 13240 invoked by uid 89); 13 Jul 2018 06:55:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy= X-HELO: mga18.intel.com From: Kemi Wang To: Adhemerval Zanella , Florian Weimer , Rical Jason , Carlos Donell , Glibc alpha Cc: Dave Hansen , Tim Chen , Andi Kleen , Ying Huang , Aaron Lu , Lu Aubrey , Kemi Wang Subject: [PATCH v2 3/5] Mutex: add unit tests for new type Date: Fri, 13 Jul 2018 14:52:30 +0800 Message-Id: <1531464752-18830-4-git-send-email-kemi.wang@intel.com> In-Reply-To: <1531464752-18830-1-git-send-email-kemi.wang@intel.com> References: <1531464752-18830-1-git-send-email-kemi.wang@intel.com> Signed-off-by: Kemi Wang --- nptl/Makefile | 6 +++--- nptl/tst-initializers1.c | 11 +++++++---- nptl/tst-mutex5b.c | 2 ++ nptl/tst-mutex7b.c | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 nptl/tst-mutex5b.c create mode 100644 nptl/tst-mutex7b.c diff --git a/nptl/Makefile b/nptl/Makefile index 7559907..92ed53c 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -235,9 +235,9 @@ LDLIBS-tst-minstack-throw = -lstdc++ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \ - tst-mutex7 tst-mutex9 tst-mutex5a tst-mutex7a tst-mutex7robust \ - tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \ - tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \ + tst-mutex7 tst-mutex9 tst-mutex5a tst-mutex5b tst-mutex7a tst-mutex7b \ + tst-mutex7robust tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \ + tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \ tst-mutexpi9 \ tst-spin1 tst-spin2 tst-spin3 tst-spin4 \ tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \ diff --git a/nptl/tst-initializers1.c b/nptl/tst-initializers1.c index a8fdac1..3677cc0 100644 --- a/nptl/tst-initializers1.c +++ b/nptl/tst-initializers1.c @@ -24,6 +24,7 @@ pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +pthread_mutex_t mtx_queuespinner = PTHREAD_QUEUESPINNER_MUTEX_INITIALIZER_NP; pthread_mutex_t mtx_adaptive = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER; pthread_rwlock_t rwl_writer @@ -39,20 +40,22 @@ do_test (void) return 2; if (mtx_errorchk.__data.__kind != PTHREAD_MUTEX_ERRORCHECK_NP) return 3; - if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP) + if (mtx_queuespinner.__data.__kind != PTHREAD_MUTEX_QUEUESPINNER_NP) return 4; - if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP) + if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP) return 5; + if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP) + return 6; if (rwl_writer.__data.__flags != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) - return 6; + return 7; /* __libc_rwlock_init definition for libc.so relies on PTHREAD_RWLOCK_INITIALIZER being all zeros. If that ever changes, needs updating. */ size_t i; for (i = 0; i < sizeof (rwl_normal); i++) if (((char *) &rwl_normal)[i] != '\0') - return 7; + return 8; return 0; } diff --git a/nptl/tst-mutex5b.c b/nptl/tst-mutex5b.c new file mode 100644 index 0000000..9da54ea --- /dev/null +++ b/nptl/tst-mutex5b.c @@ -0,0 +1,2 @@ +#define TYPE PTHREAD_MUTEX_QUEUESPINNER_NP +#include "tst-mutex5.c" diff --git a/nptl/tst-mutex7b.c b/nptl/tst-mutex7b.c new file mode 100644 index 0000000..c2c1410 --- /dev/null +++ b/nptl/tst-mutex7b.c @@ -0,0 +1,2 @@ +#define TYPE PTHREAD_MUTEX_QUEUESPINNER_NP +#include "tst-mutex7.c"