From patchwork Tue Mar 3 23:51:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 45378 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BECD82142B for ; Tue, 3 Mar 2015 23:51:44 +0000 (UTC) Received: by wiwl15 with SMTP id l15sf17582546wiw.0 for ; Tue, 03 Mar 2015 15:51:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state: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=05Fe8dB6fd2pYVTd24rfN5vabWqCinmsO8Y60lEInV8=; b=DKydBmjNW37akSiNV/3WuYNjIGaszhAftuGplHyG2h7/BonEUT0AvlE8lN57acJAT0 +gY7CWcylOQsivNNk6oXhFJynLwcCgUsaw6PEI73NEHWe85mj0mP5wCequpOwDDl2R1H rszOiNK+jGPXawYCk159y3BjHtbr1GxpX3zJsgjAWVzvWVLqxYJS3VWippFn9zcBtaqR 0qiVbuQIW5o7fHLRq6NEgZeDSwMQiMPlSM9ZMU0pQIbupQzNo3YWJJSCdAHm3K9mcskx UtezV1EMZ+FpYpwpFwF3qKQAHzBAT5N3Gna4O8qpw4lLbUVL0WZh+51Yf3dNxyV7pgtp RJfQ== X-Gm-Message-State: ALoCoQkmiUHPhSNXWwcI4ET1fz1CPe/IXN/HLPrDds/9mn/VYMFuCcloKddEM6941wCWHRS2o+em X-Received: by 10.180.11.34 with SMTP id n2mr658666wib.2.1425426704052; Tue, 03 Mar 2015 15:51:44 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.6 with SMTP id v6ls112812laa.13.gmail; Tue, 03 Mar 2015 15:51:43 -0800 (PST) X-Received: by 10.153.11.163 with SMTP id ej3mr1164623lad.52.1425426703727; Tue, 03 Mar 2015 15:51:43 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id x6si1489523lal.29.2015.03.03.15.51.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2015 15:51:43 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbiz11 with SMTP id z11so14783751lbi.13 for ; Tue, 03 Mar 2015 15:51:43 -0800 (PST) X-Received: by 10.112.211.200 with SMTP id ne8mr1006290lbc.73.1425426703349; Tue, 03 Mar 2015 15:51:43 -0800 (PST) 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.35.133 with SMTP id h5csp880445lbj; Tue, 3 Mar 2015 15:51:42 -0800 (PST) X-Received: by 10.140.144.73 with SMTP id 70mr2287542qhq.34.1425426701435; Tue, 03 Mar 2015 15:51:41 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id y5si1991020qgy.79.2015.03.03.15.51.33 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Mar 2015 15:51:41 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSwb3-0002BB-QP; Tue, 03 Mar 2015 23:51:29 +0000 Received: from mail-ob0-f169.google.com ([209.85.214.169]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSwam-00029C-JD for lng-odp@lists.linaro.org; Tue, 03 Mar 2015 23:51:12 +0000 Received: by obcuz6 with SMTP id uz6so3399849obc.12 for ; Tue, 03 Mar 2015 15:51:07 -0800 (PST) X-Received: by 10.202.65.8 with SMTP id o8mr890353oia.113.1425426667198; Tue, 03 Mar 2015 15:51:07 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id nb15sm1290884obc.20.2015.03.03.15.51.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Mar 2015 15:51:06 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 3 Mar 2015 17:51:01 -0600 Message-Id: <1425426661-12398-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCHv2] validation: strongtypes: add unit tests for strong type display functions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@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.169 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: Bill Fischofer --- test/validation/.gitignore | 1 + test/validation/Makefile.am | 2 + test/validation/odp_strongtypes.c | 86 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 test/validation/odp_strongtypes.c diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 2eab34c..1f7f37e 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -14,6 +14,7 @@ odp_queue odp_random odp_schedule odp_shm +odp_strongtypes odp_synchronizers odp_system odp_time diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0833181..4d04349 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ odp_random \ odp_schedule \ odp_shm \ + odp_strongtypes \ odp_system \ odp_synchronizers \ odp_time \ @@ -52,6 +53,7 @@ dist_odp_queue_SOURCES = odp_queue.c $(ODP_CU_COMMON) dist_odp_random_SOURCES = odp_random.c $(ODP_CU_COMMON) dist_odp_schedule_SOURCES = odp_schedule.c $(ODP_CU_COMMON) dist_odp_shm_SOURCES = odp_shm.c $(ODP_CU_COMMON) +dist_odp_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) dist_odp_synchronizers_SOURCES = odp_synchronizers.c $(ODP_CU_COMMON) dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) diff --git a/test/validation/odp_strongtypes.c b/test/validation/odp_strongtypes.c new file mode 100644 index 0000000..29407b5 --- /dev/null +++ b/test/validation/odp_strongtypes.c @@ -0,0 +1,86 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include + +static void test_odp_strong_types(void) +{ + odp_buffer_t buf = ODP_BUFFER_INVALID; + odp_cos_t cos = ODP_COS_INVALID; + odp_pmr_t pmr = ODP_PMR_INVAL; + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; + odp_crypto_session_t csession = ODP_CRYPTO_SESSION_INVALID; + /* odp_crypto_compl_t ccompl; */ + odp_event_t evt = ODP_EVENT_INVALID; + odp_pktio_t pktio = ODP_PKTIO_INVALID; + odp_packet_t pkt = ODP_PACKET_INVALID; + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; + odp_pool_t pool = ODP_POOL_INVALID; + odp_queue_t queue = ODP_QUEUE_INVALID; + odp_shm_t shm = ODP_SHM_INVALID; + + /* + * Note: These type conversion functions have no defined return values + * since they produce implementation-defined values for display + * purposes. This test simply verifies that they exist and can be + * invoked. + */ + + CU_ASSERT(odp_buffer_to_u64(buf) == + odp_buffer_to_u64(ODP_BUFFER_INVALID)); + + CU_ASSERT(odp_cos_to_u64(cos) == + odp_cos_to_u64(ODP_COS_INVALID)); + + CU_ASSERT(odp_pmr_to_u64(pmr) == + odp_pmr_to_u64(ODP_PMR_INVAL)); + + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); + + CU_ASSERT(odp_crypto_session_to_u64(csession) == + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); + + /* + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == + odp_crypto_compl_to_u64(ccompl)); + */ + + CU_ASSERT(odp_event_to_u64(evt) == + odp_event_to_u64(ODP_EVENT_INVALID)); + + CU_ASSERT(odp_pktio_to_u64(pktio) == + odp_pktio_to_u64(ODP_PKTIO_INVALID)); + + CU_ASSERT(odp_packet_to_u64(pkt) == + odp_packet_to_u64(ODP_PACKET_INVALID)); + + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); + + CU_ASSERT(odp_pool_to_u64(pool) == + odp_pool_to_u64(ODP_POOL_INVALID)); + + CU_ASSERT(odp_queue_to_u64(queue) == + odp_queue_to_u64(ODP_QUEUE_INVALID)); + + CU_ASSERT(odp_shm_to_u64(shm) == + odp_shm_to_u64(ODP_SHM_INVALID)); +} + +CU_TestInfo test_odp_type_display[] = { + {"ODP abstract type diplay test", test_odp_strong_types}, + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo odp_testsuites[] = { + { "ODP abstract type display functions", + NULL, NULL, NULL, NULL, + test_odp_type_display, + }, + CU_SUITE_INFO_NULL, +};