From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E9DAA0C4E; Fri, 15 Oct 2021 15:43:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A211411D8; Fri, 15 Oct 2021 15:43:09 +0200 (CEST) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mails.dpdk.org (Postfix) with ESMTP id 6F93A411CB for ; Fri, 15 Oct 2021 15:43:07 +0200 (CEST) Received: by mail-wr1-f51.google.com with SMTP id g25so26501947wrb.2 for ; Fri, 15 Oct 2021 06:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JvOH3NiQwdqSGmbqS8YS3iIOn3xGpvqBt9h4scjycIk=; b=eDonlsHEMpc8l7B+M4SrzE3pcj9stuhChBetJAd0DpzID5zT6ZPG0m0YCpCxxURMG7 XyXxWkQpQlgbAsZcCclCOnbGq40Snsn/Ks2//o7jVTe1PT4gc7DjRlKLCsFcXrDT4lbx TVVodm7nQaJT/eaPnFbFUbcUd3E2J1CCQVnf8B1kkttYGN9edmFheF4LxEr+qcANGYnO wOVXs6xB3XXRtgf/fBWaFm3R7t4T6yvaCB/RVA6rsAZ2IIR01jKUYc3Bf+OQumbyNNVF HMbKnF/h1l0Yc2OoKJJ5omVUpkKiCIx7mcXfAGQzGi3tub0h7G8aRuGHX3A6myntdQAj pKxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JvOH3NiQwdqSGmbqS8YS3iIOn3xGpvqBt9h4scjycIk=; b=uCV1Sp03Lwlrjze/p09OXwKP0ki/sRIXgLyATWmnycRW++6o17h3wqgqMRGCu9cq6d GW7ng4daeE6BZg/9Alhg0gHcUZqaegLePgVs9R8GrmNlsN6LgyBFpoYnC6TVlBDadvsD HFg88VrtX8MZcwU6PmB21xpBz0sE39CGr8kV49HoXtRXjjVlI/JQpo9ZiPQ3xoguaDkc kYCzEA5lk1HDSC0pWammfWrQoQd1rNfkkZ+BrkC5IkLY7Pt4la+iTDjB30emQ4Bv1j8j 48/SxWxYYlKxR7/61g3AlxIe7QISfqHjhRLCPA4UwXRDk9R29/ESqW2+/9JowgkqF7Zo x+5Q== X-Gm-Message-State: AOAM531VW2PBEG1BPU/q4RzXGeJm3hsn9A5Gjmu7mv+rzUv07ofV626v DAB8MPI8hnEeTSQRLl+xPRIPnQ== X-Google-Smtp-Source: ABdhPJzBL9ZHIT3617bOJ7w/M1a02Hq6RzzMC8s9O5q2IvLuHyg7K3j/ajUXl5bKb/ekDL13K4d7Og== X-Received: by 2002:adf:a4c7:: with SMTP id h7mr14060647wrb.57.1634305387168; Fri, 15 Oct 2021 06:43:07 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id l13sm4961218wrn.79.2021.10.15.06.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 06:43:06 -0700 (PDT) Date: Fri, 15 Oct 2021 15:43:06 +0200 From: Olivier Matz To: Dmitry Kozlyuk Cc: "dev@dpdk.org" , Andrew Rybchenko , Matan Azrad Message-ID: References: <20211012000409.2751908-1-dkozlyuk@nvidia.com> <20211013110131.2909604-1-dkozlyuk@nvidia.com> <20211013110131.2909604-3-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dpdk-dev] [PATCH v4 2/4] mempool: add non-IO flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Oct 15, 2021 at 01:27:59PM +0000, Dmitry Kozlyuk wrote: > > [...] > > > +static int > > > +test_mempool_flag_non_io_set_when_no_iova_contig_set(void) > > > +{ > > > + struct rte_mempool *mp; > > > + int ret; > > > + > > > + mp = rte_mempool_create_empty("empty", MEMPOOL_SIZE, > > > + MEMPOOL_ELT_SIZE, 0, 0, > > > + SOCKET_ID_ANY, > > MEMPOOL_F_NO_IOVA_CONTIG); > > > + RTE_TEST_ASSERT_NOT_NULL(mp, "Cannot create mempool: %s", > > > + rte_strerror(rte_errno)); > > > + rte_mempool_set_ops_byname(mp, rte_mbuf_best_mempool_ops(), NULL); > > > + ret = rte_mempool_populate_default(mp); > > > + RTE_TEST_ASSERT(ret > 0, "Failed to populate mempool: %s", > > > + rte_strerror(rte_errno)); > > > + RTE_TEST_ASSERT(mp->flags & MEMPOOL_F_NON_IO, > > > + "NON_IO flag is not set when NO_IOVA_CONTIG is > > set"); > > > + rte_mempool_free(mp); > > > + return 0; > > > +} > > > > One comment that also applies to the previous patch. Using > > RTE_TEST_ASSERT_*() is convenient to test a condition, display an error > > message and return on error in one operation. But here it can cause a > > leak on test failure. > > > > I don't know what is the best approach to solve the issue. Having > > equivalent test macros that do "goto fail" instead of "return -1" would > > help here. I mean something like: > > RTE_TEST_ASSERT_GOTO_*(cond, label, fmt, ...) > > > > What do you think? > > This can work with existing macros: > > #define TEST_TRACE_FAILURE(...) goto fail > > Because of "trace" in the name it looks a bit like a hijacking. > Probably the macro should be named TEST_HANDLE_FAILURE > to suggest broader usages than just tracing, > but for now it looks the most neat way. That would work for me. What about introducing another macro for this usage, that would be "return -1" by default and that can be overridden?