Re: [igt-dev] [PATCH i-g-t] runner/job_list: print error when job list is empty

Ser, Simon
2019-03-25T13:51:52Z

On Mon, 2019-03-25 at 13:19 +0200, Petri Latvala wrote:
> On Thu, Mar 21, 2019 at 02:44:49PM +0200, Simon Ser wrote:
> > Using a filter that doesn't match any test name resulted in the
> > runner
> > silently failing. Print an error message so that the user
> > understands
> > why the runner fails.
> >
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > ---
> > runner/job_list.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/runner/job_list.c b/runner/job_list.c
> > index 97bbb0be..f5c16af3 100644
> > --- a/runner/job_list.c
> > +++ b/runner/job_list.c
> > @@ -133,6 +133,7 @@ static bool filtered_job_list(struct job_list
> > *job_list,
> > {
> > FILE *f;
> > char buf[128];
> > + bool ok;
> >
> > if (job_list->entries != NULL) {
> > fprintf(stderr, "Caller didn't clear the job list, this
> > shouldn't happen\n");
> > @@ -179,7 +180,11 @@ static bool filtered_job_list(struct job_list
> > *job_list,
> > &settings->exclude_regexes);
> > }
> >
> > - return job_list->size != 0;
> > + ok = job_list->size != 0;
> > + if (!ok) {
> > + fprintf(stderr, "Filter didn't match any job name\n");
> > + }
> > + return ok;
> > }
> >
>
> A unit test for this would be lovely (runner/runner_tests.c).

Do you mean adding a test that checks that an error message is printed?
Or do you mean adding a test that checks that filtered_job_list fails
when no test is matched?
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.