DPDK patches and discussions
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: Stephen Hemminger <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [PATCH v3 3/6] test: use unit test runner for eal flags
Date: Tue, 18 Nov 2025 10:40:23 +0800	[thread overview]
Message-ID: <b136ee47-f917-422f-a162-d79f6095b68a@huawei.com> (raw)
In-Reply-To: <20251117175332.14014-4-stephen@networkplumber.org>

On 11/18/2025 1:52 AM, Stephen Hemminger wrote:
> Make the sub tests in eal flags suite into a group
> so that they are not individual tests.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  app/test/test_eal_flags.c | 46 +++++++++++++++++++++++++--------------
>  1 file changed, 30 insertions(+), 16 deletions(-)
> 
> diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
> index c2e6c00edb..263f26d037 100644
> --- a/app/test/test_eal_flags.c
> +++ b/app/test/test_eal_flags.c
> @@ -777,7 +777,7 @@ static int
>  test_no_hpet_flag(void)
>  {
>  #ifdef RTE_EXEC_ENV_FREEBSD
> -	return 0;
> +	return TEST_SKIPPED;
>  #else
>  	const char *prefix = get_file_prefix();
>  	if (prefix == NULL)
> @@ -796,8 +796,8 @@ test_no_hpet_flag(void)
>  		printf("Error - process did not run ok without --no-hpet flag\n");
>  		return -1;
>  	}
> -#
>  	return 0;
> +#endif
>  }
>  
>  /*
> @@ -866,7 +866,7 @@ test_no_huge_flag(void)
>  		printf("Error - process run ok with --no-huge and --huge-worker-stack=size flags");
>  		return -1;
>  	}
> -#endif
> +
>  	return 0;
>  }
>  
> @@ -1208,7 +1208,7 @@ test_file_prefix(void)
>  	char prefix[PATH_MAX] = "";
>  
>  #ifdef RTE_EXEC_ENV_FREEBSD
> -	return 0;
> +	return TEST_SKIPPED;
>  #else
>  	if (get_current_prefix(prefix, sizeof(prefix)) == NULL) {
>  		printf("Error - unable to get current prefix!\n");
> @@ -1650,15 +1650,29 @@ test_memory_flags(void)
>  
>  #endif /* !RTE_EXEC_ENV_WINDOWS */
>  
> -REGISTER_FAST_TEST(eal_flags_c_opt_autotest, false, false, test_missing_c_flag);
> -REGISTER_FAST_TEST(eal_flags_main_opt_autotest, false, false, test_main_lcore_flag);
> -REGISTER_FAST_TEST(eal_flags_n_opt_autotest, false, false, test_invalid_n_flag);
> -REGISTER_FAST_TEST(eal_flags_hpet_autotest, false, false, test_no_hpet_flag);
> -REGISTER_FAST_TEST(eal_flags_no_huge_autotest, false, false, test_no_huge_flag);
> -REGISTER_FAST_TEST(eal_flags_a_opt_autotest, false, false, test_allow_flag);
> -REGISTER_FAST_TEST(eal_flags_b_opt_autotest, false, false, test_invalid_b_flag);
> -REGISTER_FAST_TEST(eal_flags_vdev_opt_autotest, false, false, test_invalid_vdev_flag);
> -REGISTER_FAST_TEST(eal_flags_r_opt_autotest, false, false, test_invalid_r_flag);
> -REGISTER_FAST_TEST(eal_flags_mem_autotest, false, false, test_memory_flags);
> -REGISTER_FAST_TEST(eal_flags_file_prefix_autotest, false, false, test_file_prefix);
> -REGISTER_FAST_TEST(eal_flags_misc_autotest, false, false, test_misc_flags);
> +static struct unit_test_suite eal_flags_test_suite = {
> +	.suite_name = "EAL flags unit test suite",
> +	.unit_test_cases = {
> +		TEST_CASE(test_missing_c_flag),
> +		TEST_CASE(test_main_lcore_flag),
> +		TEST_CASE(test_invalid_n_flag),
> +		TEST_CASE(test_no_hpet_flag),
> +		TEST_CASE(test_no_huge_flag),
> +		TEST_CASE(test_allow_flag),
> +		TEST_CASE(test_invalid_b_flag),
> +		TEST_CASE(test_invalid_vdev_flag),
> +		TEST_CASE(test_invalid_r_flag),
> +		TEST_CASE(test_memory_flags),
> +		TEST_CASE(test_file_prefix),
> +		TEST_CASE(test_misc_flags),
> +		TEST_CASES_END()

The judgement (whether supported this test) and implement is located in the same function,
Suggest split them to different subfunction:

static int
check_missing_runable(void)
{
#ifdef RTE_EXEC_ENV_WINDOWS
	return TEST_SKIPPED;
#else
	return 0;
#endif
}

static struct unit_test_suite eal_flags_test_suite = {
	.suite_name = "EAL flags unit test suite",
	.unit_test_cases = {
		TEST_CASE_NAMED_ST("missing_c_flag", check_missing_runable, NULL, test_missing_c_flag),
		...

In this file, we coud sort judgement to several case:
1. windows don't support
2. freebsd don't support

Note: this impl requirement all code compile-able in windows.

> +	}
> +};
> +
> +static int
> +test_eal_flags(void)
> +{
> +	return unit_test_suite_runner(&eal_flags_test_suite);
> +}
> +
> +REGISTER_FAST_TEST(eal_flags_autotest, false, false, test_eal_flags);


  reply	other threads:[~2025-11-18  2:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-15 19:33 [PATCH 0/4] test: eal flags cleanup Stephen Hemminger
2025-11-15 19:33 ` [PATCH 1/4] test: re-enable format-truncation warnings Stephen Hemminger
2025-11-15 19:43   ` Stephen Hemminger
2025-11-15 19:33 ` [PATCH 2/4] test: increase size of memzone name Stephen Hemminger
2025-11-15 19:33 ` [PATCH 3/4] test: refactor file prefix arg handling Stephen Hemminger
2025-11-15 19:33 ` [PATCH 4/4] test: use unit test runner for eal flags Stephen Hemminger
2025-11-16 18:59 ` [PATCH v2 0/5] enable format-overflow on tests Stephen Hemminger
2025-11-16 18:59   ` [PATCH v2 1/5] test: increase size of memzone name Stephen Hemminger
2025-11-16 18:59   ` [PATCH v2 2/5] test: refactor file prefix arg handling Stephen Hemminger
2025-11-16 18:59   ` [PATCH v2 3/5] test: use unit test runner for eal flags Stephen Hemminger
2025-11-16 18:59   ` [PATCH v2 4/5] test: fix format overflow warning in ACL test Stephen Hemminger
2025-11-16 18:59   ` [PATCH v2 5/5] test: re-enable format-truncation warnings Stephen Hemminger
2025-11-17 17:52 ` [PATCH v3 0/6] test suite enable format overflow checks Stephen Hemminger
2025-11-17 17:52   ` [PATCH v3 1/6] test: increase size of memzone name Stephen Hemminger
2025-11-17 17:52   ` [PATCH v3 2/6] test: refactor file prefix arg handling Stephen Hemminger
2025-11-17 17:52   ` [PATCH v3 3/6] test: use unit test runner for eal flags Stephen Hemminger
2025-11-18  2:40     ` fengchengwen [this message]
2025-11-17 17:52   ` [PATCH v3 4/6] test: fix format overflow warning in ACL test Stephen Hemminger
2025-11-17 17:52   ` [PATCH v3 5/6] test: fix impossible format-truncation in cfgfiles Stephen Hemminger
2025-11-18  2:22     ` fengchengwen
2025-11-17 17:52   ` [PATCH v3 6/6] test: re-enable format-truncation warnings Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b136ee47-f917-422f-a162-d79f6095b68a@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).