From patchwork Sat Feb 7 00:07:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44491 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3BA8121521 for ; Sat, 7 Feb 2015 00:07:39 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u14sf7800537lbd.3 for ; Fri, 06 Feb 2015 16:07:37 -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=CNdNDX8mh4Buoucgha7h4DW4zy524YENaVWyyO+ZrqE=; b=mnsz1rPNWssEbI4YiL8eiCHzXtDELIm7FKppse3OCp4vJBM00oUA+EkYaTWxa943r5 kUEwm4gFFsBfbpqxdF/XV4e18F2VIOPsBBWMKdQpNlZqGeRougB6BAMnULQ+z2DotMJJ Tq6uDke2QDAkq7832R5LdavREVWuiN2jOJEYcyoYtw28c3cygTda42FgxEl+eXxPEe2x ShGGCa6yVClyB8rYBc9PoROv1lc1XXSkwiAB9koFWW/WutsPVU7p6rV3YvLupgdy1/NG 2RXVcSMjIhOAnSPz+qcLW2D0L2/SdNfwwRemYceShVXbaatbbpFkanR8JoeydAcdYIYL Gwkw== X-Gm-Message-State: ALoCoQkwdE+NaW8j10bBCIXYaIVmfXGshrFL7flsC5AT3+m8NFIjbNUzGqfXe8yRgX35sZBzZKew X-Received: by 10.112.171.37 with SMTP id ar5mr621260lbc.16.1423267657574; Fri, 06 Feb 2015 16:07:37 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.226 with SMTP id m2ls351192laa.82.gmail; Fri, 06 Feb 2015 16:07:37 -0800 (PST) X-Received: by 10.112.144.164 with SMTP id sn4mr5162708lbb.2.1423267657283; Fri, 06 Feb 2015 16:07:37 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id h2si2526911lbd.52.2015.02.06.16.07.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Feb 2015 16:07:36 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id u14so14464065lbd.12 for ; Fri, 06 Feb 2015 16:07:36 -0800 (PST) X-Received: by 10.112.125.4 with SMTP id mm4mr5338736lbb.86.1423267656619; Fri, 06 Feb 2015 16:07:36 -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 h5csp2119482lbj; Fri, 6 Feb 2015 16:07:35 -0800 (PST) X-Received: by 10.229.125.133 with SMTP id y5mr1116991qcr.17.1423267655240; Fri, 06 Feb 2015 16:07:35 -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 r8si4773807qac.28.2015.02.06.16.07.33 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 06 Feb 2015 16:07:35 -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 1YJsvp-0002nw-Vz; Sat, 07 Feb 2015 00:07:30 +0000 Received: from mail-ob0-f181.google.com ([209.85.214.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YJsvk-0002np-8H for lng-odp@lists.linaro.org; Sat, 07 Feb 2015 00:07:24 +0000 Received: by mail-ob0-f181.google.com with SMTP id vb8so16408530obc.12 for ; Fri, 06 Feb 2015 16:07:19 -0800 (PST) X-Received: by 10.202.85.146 with SMTP id j140mr4087026oib.65.1423267638863; Fri, 06 Feb 2015 16:07:18 -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 yr13sm1915500obc.20.2015.02.06.16.07.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Feb 2015 16:07:18 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Fri, 6 Feb 2015 18:07:13 -0600 Message-Id: <1423267633-15604-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH] 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.181 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 --- Intial version tests all display functions except odp_crypto_compl_to_u64() as there does not appear to an architected way to create one of these objects. test/validation/.gitignore | 1 + test/validation/Makefile.am | 3 +- test/validation/strongtypes.c | 110 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 test/validation/strongtypes.c diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 197b094..62000e1 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -13,4 +13,5 @@ odp_pktio odp_buffer odp_timer odp_time +odp_strongtypes odp_synchronizers diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index f9d7d7a..5e6a44e 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -11,7 +11,7 @@ endif dist_bin_SCRIPTS = $(srcdir)/odp_pktio_run -bin_PROGRAMS = odp_init odp_init_abort odp_init_log odp_queue odp_crypto odp_shm odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification +bin_PROGRAMS = odp_init odp_init_abort odp_init_log odp_queue odp_crypto odp_shm odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification odp_strongtypes odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer odp_classification_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/classification @@ -38,3 +38,4 @@ dist_odp_synchronizers_SOURCES = odp_synchronizers.c \ dist_odp_classification_SOURCES = classification/odp_classification_tests.c \ classification/odp_classification_basic.c \ odp_classification.c common/odp_cunit_common.c +dist_odp_strongtypes_SOURCES = strongtypes.c diff --git a/test/validation/strongtypes.c b/test/validation/strongtypes.c new file mode 100644 index 0000000..6dc3976 --- /dev/null +++ b/test/validation/strongtypes.c @@ -0,0 +1,110 @@ +/* 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, +}; + +int main(void) +{ + int ret; + + printf("\tODP API version: %s\n", odp_version_api_str()); + printf("\tODP implementation version: %s\n", odp_version_impl_str()); + + /* odp_init_global(NULL, NULL); */ + /* odp_init_local(); */ + + CU_set_error_action(CUEA_ABORT); + + CU_initialize_registry(); + CU_register_suites(odp_testsuites); + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + + ret = CU_get_number_of_failure_records(); + + CU_cleanup_registry(); + + return ret; +}