From patchwork Fri Jul 10 17:08:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 51044 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A4FF22A17 for ; Fri, 10 Jul 2015 17:09:12 +0000 (UTC) Received: by lagc2 with SMTP id c2sf39885971lag.0 for ; Fri, 10 Jul 2015 10:09:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=cmzG0Yol3DFwbA7KUvZtmehyv16ZGRLNclwM8BcELAg=; b=aHSdbtJvwzHTuzPQmHXpJv4oYf1HhsVvfpkTmS8jklwhkfBH7BGFnk3gle8BjCK2Yg S8Z9F6UzK9i+vH7TSFLbhmWYioUr14oqZ5e+TYigpKF6D/SPM64TzfcKunX7tMJuiBES OOTfY8i0OQabt5Jtgzgfp15ii1C/Vow6Am67EGf26hIRxjoNes9eGnnYx3LWlyQQQUkU rsAkIikn5GsuJVLwBNmPae6tlKWnAbkV5CofaVwM24FNxissM+Fo7+/UYDuxoMPCKDIz L+LQtD5gb3urvUiaSexx7V1jrCMYLmQV2/aw/KxzqzgWdMnZjhQiub4MxBpJZlwCi0xG ZrAw== X-Gm-Message-State: ALoCoQnkWWe2VBq20rAqrRTWCYNbeOnOwk7Sa2GUscJlh1bjZtjzt0g0iPa61+ExrmXo3W9oNMUA X-Received: by 10.180.198.9 with SMTP id iy9mr2297934wic.7.1436548151641; Fri, 10 Jul 2015 10:09:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.228 with SMTP id h4ls1265491lam.23.gmail; Fri, 10 Jul 2015 10:09:11 -0700 (PDT) X-Received: by 10.152.170.130 with SMTP id am2mr9130878lac.54.1436548151478; Fri, 10 Jul 2015 10:09:11 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id re5si8114814lbb.150.2015.07.10.10.09.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2015 10:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lagx9 with SMTP id x9so268933544lag.1 for ; Fri, 10 Jul 2015 10:09:11 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr20303922lac.41.1436548151321; Fri, 10 Jul 2015 10:09:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp119688lbb; Fri, 10 Jul 2015 10:09:10 -0700 (PDT) X-Received: by 10.140.234.84 with SMTP id f81mr36644190qhc.49.1436548149682; Fri, 10 Jul 2015 10:09:09 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f1si10731722qkh.80.2015.07.10.10.09.08; Fri, 10 Jul 2015 10:09:09 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 6155162045; Fri, 10 Jul 2015 17:09:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D1D0B62036; Fri, 10 Jul 2015 17:09:04 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4214B6203F; Fri, 10 Jul 2015 17:09:03 +0000 (UTC) Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com [209.85.192.41]) by lists.linaro.org (Postfix) with ESMTPS id 2AA2062034 for ; Fri, 10 Jul 2015 17:09:02 +0000 (UTC) Received: by qgeg89 with SMTP id g89so132088221qge.3 for ; Fri, 10 Jul 2015 10:09:02 -0700 (PDT) X-Received: by 10.140.34.135 with SMTP id l7mr33876963qgl.79.1436548141682; Fri, 10 Jul 2015 10:09:01 -0700 (PDT) Received: from localhost.localdomain (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by smtp.gmail.com with ESMTPSA id p85sm5743130qkh.10.2015.07.10.10.09.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jul 2015 10:09:01 -0700 (PDT) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Fri, 10 Jul 2015 13:08:53 -0400 Message-Id: <1436548133-10426-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] validation: cpumask: test def_control and setall APIs X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Mike Holmes --- test/validation/cpumask/cpumask.c | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/test/validation/cpumask/cpumask.c b/test/validation/cpumask/cpumask.c index 943a8e0..b8a47b9 100644 --- a/test/validation/cpumask/cpumask.c +++ b/test/validation/cpumask/cpumask.c @@ -30,6 +30,9 @@ /* padding pattern used to check buffer overflow: */ #define FILLING_PATTERN 0x55 +/* default worker paramiter to get all that may be available */ +#define ALL_AVAILABLE 0 + /* * returns the length of a string, excluding terminating NULL. * As its C lib strlen equivalent. Just rewritten here to avoid C lib @@ -456,6 +459,56 @@ static void cpumask_test_odp_cpumask_next(void) CU_ASSERT(odp_cpumask_next(&mask1, i) == expected[i]); } +static void cpumask_test_odp_cpumask_setall(void) +{ + int num_cpus; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + odp_cpumask_setall(&mask); + num_cpus = odp_cpumask_count(&mask); + + CU_ASSERT(num_cpus > 0); + CU_ASSERT(num_cpus >= max_cpus); +} + +static void cpumask_test_odp_cpumask_def_control(void) +{ + int num; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + num = odp_cpumask_def_control(&mask, ALL_AVAILABLE); + + CU_ASSERT(num >= 0); + CU_ASSERT(num <= max_cpus); +} + +static void cpumask_test_odp_cpumask_def_worker(void) +{ + int num; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + num = odp_cpumask_def_worker(&mask, ALL_AVAILABLE); + + CU_ASSERT(num >= 0); + CU_ASSERT(num <= max_cpus); +} + +static void cpumask_test_odp_cpumask_def(void) +{ + int num_worker; + int num_control; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + num_worker = odp_cpumask_def_worker(&mask, max_cpus - 1); + num_control = odp_cpumask_def_worker(&mask, 1); + + CU_ASSERT((num_control + num_worker) == max_cpus); +} + static CU_TestInfo cpumask_suite[] = { {"odp_cpumask_to/from_str()", cpumask_test_odp_cpumask_to_from_str}, {"odp_cpumask_equal()", cpumask_test_odp_cpumask_equal}, @@ -471,6 +524,10 @@ static CU_TestInfo cpumask_suite[] = { {"odp_cpumask_first()", cpumask_test_odp_cpumask_first}, {"odp_cpumask_last()", cpumask_test_odp_cpumask_last}, {"odp_cpumask_next()", cpumask_test_odp_cpumask_next}, + {"odp_cpumask_setall()", cpumask_test_odp_cpumask_setall}, + {"odp_cpumask_def_control()", cpumask_test_odp_cpumask_def_control}, + {"odp_cpumask_def_worker()", cpumask_test_odp_cpumask_def_worker}, + {"odp_cpumask_def()", cpumask_test_odp_cpumask_def}, CU_TEST_INFO_NULL, };