From patchwork Mon Jul 13 17:53:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 51079 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 742DB20319 for ; Mon, 13 Jul 2015 17:57:59 +0000 (UTC) Received: by lagw2 with SMTP id w2sf22664329lag.3 for ; Mon, 13 Jul 2015 10:57:58 -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=/XFZRCjzZg68sICCoNnqQRXSkYsDNTgA1s+tIM+J1r8=; b=UI+8u75Fw1BDyiX8u/Iyf9dLAbcAmJK46chaSG1OjUM5VguHMvzqJyz5o5MLIirH4c cwi84O+56OGCuNr2fclTYQjkKpw6XLrm06WtXLxV0t+tnzYmxpZm5A7dwBoiRajW/xd2 oUAMBKkcZlqfc2werDndUDmhcOcwZk0hCpLBEXxmhnecA3F858BVavKKVdIGxaAeRNTV dckK6l0uCjtrT+i0mlS8w0SNKnNRlN7MDJic6/E3Pcxwcq1GqEVHjllXvxLwvmpm1HMO KyttZSkFjISBRzN/KPH03fEUi+72eezpC8XGw4oYegIxj6g3cfdIZ2qxibwnw6a4GD06 o22w== X-Gm-Message-State: ALoCoQlGOcrwjbHjVTwiNWBSVh+kfZADYEkBMqRDTXdyUF1fJLuQ6I+fDW8S1bIMSRSHzKinlHS/ X-Received: by 10.180.36.242 with SMTP id t18mr7772854wij.3.1436810278329; Mon, 13 Jul 2015 10:57:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls1715610laz.2.gmail; Mon, 13 Jul 2015 10:57:58 -0700 (PDT) X-Received: by 10.112.137.164 with SMTP id qj4mr33235289lbb.105.1436810278159; Mon, 13 Jul 2015 10:57:58 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id r11si15939197lby.31.2015.07.13.10.57.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2015 10:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lagx9 with SMTP id x9so304952960lag.1 for ; Mon, 13 Jul 2015 10:57:58 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr34079747lal.35.1436810278046; Mon, 13 Jul 2015 10:57:58 -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 hn6csp1878584lbb; Mon, 13 Jul 2015 10:57:57 -0700 (PDT) X-Received: by 10.55.24.12 with SMTP id j12mr31683231qkh.38.1436810276666; Mon, 13 Jul 2015 10:57:56 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j92si21864576qgj.3.2015.07.13.10.57.56; Mon, 13 Jul 2015 10:57:56 -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 DC7DA61DAA; Mon, 13 Jul 2015 17:57:55 +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 3D8F561E16; Mon, 13 Jul 2015 17:54:12 +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 EF0E661E1B; Mon, 13 Jul 2015 17:54:06 +0000 (UTC) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by lists.linaro.org (Postfix) with ESMTPS id 58D2861CA2 for ; Mon, 13 Jul 2015 17:53:32 +0000 (UTC) Received: by wgjx7 with SMTP id x7so302001373wgj.2 for ; Mon, 13 Jul 2015 10:53:31 -0700 (PDT) X-Received: by 10.194.77.179 with SMTP id t19mr72168124wjw.30.1436810011628; Mon, 13 Jul 2015 10:53:31 -0700 (PDT) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id fm8sm15888662wib.9.2015.07.13.10.53.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jul 2015 10:53:31 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Mon, 13 Jul 2015 18:53:07 +0100 Message-Id: <1436809989-9225-5-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1436809989-9225-1-git-send-email-stuart.haslam@linaro.org> References: <1436809989-9225-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 4/6] 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.215.42 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 | 14 ++++++++++- 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(+), 1 deletion(-) 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 a8c6ba7..7bb6b1f 100644 --- a/test/validation/cpumask/mask_common.h +++ b/test/validation/cpumask/mask_common.h @@ -7,11 +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(); +}