Re: [PATCH igt v2] igt/tools_test: Check the tools exist before executing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Petri Latvala (2017-12-14 11:11:47)
> On Wed, Dec 13, 2017 at 02:56:10PM +0000, Chris Wilson wrote:
> > As a simple fail-safe against a bad installation, check the tools exist
> > before testing whether they work.
> > 
> > v2: Check intel_l3_parity as well
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102935
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Reviewed-by: Petri Latvala <petri.latvala@xxxxxxxxx>
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> > ---
> >  tests/tools_test.c | 48 +++++++++++++++++++++++++++++-------------------
> >  1 file changed, 29 insertions(+), 19 deletions(-)
> > 
> > diff --git a/tests/tools_test.c b/tests/tools_test.c
> > index 6aea7a8a4..4183456e2 100644
> > --- a/tests/tools_test.c
> > +++ b/tests/tools_test.c
> > @@ -26,6 +26,10 @@
> >  #include <sys/types.h>
> >  #include <sys/stat.h>
> >  #include <fcntl.h>
> > +#include <libgen.h>
> > +#include <unistd.h>
> > +
> > +#define TOOLS "../tools/"
> >  
> >  struct line_check {
> >       int found;
> > @@ -59,10 +63,19 @@ igt_main
> >  {
> >       igt_skip_on_simulation();
> >  
> > +     igt_fixture {
> > +             char path[4096];
> > +
> > +             if (readlink("/proc/self/exe", path, sizeof(path)) > 0)
> > +                     chdir(dirname(path));
> > +     }
> 
> 
> Why the chdir?

For me, I was trying to standardise the test, since "../tools" bakes in
so many assumptions that simply aren't true when one invokes
$path/tools_test. Back to the igt_data_dir() request.
 
> CI runs tests with IGT installed (make install). The test's directory
> is $libexecdir/intel-gpu-tools/, ../tools is $libexecdir/tools and
> that doesn't exist.

So where was it expecting to find the tools?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux