mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: "T.J. Mercier" <tjmercier@google.com>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	Shuah Khan <shuah@kernel.org>,
	kernel@collabora.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] selftests/dmabuf-heap: conform test to TAP format output
Date: Thu, 29 Feb 2024 14:04:19 +0500	[thread overview]
Message-ID: <5843852d-7353-40ec-b36d-7d2502fc6a83@collabora.com> (raw)
In-Reply-To: <CABdmKX39M6e7o_Ossyy_Yg-CYQd-7piT6DmJk8ffEU9pPpP-8Q@mail.gmail.com>

On 2/28/24 11:51 PM, T.J. Mercier wrote:
> On Tue, Feb 27, 2024 at 4:21 AM Muhammad Usama Anjum
> <usama.anjum@collabora.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?
This number 9 doesn't represent number of functions. It represents the
number of test-cases. One function may have multiple of these. (Hence this
number is equal to the number of ksft_test_results_*() functions calls).

> 
>> +
>> +       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
>>
>>
> 

-- 
BR,
Muhammad Usama Anjum

  reply	other threads:[~2024-02-29  9:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 12:19 Muhammad Usama Anjum
2024-02-27 12:19 ` [PATCH v2 2/2] selftests: dmabuf-heap: add config file for the test Muhammad Usama Anjum
2024-02-27 17:18 ` [PATCH v2 1/2] selftests/dmabuf-heap: conform test to TAP format output T.J. Mercier
2024-02-28 11:47   ` Muhammad Usama Anjum
2024-02-28 18:47     ` T.J. Mercier
2024-02-29  9:15       ` Muhammad Usama Anjum
2024-02-29 17:36         ` T.J. Mercier
2024-03-01  8:46           ` Muhammad Usama Anjum
2024-02-28 18:51 ` T.J. Mercier
2024-02-29  9:04   ` Muhammad Usama Anjum [this message]
2024-02-29 17:36     ` T.J. Mercier

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=5843852d-7353-40ec-b36d-7d2502fc6a83@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tjmercier@google.com \
    /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

all inboxes | Powered by JetHome®