From patchwork Fri Jul 10 21:31:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 51053 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B64C2290A for ; Fri, 10 Jul 2015 21:31:33 +0000 (UTC) Received: by wgwk7 with SMTP id k7sf35202798wgw.0 for ; Fri, 10 Jul 2015 14:31:32 -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=QBWk+J0UTaVp5ni3Sd9nT17CPIhXbwTsZ8hULv+VUQ0=; b=UwmwP/kC1UDui0GdEXn5RlUt7cy6sqLwNBghN+lNHUZjO0+2hQVZiUqxhPHnfkbxbI 0BEwlt7BvMvwYW6r07JkKp23NG5k2xskZ1XtHzvZ/zJymkiK4JTqxohRFwYE9vN7jbvt r8qIxD85gFkpmri4VIDEqaUn0IrjbFPH7bjqIkdlCOmtJ+qCeSm+6TZX3x0zsmCanqoV LGktwmVmFDcp6/f4aU4CPLHtn+RXEousJCmgCs2nh24R/Nf3AmMKapH6EHEmLJlpN3m9 +ez0zdyE76kn1PbE2LiWbhV7x75V90qcLkBZ0C0G0472/zIlXFUe8BHzDAdkGg9CwWLt oyUg== X-Gm-Message-State: ALoCoQkDgOJqd1Y4wnHKSeYaG528OkUZCNEbbstLyajYEWDdKTZzhoYaG+mya1pYwrhUu3SrgqvP X-Received: by 10.194.175.36 with SMTP id bx4mr11863551wjc.1.1436563892840; Fri, 10 Jul 2015 14:31:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.196 with SMTP id a4ls1104589lak.27.gmail; Fri, 10 Jul 2015 14:31:32 -0700 (PDT) X-Received: by 10.152.22.4 with SMTP id z4mr21779538lae.81.1436563892601; Fri, 10 Jul 2015 14:31:32 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id j1si8669319lbc.15.2015.07.10.14.31.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2015 14:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbnk3 with SMTP id k3so99225552lbn.1 for ; Fri, 10 Jul 2015 14:31:32 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr22126705laf.32.1436563892465; Fri, 10 Jul 2015 14:31:32 -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 hn6csp238227lbb; Fri, 10 Jul 2015 14:31:31 -0700 (PDT) X-Received: by 10.140.202.84 with SMTP id x81mr33757820qha.50.1436563890875; Fri, 10 Jul 2015 14:31:30 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a93si11585594qka.94.2015.07.10.14.31.29; Fri, 10 Jul 2015 14:31:30 -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 AEF28620A1; Fri, 10 Jul 2015 21:31:29 +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_H3, RCVD_IN_MSPIKE_WL, 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 6217E61D7E; Fri, 10 Jul 2015 21:31:25 +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 E580961DA0; Fri, 10 Jul 2015 21:31:16 +0000 (UTC) Received: from mail-qk0-f177.google.com (mail-qk0-f177.google.com [209.85.220.177]) by lists.linaro.org (Postfix) with ESMTPS id 13EAF61D3E for ; Fri, 10 Jul 2015 21:31:16 +0000 (UTC) Received: by qkhu186 with SMTP id u186so215799149qkh.0 for ; Fri, 10 Jul 2015 14:31:15 -0700 (PDT) X-Received: by 10.55.15.129 with SMTP id 1mr36085883qkp.29.1436563875887; Fri, 10 Jul 2015 14:31:15 -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 h133sm6388723qhc.46.2015.07.10.14.31.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jul 2015 14:31:15 -0700 (PDT) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Fri, 10 Jul 2015 17:31:10 -0400 Message-Id: <1436563870-14957-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 v2] 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.217.178 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 --- v2 fixed cpumask_test_odp_cpumask_def test 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..d4daa61 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_control(&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, };