From patchwork Mon Feb 2 17:01:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 44161 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 11E39202A5 for ; Mon, 2 Feb 2015 17:02:14 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id s18sf17108082lam.2 for ; Mon, 02 Feb 2015 09:02:12 -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=1KMZP5g8wBnLDHqqvP1pPIsbR1cb78wvvzts1WhWpOY=; b=PXaES1r8Lbs2klvJTdPfWweTXw2o8Q6iOkm/795dLkSnLa9M6G4qFDE8rMJ+I17X4v 3zv+7jhv4Oxq9nihuoRALowkAt5GEKfO74O2+8FaSlTri+Bi/iAvVGxf8FUgyZCGvghs Y08/L1MRKmvVc4+A3t+bnnA2oFmYR+M9uclnxiYtjDqh6haRjcRogZ5wkGJi7Tmh9Bpw bh0l4IrOuviWVwYG5sdHvXQKhF+2oMgm1RN6sDtPSgEzLxfpW4D+Vt+dtchkgM5gWMrc B0cPXWpDES7ZuorhI0SIAYBh6vIMOVgxFfHKuEGbh+1PoINv65BcsJisVK4crM9Jc1lJ qLMA== X-Gm-Message-State: ALoCoQnRwNxLe34Ev6cr/CVF1rb4rzreIUt5uKAAkLbkcR/0es0rZxiHeQclyhbodDNsJadhrCLV X-Received: by 10.152.37.130 with SMTP id y2mr2527304laj.8.1422896532790; Mon, 02 Feb 2015 09:02:12 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.71 with SMTP id k7ls669239laf.9.gmail; Mon, 02 Feb 2015 09:02:12 -0800 (PST) X-Received: by 10.152.22.129 with SMTP id d1mr20796108laf.22.1422896532598; Mon, 02 Feb 2015 09:02:12 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id rb6si17428774lbb.8.2015.02.02.09.02.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 09:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id gf13so42826910lab.8 for ; Mon, 02 Feb 2015 09:02:12 -0800 (PST) X-Received: by 10.152.3.70 with SMTP id a6mr20602939laa.71.1422896532499; Mon, 02 Feb 2015 09:02:12 -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 h5csp1419156lbj; Mon, 2 Feb 2015 09:02:11 -0800 (PST) X-Received: by 10.140.36.239 with SMTP id p102mr38313904qgp.8.1422896531461; Mon, 02 Feb 2015 09:02:11 -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 41si25735186qgc.42.2015.02.02.09.02.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 09:02:11 -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 1YIKNz-0005jl-EB; Mon, 02 Feb 2015 17:02:07 +0000 Received: from mail-qg0-f42.google.com ([209.85.192.42]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIKNt-0005jf-DO for lng-odp@lists.linaro.org; Mon, 02 Feb 2015 17:02:01 +0000 Received: by mail-qg0-f42.google.com with SMTP id q107so48330292qgd.1 for ; Mon, 02 Feb 2015 09:01:56 -0800 (PST) X-Received: by 10.140.44.134 with SMTP id g6mr40613850qga.85.1422896516131; Mon, 02 Feb 2015 09:01:56 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id v65sm18753120qgd.20.2015.02.02.09.01.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Feb 2015 09:01:55 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Mon, 2 Feb 2015 12:01:41 -0500 Message-Id: <1422896501-4027-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH] validation: init: split cases into executables 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: 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.215.49 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 init_global can only be called once per executable, split the init_global testing into multiple executables. Signed-off-by: Mike Holmes --- test/validation/Makefile.am | 4 +-- test/validation/odp_init.c | 39 -------------------- test/validation/odp_init_log.c | 81 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 41 deletions(-) create mode 100644 test/validation/odp_init_log.c diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 2942b85..3ee59c8 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,10 +6,10 @@ AM_LDFLAGS += -static TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform} if test_vald -TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification +TESTS = odp_init odp_init_log odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification endif -bin_PROGRAMS = odp_init 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_log odp_queue odp_crypto odp_shm odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer odp_classification_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/classification diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c index c8e5a11..82f8849 100644 --- a/test/validation/odp_init.c +++ b/test/validation/odp_init.c @@ -11,10 +11,6 @@ #define DEFAULT_MSG_POOL_SIZE (4*1024*1024) #define DEFAULT_MSG_SIZE (8) -int replacement_logging_used; - -static int odp_init_log(odp_log_level_e level , const char *fmt, ...); - static void test_odp_init_global(void) { int status; @@ -25,27 +21,8 @@ static void test_odp_init_global(void) CU_ASSERT(status == 0); } -static void test_odp_init_global_replace_log(void) -{ - int status; - struct odp_init_t init_data; - - init_data.log_fn = &odp_init_log; - - replacement_logging_used = 0; - - status = odp_init_global(&init_data, NULL); - CU_ASSERT_FATAL(status == 0); - - CU_ASSERT_TRUE(replacement_logging_used); - - status = odp_term_global(); - CU_ASSERT(status == 0); -} - CU_TestInfo test_odp_init[] = { {"test_odp_init_global", test_odp_init_global}, - {"replace log", test_odp_init_global_replace_log}, CU_TEST_INFO_NULL, }; @@ -74,19 +51,3 @@ int main(void) return ret; } - -int odp_init_log(odp_log_level_e level __attribute__((unused)), - const char *fmt, ...) -{ - va_list args; - int r; - - /* just set a flag to be sure the replacement fn was used */ - replacement_logging_used = 1; - - va_start(args, fmt); - r = vfprintf(stderr, fmt, args); - va_end(args); - - return r; -} diff --git a/test/validation/odp_init_log.c b/test/validation/odp_init_log.c new file mode 100644 index 0000000..fbf54cc --- /dev/null +++ b/test/validation/odp_init_log.c @@ -0,0 +1,81 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +#define DEFAULT_MSG_POOL_SIZE (4*1024*1024) +#define DEFAULT_MSG_SIZE (8) + +int replacement_logging_used; + +static int odp_init_log(odp_log_level_e level , const char *fmt, ...); + +static void test_odp_init_global_replace_log(void) +{ + int status; + struct odp_init_t init_data; + + init_data.log_fn = &odp_init_log; + + replacement_logging_used = 0; + + status = odp_init_global(&init_data, NULL); + CU_ASSERT_FATAL(status == 0); + + CU_ASSERT_TRUE(replacement_logging_used); + + status = odp_term_global(); + CU_ASSERT(status == 0); +} + +CU_TestInfo test_odp_init[] = { + {"replace log", test_odp_init_global_replace_log}, + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo odp_testsuites[] = { + {"Init", NULL, NULL, NULL, NULL, test_odp_init}, + 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()); + + 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; +} + +int odp_init_log(odp_log_level_e level __attribute__((unused)), + const char *fmt, ...) +{ + va_list args; + int r; + + /* just set a flag to be sure the replacement fn was used */ + replacement_logging_used = 1; + + va_start(args, fmt); + r = vfprintf(stderr, fmt, args); + va_end(args); + + return r; +}