From patchwork Thu Jul 16 16:25:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 51191 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB22722A8A for ; Thu, 16 Jul 2015 16:34:15 +0000 (UTC) Received: by wgwk7 with SMTP id k7sf20120659wgw.0 for ; Thu, 16 Jul 2015 09:34:15 -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:in-reply-to:references: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=525FKpfB5nOaZywXY2/C9oiBm42qicA2Z3ua2kQ1O60=; b=IiUwjBHU0WuCH5Cz3eI8qcd8iRzKaFAXTxDQlv8gdjhw2d5ESRXc0jAxYlymBjsWmX nNhwobYUaxhPgxdrO2aE05a2ZK6dUpperoNvD3Ld9RHRholByEsKdc6ZrgVWR/1qUIQv ez/tIiMykhKTQwVIOhDrs/9oQq1qNaS2MV1NKDNNIo8KUzpQrtnWZSCdR2HDj9iPs1rM w+4mpTJXq+3Rtr4i9cTh/FxVzqqXBoOYOAihCduJhRay2VEogexNmLkG/8r/uCIy0CRL /NMApOJxFS+Xp5qF3P6vHGPQQC6/lG7jYecC+dnqYf25p5Wi2NKTPVmaMK6Ihpoo3IvU rJhg== X-Gm-Message-State: ALoCoQn4XcCMkXw0QztVpCO7neDtHlh0reQmHlUBMuGmlR1Mv7UU6Grz+F/fWPoytM5Fulk5yP/G X-Received: by 10.152.22.163 with SMTP id e3mr5258413laf.6.1437064455167; Thu, 16 Jul 2015 09:34:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.168 with SMTP id kz8ls328338lac.105.gmail; Thu, 16 Jul 2015 09:34:15 -0700 (PDT) X-Received: by 10.152.43.17 with SMTP id s17mr10131917lal.101.1437064455009; Thu, 16 Jul 2015 09:34:15 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id ko2si7392710lbb.43.2015.07.16.09.34.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 09:34:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbpo10 with SMTP id po10so46858965lbb.3 for ; Thu, 16 Jul 2015 09:34:14 -0700 (PDT) X-Received: by 10.112.139.103 with SMTP id qx7mr10214583lbb.73.1437064454636; Thu, 16 Jul 2015 09:34:14 -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 hn6csp366450lbb; Thu, 16 Jul 2015 09:34:13 -0700 (PDT) X-Received: by 10.140.31.194 with SMTP id f60mr18539855qgf.23.1437064453039; Thu, 16 Jul 2015 09:34:13 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k33si10169011qkh.112.2015.07.16.09.34.12; Thu, 16 Jul 2015 09:34:12 -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 1CBB6620B5; Thu, 16 Jul 2015 16:34:12 +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 8C1BE620B1; Thu, 16 Jul 2015 16:27:17 +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 A8F27620E2; Thu, 16 Jul 2015 16:27:12 +0000 (UTC) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by lists.linaro.org (Postfix) with ESMTPS id 295FA61DF2 for ; Thu, 16 Jul 2015 16:26:15 +0000 (UTC) Received: by wgjx7 with SMTP id x7so62635121wgj.2 for ; Thu, 16 Jul 2015 09:26:14 -0700 (PDT) X-Received: by 10.180.20.198 with SMTP id p6mr8364509wie.38.1437063974409; Thu, 16 Jul 2015 09:26:14 -0700 (PDT) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id be9sm13889153wjb.26.2015.07.16.09.26.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Jul 2015 09:26:13 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Thu, 16 Jul 2015 17:25:47 +0100 Message-Id: <1437063949-24456-8-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1437063949-24456-1-git-send-email-stuart.haslam@linaro.org> References: <1437063949-24456-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 7/9] validation: thrmask: introduce thrmask tests 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: stuart.haslam@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.182 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: Stuart Haslam --- configure.ac | 1 + platform/linux-generic/test/Makefile.am | 1 + test/validation/Makefile.am | 1 + test/validation/cpumask/mask_common.h | 13 ++++++++++ test/validation/thrmask/.gitignore | 2 ++ test/validation/thrmask/Makefile.am | 10 ++++++++ test/validation/thrmask/thrmask.c | 44 +++++++++++++++++++++++++++++++++ test/validation/thrmask/thrmask.h | 13 ++++++++++ test/validation/thrmask/thrmask_main.c | 11 +++++++++ 9 files changed, 96 insertions(+) create mode 100644 test/validation/thrmask/.gitignore create mode 100644 test/validation/thrmask/Makefile.am create mode 100644 test/validation/thrmask/thrmask.c create mode 100644 test/validation/thrmask/thrmask.h create mode 100644 test/validation/thrmask/thrmask_main.c diff --git a/configure.ac b/configure.ac index 2ea1368..636ee4d 100644 --- a/configure.ac +++ b/configure.ac @@ -319,6 +319,7 @@ AC_CONFIG_FILES([Makefile test/validation/scheduler/Makefile test/validation/synchronizers/Makefile test/validation/thread/Makefile + test/validation/thrmask/Makefile test/validation/time/Makefile test/validation/timer/Makefile test/validation/shmem/Makefile diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index 7d1ce1b..bc330b2 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -20,6 +20,7 @@ TESTS = pktio/pktio_run \ ${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \ ${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT) \ ${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \ + ${top_builddir}/test/validation/thrmask/thrmask_main$(EXEEXT) \ ${top_builddir}/test/validation/time/time_main$(EXEEXT) \ ${top_builddir}/test/validation/timer/timer_main$(EXEEXT) \ ${top_builddir}/test/validation/shmem/shmem_main$(EXEEXT) \ diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 56ddd64..8d564f5 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -12,6 +12,7 @@ ODP_MODULES = buffer \ scheduler \ synchronizers \ thread \ + thrmask \ time \ timer \ shmem \ diff --git a/test/validation/cpumask/mask_common.h b/test/validation/cpumask/mask_common.h index 8e9602a..7bb6b1f 100644 --- a/test/validation/cpumask/mask_common.h +++ b/test/validation/cpumask/mask_common.h @@ -7,10 +7,23 @@ #ifndef ODP_MASK_COMMON_H_ #define ODP_MASK_COMMON_H_ +/* + * The same set of tests are used for testing both the odp_thrmask_ and + * odp_cpumask_ APIs. + * + * To build the thrmask tests TEST_THRMASK must be defined. + */ +#ifdef TEST_THRMASK +#include "thrmask.h" +typedef odp_thrmask_t _odp_mask_t; +#define MASK_API_PREFIX(n) odp_thrmask_##n +#define MASK_TESTFUNC(n) void thrmask_test_odp_thrmask_ ## n(void) +#else #include "cpumask.h" typedef odp_cpumask_t _odp_mask_t; #define MASK_API_PREFIX(n) odp_cpumask_##n #define MASK_TESTFUNC(n) void cpumask_test_odp_cpumask_ ## n(void) +#endif #define _odp_mask_from_str MASK_API_PREFIX(from_str) #define _odp_mask_to_str MASK_API_PREFIX(to_str) diff --git a/test/validation/thrmask/.gitignore b/test/validation/thrmask/.gitignore new file mode 100644 index 0000000..cf7b774 --- /dev/null +++ b/test/validation/thrmask/.gitignore @@ -0,0 +1,2 @@ +thrmask_main +libthrmask.a diff --git a/test/validation/thrmask/Makefile.am b/test/validation/thrmask/Makefile.am new file mode 100644 index 0000000..30b82a6 --- /dev/null +++ b/test/validation/thrmask/Makefile.am @@ -0,0 +1,10 @@ +include ../Makefile.inc + +noinst_LIBRARIES = libthrmask.a +libthrmask_a_SOURCES = thrmask.c ../cpumask/mask_common.c +libthrmask_a_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK -I../cpumask/ + +bin_PROGRAMS = thrmask_main$(EXEEXT) +dist_thrmask_main_SOURCES = thrmask_main.c +thrmask_main_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK -I../cpumask +thrmask_main_LDADD = libthrmask.a $(LIBCUNIT_COMMON) $(LIBODP) diff --git a/test/validation/thrmask/thrmask.c b/test/validation/thrmask/thrmask.c new file mode 100644 index 0000000..15d39c3 --- /dev/null +++ b/test/validation/thrmask/thrmask.c @@ -0,0 +1,44 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +#include "odp_cunit_common.h" +#include "thrmask.h" +#include "mask_common.h" + +static CU_TestInfo thrmask_suite[] = { + {"odp_thrmask_to/from_str()", thrmask_test_odp_thrmask_to_from_str}, + {"odp_thrmask_equal()", thrmask_test_odp_thrmask_equal}, + {"odp_thrmask_zero()", thrmask_test_odp_thrmask_zero}, + {"odp_thrmask_set()", thrmask_test_odp_thrmask_set}, + {"odp_thrmask_clr()", thrmask_test_odp_thrmask_clr}, + {"odp_thrmask_isset()", thrmask_test_odp_thrmask_isset}, + {"odp_thrmask_count()", thrmask_test_odp_thrmask_count}, + {"odp_thrmask_and()", thrmask_test_odp_thrmask_and}, + {"odp_thrmask_or()", thrmask_test_odp_thrmask_or}, + {"odp_thrmask_xor()", thrmask_test_odp_thrmask_xor}, + {"odp_thrmask_copy()", thrmask_test_odp_thrmask_copy}, + {"odp_thrmask_first()", thrmask_test_odp_thrmask_first}, + {"odp_thrmask_last()", thrmask_test_odp_thrmask_last}, + {"odp_thrmask_next()", thrmask_test_odp_thrmask_next}, + CU_TEST_INFO_NULL, +}; + +static CU_SuiteInfo thrmask_suites[] = { + {"thrmask", NULL, NULL, NULL, NULL, thrmask_suite}, + CU_SUITE_INFO_NULL, +}; + +unsigned max_supported_num_in_mask(void) +{ + return ODP_CONFIG_MAX_THREADS; +} + +int thrmask_main(void) +{ + return odp_cunit_run(thrmask_suites); +} diff --git a/test/validation/thrmask/thrmask.h b/test/validation/thrmask/thrmask.h new file mode 100644 index 0000000..8194775 --- /dev/null +++ b/test/validation/thrmask/thrmask.h @@ -0,0 +1,13 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _ODP_THRMASK_TEST_H_ +#define _ODP_THRMASK_TEST_H_ + +unsigned max_supported_num_in_mask(void); +int thrmask_main(void); + +#endif diff --git a/test/validation/thrmask/thrmask_main.c b/test/validation/thrmask/thrmask_main.c new file mode 100644 index 0000000..dd49817 --- /dev/null +++ b/test/validation/thrmask/thrmask_main.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "thrmask.h" + +int main(void) +{ + return thrmask_main(); +}