From patchwork Mon May 11 10:48:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 48234 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8AF5621550 for ; Mon, 11 May 2015 10:49:45 +0000 (UTC) Received: by wiun10 with SMTP id n10sf24722166wiu.1 for ; Mon, 11 May 2015 03:49:44 -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:cc: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=9P42IYXLFBeSwK+XkjrsQ0j2y/wHqPexvk3Z+ekMn+8=; b=MYbXvNMcwv/D4kwM8AYfwk6LxoolG6bp0k6nJFc1Cl2wirx+R+uXMVC4F7UTPM6QUl 2V707drZQzNHE2XvS2adTPyBxiUT+s7aYw0EzKmK7/Z6bjzEVod85sMP2Ars/MHJKVVf zDVQXNEavcJL4B1Z/PyVLlYKDoXWQ9vXvoSMewe25Gh/Hfm9TQ1q4NodWYSb7WW1F1qs GFlkvPnMReOgdH6OX1feWJ3wLYtqxvq0e1RMRRCcENy0iqQDV5B8GBtIIWtFKs0Ug4Xe eBf1cByZx5rwcrL3SQi1AU24SL7WkV/SJj+c4qXhNee/qMNamZWs+qpK8bQyRwz4KNNN VxyA== X-Gm-Message-State: ALoCoQlVpr8//3NTxIM6c1g4TmvtXwYTiRxIhSMDcFB8AM1dmuK8ykXK0fHj4Mx/rrQI1U82IDdT X-Received: by 10.112.200.166 with SMTP id jt6mr7185003lbc.17.1431341384856; Mon, 11 May 2015 03:49:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.39 with SMTP id kv7ls640498lac.63.gmail; Mon, 11 May 2015 03:49:44 -0700 (PDT) X-Received: by 10.152.115.173 with SMTP id jp13mr7495229lab.119.1431341384701; Mon, 11 May 2015 03:49:44 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id p9si8122550laj.176.2015.05.11.03.49.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 03:49:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbzk7 with SMTP id zk7so90904298lbb.0 for ; Mon, 11 May 2015 03:49:44 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr7769339lab.35.1431341384560; Mon, 11 May 2015 03:49:44 -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 hn6csp1430632lbb; Mon, 11 May 2015 03:49:44 -0700 (PDT) X-Received: by 10.140.35.178 with SMTP id n47mr12246600qgn.24.1431341383591; Mon, 11 May 2015 03:49:43 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 40si12603124qkv.70.2015.05.11.03.49.42; Mon, 11 May 2015 03:49:43 -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 AB8A461C9B; Mon, 11 May 2015 10:49:42 +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 7C7B861B3C; Mon, 11 May 2015 10:49:16 +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 E369161B3E; Mon, 11 May 2015 10:49:06 +0000 (UTC) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by lists.linaro.org (Postfix) with ESMTPS id 4426E61B3E for ; Mon, 11 May 2015 10:48:42 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2so90811947lbb.3 for ; Mon, 11 May 2015 03:48:41 -0700 (PDT) X-Received: by 10.112.29.180 with SMTP id l20mr7308345lbh.95.1431341321216; Mon, 11 May 2015 03:48:41 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by mx.google.com with ESMTPSA id x2sm2969919laj.8.2015.05.11.03.48.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 03:48:40 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Mon, 11 May 2015 12:48:25 +0200 Message-Id: <1431341307-9933-2-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431341307-9933-1-git-send-email-christophe.milard@linaro.org> References: <1431341307-9933-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 1/3] validation: preparing for main in 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: christophe.milard@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.173 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 A macro, called MODULE_HAS_OWN_MAIN is used to tell odp_cunit_common.c whether to define a main or not. If MODULE_HAS_OWN_MAIN is defined, odp_cunit_common.c does not define any main, but offers odp_cunit_run(CU_SuiteInfo testsuites[]) to run the tests. MODULE_HAS_OWN_MAIN is meant to be used during the transition period where old style tests (defining the symbol odp_testsuites and expecting main() to be created by odp_cunit_common.c) will coexist with new style tests (defining their own main() and calling odp_cunit_run()). After the conversion of all tests, MODULE_HAS_OWN_MAIN is meant to be removed. Signed-off-by: Christophe Milard --- test/validation/common/odp_cunit_common.c | 20 +++++++++++--------- test/validation/common/odp_cunit_common.h | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index 2af4410..5870b80 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -1,15 +1,9 @@ -/* Copyright (c) 2014, Linaro Limited +/* Copyright (c) 2015, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -/** - * @file - * - * ODP test application common - */ - #include #include #include @@ -49,7 +43,7 @@ __attribute__((__weak__)) int tests_global_term(void) return 0; } -int main(void) +int odp_cunit_run(CU_SuiteInfo testsuites[]) { int ret; @@ -72,7 +66,7 @@ int main(void) CU_set_error_action(CUEA_ABORT); CU_initialize_registry(); - CU_register_suites(odp_testsuites); + CU_register_suites(testsuites); CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); @@ -95,3 +89,11 @@ int main(void) return (ret) ? -1 : 0; } + +/* this is left for old style main declartion. will be removed soon */ +#ifndef MODULE_HAS_OWN_MAIN +int main(void) +{ + return odp_cunit_run(odp_testsuites); +} +#endif diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 127020d..3b4d9fb 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -24,6 +24,9 @@ */ extern CU_SuiteInfo odp_testsuites[]; +/* the function, called by module main(), to run the testsuites: */ +int odp_cunit_run(CU_SuiteInfo testsuites[]); + typedef struct { uint32_t foo; uint32_t bar;