All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: "Brendan Higgins" <brendanhiggins@google.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"David Gow" <davidgow@google.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Maíra Canal" <mairacanal@riseup.net>,
	"Nikolai Kondrashov" <spbnick@gmail.com>,
	"Rae Moar" <rmoar@google.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Arthur Grillo" <arthurgrillo@riseup.net>,
	"Kees Cook" <keescook@chromium.org>,
	dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, mauro.chehab@intel.com
Subject: Re: [PATCH RFC 2/2] drm: add documentation for drm_buddy_test kUnit test
Date: Thu, 13 Jul 2023 06:25:42 +0200	[thread overview]
Message-ID: <20230713062542.183c0aaa@coco.lan> (raw)
In-Reply-To: <87cz0xgokb.fsf@intel.com>

Em Wed, 12 Jul 2023 18:03:00 +0300
Jani Nikula <jani.nikula@linux.intel.com> escreveu:

> On Wed, 12 Jul 2023, Mauro Carvalho Chehab <mchehab@kernel.org> wrote:
> > diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
> > index 09ee6f6af896..dd6c5afd6cd6 100644
> > --- a/drivers/gpu/drm/tests/drm_buddy_test.c
> > +++ b/drivers/gpu/drm/tests/drm_buddy_test.c
> > @@ -737,6 +737,18 @@ static int drm_buddy_suite_init(struct kunit_suite *suite)
> >  	return 0;
> >  }
> >  
> > +/**
> > + * KTEST_SUITE: set of tests for drm buddy alloc
> > + * Scope: drm subsystem
> > + * Mega feature: drm
> > + * Feature: buddy_alloc
> > + *
> > + * KTEST_TEST: drm_test_buddy_alloc_%s
> > + * Description: Run DRM buddy allocation %arg[1] test
> > + *
> > + * arg[1].values: limit, range, optimistic, smoke, pathological
> > + */
> > +  
> 
> "/**" indicates a kernel-doc comment, and this is not a kernel-doc
> comment.
> 
> $ scripts/kernel-doc -none drivers/gpu/drm/tests/drm_buddy_test.c 
> drivers/gpu/drm/tests/drm_buddy_test.c:752: warning: cannot understand
> function prototype: 'struct kunit_case drm_buddy_tests[] = '
> 
> Nowadays kernel-doc is part of W=1 builds.

True. I already told it at patch 0. I opted to not add a patch for it on this
RFC series, to make it simpler. A simple logic at kernel-doc is enough to 
tell its state machine to ignore blocks that contain the KTEST_\w+: pattern:

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index d0116c6939dc..bf386460691f 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -259,6 +259,7 @@ my $doc_sect = $doc_com .
     '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:([^:].*)?$';
 my $doc_content = $doc_com_body . '(.*)';
 my $doc_block = $doc_com . 'DOC:\s*(.*)?';
+my $ktest_block = $doc_com . 'KTEST_\w+:\s*(.*)?';
 my $doc_inline_start = '^\s*/\*\*\s*$';
 my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
 my $doc_inline_end = '^\s*\*/\s*$';
