From: "Ser, Simon" <simon.ser@intel.com>
To: "Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"Latvala, Petri" <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 1/5] lib/igt_core: Add support for subtest descriptions
Date: Thu, 4 Jul 2019 11:33:44 +0000 [thread overview]
Message-ID: <4dd1b55a1256d0ef8dcdf7763e1fd3fcfdcf30fb.camel@intel.com> (raw)
In-Reply-To: <20190704112247.3w4lem5myjan5rum@ahiler-desk1.fi.intel.com>
On Thu, 2019-07-04 at 14:22 +0300, Arkadiusz Hiler wrote:
> On Wed, Jul 03, 2019 at 04:08:54PM +0300, Ser, Simon wrote:
> > Overall looks good. A few comments inline.
> >
> > On Mon, 2019-07-01 at 15:21 +0300, Arkadiusz Hiler wrote:
> > > This patch adds igt_description() which attaches a description to the
> > > following igt_subtest or igt_subtest_group block.
> > >
> > > Descriptions are accessible via './test --describe[=pattern]'
> > >
> > > Subtest description is its own igt_describe as well as igt_describes
> > > of all the parenting igt_subtest_groups, starting from the outermost
> > > scope.
> > >
> > > Examples of code and produced outputs are included in
> > > lib/test/igt_describe.c and as a documentation comment on igt_describe()
> > > macro.
> > >
> > > Cc: Petri Latvala <petri.latvala@intel.com>
> > > Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> > > Acked-by: Petri Latvala <petri.latvala@intel.com>
> > > ---
> > > lib/igt_core.c | 179 ++++++++++++++++++++++++--
> > > lib/igt_core.h | 137 ++++++++++++++++++--
> > > lib/tests/igt_describe.c | 266 +++++++++++++++++++++++++++++++++++++++
> > > lib/tests/meson.build | 1 +
> > > 4 files changed, 562 insertions(+), 21 deletions(-)
> > > create mode 100644 lib/tests/igt_describe.c
> > >
> > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > index 6b9f0425..8b1c7b2f 100644
> > > --- a/lib/igt_core.c
> > > +++ b/lib/igt_core.c
> > > @@ -70,6 +70,7 @@
> > > #include "igt_sysfs.h"
> > > #include "igt_sysrq.h"
> > > #include "igt_rc.h"
> > > +#include "igt_list.h"
> > >
> > > #define UNW_LOCAL_ONLY
> > > #include <libunwind.h>
> > > @@ -259,6 +260,7 @@ const char *igt_interactive_debug;
> > >
> > > /* subtests helpers */
> > > static bool list_subtests = false;
> > > +static bool describe_subtests = false;
> > > static char *run_single_subtest = NULL;
> > > static bool run_single_subtest_found = false;
> > > static const char *in_subtest = NULL;
> > > @@ -271,6 +273,16 @@ static enum {
> > > CONT = 0, SKIP, FAIL
> > > } skip_subtests_henceforth = CONT;
> > >
> > > +static char __current_description[4096];
> >
> > If it was just me, I'd intentionally make this a lot smaller to make
> > sure people don't start writing about their personal life in there.
> >
> > I mean: if the description is bigger than 512 chars, you're doing
> > something wrong. And 512 chars is probably a very generous limit.
> > "Descriptions should fit in a Tweet".
>
> fair point, reduced to 512
>
> <SNIP>
> > > +#define __INDENT " "
> >
> > I wouldn't use a macro here. Just adding this to the body of the
> > function should be enough:
> >
> > static const indent[] = " ";
>
> It was a leftover from back when this was defined for a couple of
> functions. Fixed.
>
> <SNIP>
> > > -void __igt_subtest_group_save(int *save)
> > > +
> > > +
> > > +void __igt_subtest_group_save(int *save, int *desc)
> >
> > desc can be bool *.
>
> #define igt_subtest_group for (int igt_tokencat(__tmpint,__LINE__) = 0, \
> igt_tokencat(__save,__LINE__) = 0, \
> igt_tokencat(__desc,__LINE__) = 0; \
> igt_tokencat(__tmpint,__LINE__) < 1 && \
> (__igt_subtest_group_save(& igt_tokencat(__save,__LINE__), \
> & igt_tokencat(__desc,__LINE__) ), true); \
> igt_tokencat(__tmpint,__LINE__) ++, \
> __igt_subtest_group_restore(igt_tokencat(__save,__LINE__), \
> igt_tokencat(__desc,__LINE__)))
>
> Because of that it's int. We could make the function take bool, but that
> just adds some complications with type casting.
I see, fine by me then
> <SNIP>
> > > +static void read_whole_pipe(int fd, char *buf, size_t buflen)
> > > +{
> > > + ssize_t readlen;
> > > + off_t offset;
> > > +
> > > + offset = 0;
> > > + while ((readlen = read(fd, buf+offset, buflen-offset))) {
> >
> > Doesn't handle EINTR.
>
> if (readlen == -1) {
> if (errno == EINTR) {
> continue;
> } else {
> printf("read filed with %s\n", strerror(errno));
> exit(1);
> }
> }
Looks good minus the typo.
(Also the else branch is unnecessary, but this is not important.)
> <SNIP>
> > > diff --git a/lib/tests/igt_describe.c b/lib/tests/igt_describe.c
> > > new file mode 100644
> > > index 00000000..a9f857bb
> > > --- /dev/null
> > > +++ b/lib/tests/igt_describe.c
> <SNIP>
> > > +static int _wait(pid_t pid, int *status) {
> > > + int ret;
> > > +
> > > + do {
> > > + ret = waitpid(pid, status, 0);
> > > + } while (ret == -1 && errno == EINTR);
> > > +
> > > + return ret;
> >
> > We could check ret == 0 in this function.
>
> If wait() or waitpid() returns because the status of a child process is
> available, these functions shall return a value equal to the process ID
> of the child process for which status is reported. If wait() or
> waitpid() returns due to the delivery of a signal to the calling
> process, -1 shall be returned and errno set to [EINTR]. If waitpid() was
> invoked with WNOHANG set in options, it has at least one child process
> specified by pid for which status is not available, and status is not
> available for any process specified by pid, 0 is returned. Otherwise,
> (pid_t)-1 shall be returned, and errno set to indicate the error.
>
>
> So I am not really sure why we would check for (ret == 0) here.
> Can you elaborate?
Sorry, I meant check for ret >= 0.
> > Could also check for WIFEXITED, since WEXITSTATUS only works in this
> > case.
>
> I'll add internal_assert(WIFEXITED(status));
>
> Thanks for the review!
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-07-04 11:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 12:21 [igt-dev] [PATCH i-g-t 1/5] lib/igt_core: Add support for subtest descriptions Arkadiusz Hiler
2019-07-01 12:21 ` [igt-dev] [PATCH i-g-t 2/5] tests/kms_hdmi_inject: Provide igt_descriptions Arkadiusz Hiler
2019-07-01 12:21 ` [igt-dev] [PATCH i-g-t 3/5] tests/kms_plane_multiple: Describe the test Arkadiusz Hiler
2019-07-01 12:21 ` [igt-dev] [PATCH i-g-t 4/5] CONTRIBUTING: Rework a bit and update Arkadiusz Hiler
2019-07-01 13:02 ` Ser, Simon
2019-07-01 12:21 ` [igt-dev] [PATCH i-g-t 5/5] docs: Embed subtest descriptions in the documentation Arkadiusz Hiler
2019-07-03 7:18 ` Ser, Simon
2019-07-01 13:01 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] lib/igt_core: Add support for subtest descriptions Patchwork
2019-07-02 16:41 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-07-03 13:08 ` [igt-dev] [PATCH i-g-t 1/5] " Ser, Simon
2019-07-04 11:22 ` Arkadiusz Hiler
2019-07-04 11:33 ` Ser, Simon [this message]
2019-07-04 11:55 ` [igt-dev] [PATCH 1/5 v2 i-g-t] " Arkadiusz Hiler
2019-07-04 13:02 ` Ser, Simon
2019-07-04 12:48 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/5,v2,i-g-t] lib/igt_core: Add support for subtest descriptions (rev2) Patchwork
2019-07-05 17:06 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2019-06-17 10:54 [igt-dev] [PATCH i-g-t 1/5] lib/igt_core: Add support for subtest descriptions Arkadiusz Hiler
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=4dd1b55a1256d0ef8dcdf7763e1fd3fcfdcf30fb.camel@intel.com \
--to=simon.ser@intel.com \
--cc=arkadiusz.hiler@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.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.