From patchwork Thu Feb 4 08:07:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 61160 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp315489lbl; Thu, 4 Feb 2016 00:07:22 -0800 (PST) X-Received: by 10.140.167.86 with SMTP id n83mr7437169qhn.41.1454573242123; Thu, 04 Feb 2016 00:07:22 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a98si9486836qgf.112.2016.02.04.00.07.21; Thu, 04 Feb 2016 00:07:22 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 36FA6618BF; Thu, 4 Feb 2016 08:07:21 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=NN2egy9D; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 72A5E615BE; Thu, 4 Feb 2016 08:07: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 D4D846173B; Thu, 4 Feb 2016 08:07:14 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 9DA43604A1 for ; Thu, 4 Feb 2016 08:07:13 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id 78so30676305lfy.3 for ; Thu, 04 Feb 2016 00:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=VeT/y48Whlu5VAwNz75yod1QHZYMiE+KQij+KzovNFE=; b=NN2egy9DN1iY+Ybm88g8qZ7zhFbMfTzdGoA4HhcvFlwmRH/FVlSS9zRAr/cfPIIapv xTI6UkXQe+ZAHy7AxLDH1KVoziu5bRelnnFwc68KcGCt1p8e3hC6Ktvuvnqjm8vAmLCh rPZLcYZgz8u/rAvDO65iHn5vMQwlQa+3MiZBY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VeT/y48Whlu5VAwNz75yod1QHZYMiE+KQij+KzovNFE=; b=Pu+P81k1iDJis+4CHozS68fuyrEFacrn+PkdSCBZmFQj5AtmKwrCsUlpanLD0h9+QR QuyK0VYj9Q/tECO5tcHTmkpIED1epwkHiKlEA8o+0bxRxQfHJwDqSXJ0KEjYjcQz9gxx dksvJDR+IlgOc7S62tH+w42+Ss0awt0HYXQnlpLxEUqYDUqFwi6ieYmCb7894wxUWaTv wfgtsf8jD4kaMeKtYiPlMbx+WqG/qKVPmOf2/RMp3L2/fFzGRCrM6FOo1N49hsCQHfCJ gJDNndtEbYjg9MZIFeH43mBHsDBPMGyb2mMZ7QTIq+RJC9bankmbk/u31/cCbykE4cNQ fu9g== X-Gm-Message-State: AG10YORztkYI+rAUI8hrtHTtu1n83LWFo4sCYS08hFfX9Qy4/erwbIyYU9l/os+IRmswnkEWY2M= X-Received: by 10.25.150.7 with SMTP id y7mr2830931lfd.155.1454573232226; Thu, 04 Feb 2016 00:07:12 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id z193sm1415326lfd.0.2016.02.04.00.07.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 00:07:11 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 4 Feb 2016 11:07:07 +0300 Message-Id: <1454573227-12586-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] validation: define ODP_TEST_INACTIVE and ODP_TEST_ACTIVE X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" It's quite difficult to review code with 0 for skip and something else for not skip tests. Define readable names to make better code reading. Signed-off-by: Maxim Uvarov --- - patch depends on [PATCH] validation: system: fix return code for checks test/validation/common/odp_cunit_common.h | 7 +++++-- test/validation/pktio/pktio.c | 13 ++++++++----- test/validation/system/system.c | 8 ++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 37e8e8c..bf7a7f3 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -47,9 +47,12 @@ static inline void odp_cunit_test_missing(void) { } #define ODP_TEST_INFO_INACTIVE(test_func, args...) \ {#test_func, odp_cunit_test_missing, odp_cunit_test_inactive} +#define ODP_TEST_INACTIVE 0 +#define ODP_TEST_ACTIVE 1 + /* A test case that may be marked as inactive at runtime based on the - * return value of the cond_func function. A return value of 0 means - * inactive, anything else is active. */ + * return value of the cond_func function. A return value of ODP_TEST_INACTIVE + * means inactive, ODP_TEST_ACTIVE means active. */ #define ODP_TEST_INFO_CONDITIONAL(test_func, cond_func) \ {#test_func, test_func, cond_func} diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 17dd580..730be0e 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -818,15 +818,15 @@ int pktio_check_statistics_counters(void) pktio = odp_pktio_open(iface, pool[0], &pktio_param); if (pktio == ODP_PKTIO_INVALID) - return -1; + return ODP_TEST_INACTIVE; ret = odp_pktio_stats(pktio, &stats); (void)odp_pktio_close(pktio); if (ret == 0) - return 1; /* supported, need test */ + return ODP_TEST_ACTIVE; - return 0; + return ODP_TEST_INACTIVE; } void pktio_test_statistics_counters(void) @@ -1109,7 +1109,7 @@ int pktio_check_send_failure(void) pktio_tx = odp_pktio_open(iface, pool[iface_idx], &pktio_param); if (pktio_tx == ODP_PKTIO_INVALID) { fprintf(stderr, "%s: failed to open pktio\n", __func__); - return 0; + return ODP_TEST_INACTIVE; } /* read the MTU from the transmit interface */ @@ -1117,7 +1117,10 @@ int pktio_check_send_failure(void) odp_pktio_close(pktio_tx); - return (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32); + if (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32) + return ODP_TEST_ACTIVE; + + return ODP_TEST_INACTIVE; } void pktio_test_send_failure(void) diff --git a/test/validation/system/system.c b/test/validation/system/system.c index 5d87b8b..ac34b24 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -218,10 +218,10 @@ int system_check_odp_cpu_hz(void) { if (odp_cpu_hz() == 0) { fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); - return 0; + return ODP_TEST_INACTIVE; } - return 1; + return ODP_TEST_ACTIVE; } void system_test_odp_cpu_hz(void) @@ -250,12 +250,12 @@ int system_check_odp_cpu_hz_id(void) fprintf(stderr, "cpu %d does not support" " odp_cpu_hz_id()," "skip that test\n", cpu); - return 0; + return ODP_TEST_INACTIVE; } cpu = odp_cpumask_next(&mask, cpu); } - return 1; + return ODP_TEST_ACTIVE; } void system_test_odp_cpu_hz_id(void)