From patchwork Mon Feb 2 22:02:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 44176 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 6DCD02034D for ; Mon, 2 Feb 2015 22:03:12 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf22644828wid.3 for ; Mon, 02 Feb 2015 14:03:11 -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=4aM/HvzsomnRdRq+l4r4334T30EoNKbH9YdnplPG2FI=; b=gJ0wEsYaCfO1M3AOW/I2h1jE9Q2kcOawP6GHpfOYfS4vCxI42AGFfPjWahKwQQTffU m0NcSx31CF2jFyxcErGRP6p/dySQleP6r9xrh+zPVfRJqB55tqHLIx9f2u968GaLbQlT lCceBpym6ga9BppkgKtfKkO7Een/fM0QGtt7GTKEfRF6XcnWLx1qfrRCwnaJOaKGKhOJ B/mLi+SShVEzZdMlnVW0HtCe73M91H10z6aAg8FQMurSZZDk1fPFUOmkLxolpq7wLRxk m4Ba+BoAl0ZvVVb1+vD2O/ptQGKOeKKiv4akbCan+/c6Y0UypBNMh1oybpxtkT6jASeE pZ7Q== X-Gm-Message-State: ALoCoQliH3E0v6Mx0d3HRfK1XY+OmvVfGR+VrkPpPpbuQtlZxHuyvMN+NeCb189na3xUnQgcfJei X-Received: by 10.180.105.97 with SMTP id gl1mr1522005wib.7.1422914591783; Mon, 02 Feb 2015 14:03:11 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.232 with SMTP id h8ls124705lam.30.gmail; Mon, 02 Feb 2015 14:03:11 -0800 (PST) X-Received: by 10.112.220.36 with SMTP id pt4mr20975361lbc.15.1422914591586; Mon, 02 Feb 2015 14:03:11 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id t10si17884261lat.87.2015.02.02.14.03.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 14:03:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so45608750lab.6 for ; Mon, 02 Feb 2015 14:03:11 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr21860295lbl.25.1422914591307; Mon, 02 Feb 2015 14:03:11 -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 h5csp1567383lbj; Mon, 2 Feb 2015 14:03:10 -0800 (PST) X-Received: by 10.140.43.34 with SMTP id d31mr43878079qga.44.1422914589900; Mon, 02 Feb 2015 14:03:09 -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 t20si14445340qad.97.2015.02.02.14.03.07 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 14:03:09 -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 1YIP5F-0004K0-8k; Mon, 02 Feb 2015 22:03:05 +0000 Received: from mail-qa0-f48.google.com ([209.85.216.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIP5A-0004J9-0j for lng-odp@lists.linaro.org; Mon, 02 Feb 2015 22:03:00 +0000 Received: by mail-qa0-f48.google.com with SMTP id v8so31172344qal.7 for ; Mon, 02 Feb 2015 14:02:54 -0800 (PST) X-Received: by 10.140.46.97 with SMTP id j88mr43724657qga.12.1422914574780; Mon, 02 Feb 2015 14:02:54 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id p10sm19503563qab.18.2015.02.02.14.02.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Feb 2015 14:02:54 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Mon, 2 Feb 2015 17:02:40 -0500 Message-Id: <1422914560-8870-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH v2] 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.47 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 Reviewed-by: Taras Kondratiuk --- v2 fix copyright year remove uneeded defines test/validation/Makefile.am | 4 +-- test/validation/odp_init.c | 39 --------------------- test/validation/odp_init_log.c | 78 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 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..372d4f5 --- /dev/null +++ b/test/validation/odp_init_log.c @@ -0,0 +1,78 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +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; +}