[Intel-gfx] [PATCH igt v2] igt/tools_test: Check the tools exist before executing

Petri Latvala petri.latvala at intel.com
Thu Dec 14 11:11:47 UTC 2017


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 at chris-wilson.co.uk>
> Reviewed-by: Petri Latvala <petri.latvala at intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> ---
>  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?

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.


-- 
Petri Latvala


More information about the Intel-gfx mailing list