[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABdmKX39M6e7o_Ossyy_Yg-CYQd-7piT6DmJk8ffEU9pPpP-8Q@mail.gmail.com>
Date: Wed, 28 Feb 2024 10:51:19 -0800
From: "T.J. Mercier" <tjmercier@...gle.com>
To: Muhammad Usama Anjum <usama.anjum@...labora.com>
Cc: Shuah Khan <shuah@...nel.org>, kernel@...labora.com, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] selftests/dmabuf-heap: conform test to TAP format output
On Tue, Feb 27, 2024 at 4:21 AM Muhammad Usama Anjum
<usama.anjum@...labora.com> wrote:
..
> +static int numer_of_heaps(void)
> +{
> + DIR *d = opendir(DEVPATH);
> + struct dirent *dir;
> + int heaps = 0;
> +
> + while ((dir = readdir(d))) {
> + if (!strncmp(dir->d_name, ".", 2))
> + continue;
> + if (!strncmp(dir->d_name, "..", 3))
> + continue;
> + heaps++;
> + }
> +
> + return heaps;
> }
>
> int main(void)
> {
> - DIR *d;
> struct dirent *dir;
> - int ret = -1;
> + DIR *d;
> +
> + ksft_print_header();
>
> d = opendir(DEVPATH);
> if (!d) {
> - printf("No %s directory?\n", DEVPATH);
> - return -1;
> + ksft_print_msg("No %s directory?\n", DEVPATH);
> + return KSFT_SKIP;
> }
>
> - while ((dir = readdir(d)) != NULL) {
> + ksft_set_plan(9 * numer_of_heaps());
Shouldn't this be 5 (one for each test_alloc_* below) instead of 9?
> +
> + while ((dir = readdir(d))) {
> if (!strncmp(dir->d_name, ".", 2))
> continue;
> if (!strncmp(dir->d_name, "..", 3))
> continue;
>
> - printf("Testing heap: %s\n", dir->d_name);
> - printf("=======================================\n");
> - ret = test_alloc_and_import(dir->d_name);
> - if (ret)
> - break;
> -
> - ret = test_alloc_zeroed(dir->d_name, 4 * 1024);
> - if (ret)
> - break;
> -
> - ret = test_alloc_zeroed(dir->d_name, ONE_MEG);
> - if (ret)
> - break;
> -
> - ret = test_alloc_compat(dir->d_name);
> - if (ret)
> - break;
> -
> - ret = test_alloc_errors(dir->d_name);
> - if (ret)
> - break;
> + ksft_print_msg("Testing heap: %s\n", dir->d_name);
> + ksft_print_msg("=======================================\n");
> + test_alloc_and_import(dir->d_name);
> + test_alloc_zeroed(dir->d_name, 4 * 1024);
> + test_alloc_zeroed(dir->d_name, ONE_MEG);
> + test_alloc_compat(dir->d_name);
> + test_alloc_errors(dir->d_name);
> }
> closedir(d);
>
> - return ret;
> + ksft_finished();
> }
> --
> 2.42.0
>
>
Powered by blists - more mailing lists