@@ -2015,6 +2016,10 @@ sub process_name($$) {
     my $file = shift;
     my $descr;
 
+    if (/$ktest_block/o) {
+	$state = STATE_NORMAL;
+	return;
+    }
     if (/$doc_block/o) {
 	$state = STATE_DOCBLOCK;
 	$contents = "";



Thanks,
Mauro

WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: linux-kselftest@vger.kernel.org,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Nikolai Kondrashov" <spbnick@gmail.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Darrick J. Wong" <djwong@kernel.org>,
	linux-doc@vger.kernel.org,
	"Brendan Higgins" <brendanhiggins@google.com>,
	"Rae Moar" <rmoar@google.com>,
	dri-devel@lists.freedesktop.org,
	"Arthur Grillo" <arthurgrillo@riseup.net>,
	"Maíra Canal" <mairacanal@riseup.net>,
	mauro.chehab@intel.com, "David Gow" <davidgow@google.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Christian König" <christian.koenig@amd.com>,
	linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com
Subject: Re: [PATCH RFC 2/2] drm: add documentation for drm_buddy_test kUnit test
Date: Thu, 13 Jul 2023 06:25:42 +0200	[thread overview]
Message-ID: <20230713062542.183c0aaa@coco.lan> (raw)
In-Reply-To: <87cz0xgokb.fsf@intel.com>

Em Wed, 12 Jul 2023 18:03:00 +0300
Jani Nikula <jani.nikula@linux.intel.com> escreveu:

> On Wed, 12 Jul 2023, Mauro Carvalho Chehab <mchehab@kernel.org> wrote:
> > diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
> > index 09ee6f6af896..dd6c5afd6cd6 100644
> > --- a/drivers/gpu/drm/tests/drm_buddy_test.c
> > +++ b/drivers/gpu/drm/tests/drm_buddy_test.c
> > @@ -737,6 +737,18 @@ static int drm_buddy_suite_init(struct kunit_suite *suite)
> >  	return 0;
> >  }
> >  
> > +/**
> > + * KTEST_SUITE: set of tests for drm buddy alloc
> > + * Scope: drm subsystem
> > + * Mega feature: drm
> > + * Feature: buddy_alloc
> > + *
> > + * KTEST_TEST: drm_test_buddy_alloc_%s
> > + * Description: Run DRM buddy allocation %arg[1] test
> > + *
> > + * arg[1].values: limit, range, optimistic, smoke, pathological
> > + */
> > +  
> 
> "/**" indicates a kernel-doc comment, and this is not a kernel-doc
> comment.
> 
> $ scripts/kernel-doc -none drivers/gpu/drm/tests/drm_buddy_test.c 
> drivers/gpu/drm/tests/drm_buddy_test.c:752: warning: cannot understand
> function prototype: 'struct kunit_case drm_buddy_tests[] = '
> 
> Nowadays kernel-doc is part of W=1 builds.

True. I already told it at patch 0. I opted to not add a patch for it on this
RFC series, to make it simpler. A simple logic at kernel-doc is enough to 
tell its state machine to ignore blocks that contain the KTEST_\w+: pattern:

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index d0116c6939dc..bf386460691f 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -259,6 +259,7 @@ my $doc_sect = $doc_com .
     '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:([^:].*)?$';
 my $doc_content = $doc_com_body . '(.*)';
 my $doc_block = $doc_com . 'DOC:\s*(.*)?';
+my $ktest_block = $doc_com . 'KTEST_\w+:\s*(.*)?';
 my $doc_inline_start = '^\s*/\*\*\s*$';
 my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
 my $doc_inline_end = '^\s*\*/\s*$';
@@ -2015,6 +2016,10 @@ sub process_name($$) {
     my $file = shift;
     my $descr;
 
+    if (/$ktest_block/o) {
+	$state = STATE_NORMAL;
+	return;
+    }
     if (/$doc_block/o) {
 	$state = STATE_DOCBLOCK;
 	$contents = "";



Thanks,
Mauro

  reply	other threads:[~2023-07-13  4:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 14:28 [PATCH RFC 0/2] Add support for inlined documentation for kunit and kselftests Mauro Carvalho Chehab
2023-07-12 14:28 ` Mauro Carvalho Chehab
2023-07-12 14:28 ` [PATCH RFC 1/2] docs: add support for documenting kUnit and kSelftests Mauro Carvalho Chehab
2023-07-12 14:28 ` [PATCH RFC 2/2] drm: add documentation for drm_buddy_test kUnit test Mauro Carvalho Chehab
2023-07-12 14:28   ` Mauro Carvalho Chehab
2023-07-12 15:03   ` Jani Nikula
2023-07-12 15:03     ` Jani Nikula
2023-07-13  4:25     ` Mauro Carvalho Chehab [this message]
2023-07-13  4:25       ` Mauro Carvalho Chehab
2023-07-13  6:39   ` Christian König
2023-07-13  6:39     ` Christian König
2023-07-13  9:49     ` Arunpravin Paneer Selvam
2023-07-13 21:31   ` Rae Moar
2023-09-01  7:11     ` Mauro Carvalho Chehab
2023-09-01  7:11       ` Mauro Carvalho Chehab
2023-09-06 22:39       ` Rae Moar
2023-09-06 22:39         ` Rae Moar
2023-07-13 22:49   ` Rae Moar
2023-07-13 22:49     ` Rae Moar

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=20230713062542.183c0aaa@coco.lan \
    --to=mchehab@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=arthurgrillo@riseup.net \
    --cc=brendanhiggins@google.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=djwong@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mairacanal@riseup.net \
    --cc=mauro.chehab@intel.com \
    --cc=rmoar@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=spbnick@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.