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 B8BC6426CE; Fri, 6 Oct 2023 10:52:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A71EA402A8; Fri, 6 Oct 2023 10:52:21 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id A0D5B4014F for ; Fri, 6 Oct 2023 10:52:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696582339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7xA98IPOBySMD2GA4WnhnNz3QdRsEfzectDnZL8enM8=; b=Wn8D7MPfH1kvVVGX+0wI45p2lyaicYP1jR4+vfxDvCzKu3+dEXYNyqAt1lZA/HCTX2yjIP DmnD4F+21hHsMCRuf0wF5geUUhWmPFr9FkQGZM8ogiphGtsu3ILuJ/u7rIeZjNY3u6zjir +nnwgKxbfjIKSaEzWWkDz0gdWkQQthI= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-192-YDDZxR_0Ore6ZvFnPaX5Qg-1; Fri, 06 Oct 2023 04:52:15 -0400 X-MC-Unique: YDDZxR_0Ore6ZvFnPaX5Qg-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ba1949656bso17639891fa.0 for ; Fri, 06 Oct 2023 01:52:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696582334; x=1697187134; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7xA98IPOBySMD2GA4WnhnNz3QdRsEfzectDnZL8enM8=; b=jGiX8MmoA+bfxdV6oyGOlke0ysC4Pd5NoZUx9rqeNpC7y9a7lJtpBdEP0Z7ZJK15NT UmopqLU9cCHfjx0ktzvXQv31qo3esqej0YDm+QtO8W3OXpZYEpFux1CSRwsa5mjyYkJg JPWV3EqEaVaz0yaOTeJDWJPVWAXEYpMlfecbkVDPLXxco3UUujyix5Bgda52Gl72URzU KkEFeoXXQygnYU0JTyahm7gsDqdkjfjlsFdNpwHY7VHlw3P5I/ppfx/IZ6vv3UlGDIpG P+bE0mrjDMOXLeXfrbwIwnVj6eW9jgKC9+ZUMh6jal9TKGQrDbCaXa+L1yviUhIQ9I/y BwjA== X-Gm-Message-State: AOJu0Yz2u5cN9n/9OBEq/1S81ZrVmitAtvlXTw6K+W49GjG4p87m2yda WwLGfZe4j4A2WSo5Wdng1iszGxqfeWI9I62hX9CV4zMp9qYtxceN1Dp/YVPQECPz9yEuY8b+hE/ a7D6a1nYyCfEmjBV6Juk= X-Received: by 2002:a2e:a0c8:0:b0:2b9:f13b:613c with SMTP id f8-20020a2ea0c8000000b002b9f13b613cmr6701008ljm.2.1696582334507; Fri, 06 Oct 2023 01:52:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLdcvtyozLMY+ycaQFWo+7+7PLD0/k+kmV0YApl+vIwJmoOU5mtVaGIBi8xGEqxwNmVqbWt5I/05JPrve6UUQ= X-Received: by 2002:a2e:a0c8:0:b0:2b9:f13b:613c with SMTP id f8-20020a2ea0c8000000b002b9f13b613cmr6700990ljm.2.1696582334047; Fri, 06 Oct 2023 01:52:14 -0700 (PDT) MIME-Version: 1.0 References: <20230922073825.351453-2-mattias.ronnblom@ericsson.com> <20230928073056.359356-1-mattias.ronnblom@ericsson.com> <20230928073056.359356-3-mattias.ronnblom@ericsson.com> In-Reply-To: From: David Marchand Date: Fri, 6 Oct 2023 10:52:02 +0200 Message-ID: Subject: Re: [PATCH v5 2/3] test: add dispatcher test suite To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , dev@dpdk.org, Jerin Jacob , techboard@dpdk.org, harry.van.haaren@intel.com, Peter Nilsson , Heng Wang , Naga Harish K S V , Pavan Nikhilesh , Gujjar Abhinandan S , Erik Gabriel Carrillo , Shijith Thotton , Hemant Agrawal , Sachin Saxena , Liang Ma , Peter Mccarthy , Zhirun Yan X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Thu, Oct 5, 2023 at 1:26=E2=80=AFPM Mattias R=C3=B6nnblom wrote: [snip] > >> +#define RETURN_ON_ERROR(rc) \ > >> + do { \ > >> + if (rc !=3D TEST_SUCCESS) \ > >> + return rc; \ > >> + } while (0) > > > > TEST_ASSERT? > > This gives context about which part of a test failed. > > > > This macro is used in a situation where the failure has occured and has > been reported already. > > Maybe it would be better to replace the macro instationation with just > the if+return statements. > > RETURN_ON_ERROR(rc); > > -> > > if (rc !=3D TEST_SUCCESS) > return rc; Yes, this macro does not add much, you can remove it. [snip] > >> + for (i =3D 0; i < NUM_SERVICE_CORES; i++) > >> + if (app->service_lcores[i] =3D=3D lcore_id) > >> + return i; > > > > This construct is hard to read and prone to error if the code is update= d later. > > > > for () { > > if () > > return i; > > } > > > > > > I wouldn't consider that an improvement (rather the opposite). Well, I disagree, but it is not enforced in the coding style so I won't ins= ist. [snip] > >> +static struct unit_test_suite test_suite =3D { > >> + .suite_name =3D "Event dispatcher test suite", > >> + .unit_test_cases =3D { > >> + TEST_CASE_ST(test_setup, test_teardown, test_basic), > >> + TEST_CASE_ST(test_setup, test_teardown, test_drop), > >> + TEST_CASE_ST(test_setup, test_teardown, > >> + test_many_handler_registrations), > >> + TEST_CASE_ST(test_setup, test_teardown, > >> + test_many_finalize_registrations), > >> + TEST_CASES_END() > >> + } > >> +}; > >> + > >> +static int > >> +test_dispatcher(void) > >> +{ > >> + return unit_test_suite_runner(&test_suite); > >> +} > >> + > >> +REGISTER_TEST_COMMAND(dispatcher_autotest, test_dispatcher); > > > > We have new macros (see REGISTER_FAST_TEST for example) so a test is > > associated to an existing testsuite. > > I think this test should be part of the fast-test testsuite, wdyt? > > > > > > It needs setup and teardown methods, so I assume a generic test suite > woulnd't do. > > The dispatcher tests do have fairly short run times, so in that sense > they should qualify. So please use REGISTER_FAST_TEST(). Thanks. --=20 David Marchand