All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests: install test programs to libexec
@ 2015-03-25 10:43 Joonas Lahtinen
  2015-03-25 12:01 ` Thomas Wood
  0 siblings, 1 reply; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-25 10:43 UTC (permalink / raw)
  To: intel-gfx

Install the test programs by default so that they can be packaged.

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 tests/Makefile.sources | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index a165978..ac0ee99 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -1,12 +1,15 @@
 noinst_PROGRAMS = \
 	gem_alive \
 	gem_stress \
-	$(TESTS_progs) \
-	$(TESTS_progs_M) \
 	$(HANG) \
 	$(TESTS_testsuite) \
 	$(NULL)
 
+libexec_PROGRAMS = \
+	$(TESTS_progs) \
+	$(TESTS_progs_M) \
+	$(NULL)
+
 NOUVEAU_TESTS_M = \
 	prime_nv_api \
 	prime_nv_pcopy \
-- 
1.9.3



_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t] tests: install test programs to libexec
  2015-03-25 10:43 [PATCH i-g-t] tests: install test programs to libexec Joonas Lahtinen
@ 2015-03-25 12:01 ` Thomas Wood
  2015-03-26 16:05   ` [PATCH i-g-t v2] " Joonas Lahtinen
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Wood @ 2015-03-25 12:01 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Intel Graphics Development

On 25 March 2015 at 10:43, Joonas Lahtinen
<joonas.lahtinen@linux.intel.com> wrote:
> Install the test programs by default so that they can be packaged.

Some tests require extra files such as images that will also need to
be installed and have an appropriate path used in the test. The
IGT_DATADIR defined in lib/Makefile.am and tests/Makefile.am can be
updated to point to the install location, although it would be nice to
have a fallback mechanism so that the tests continue to work if not
installed.

>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  tests/Makefile.sources | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index a165978..ac0ee99 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -1,12 +1,15 @@
>  noinst_PROGRAMS = \
>         gem_alive \
>         gem_stress \
> -       $(TESTS_progs) \
> -       $(TESTS_progs_M) \
>         $(HANG) \
>         $(TESTS_testsuite) \
>         $(NULL)
>
> +libexec_PROGRAMS = \
> +       $(TESTS_progs) \
> +       $(TESTS_progs_M) \
> +       $(NULL)
> +

The script based tests are missing here. The full list of tests is
available in the kernel_tests variable.


>  NOUVEAU_TESTS_M = \
>         prime_nv_api \
>         prime_nv_pcopy \
> --
> 1.9.3
>
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH i-g-t v2] tests: install test programs to libexec
  2015-03-25 12:01 ` Thomas Wood
@ 2015-03-26 16:05   ` Joonas Lahtinen
  2015-03-26 16:14     ` Chris Wilson
  2015-03-26 17:29     ` Thomas Wood
  0 siblings, 2 replies; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-26 16:05 UTC (permalink / raw)
  To: Thomas Wood; +Cc: Intel Graphics Development

Install the test programs by default so that they can be packaged.

v2:
- Install more tests including scripts and their data

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 tests/Makefile.am      | 22 +++++++++++++++++++---
 tests/Makefile.sources | 10 ++++++++--
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0ae2541..12675b5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,10 +27,26 @@ multi-tests.txt: Makefile.sources
 	@echo ${multi_kernel_tests} >> $@
 	@echo END TESTLIST >> $@
 
-EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
-EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
+libexec_PROGRAMS += \
+	$(TESTS_progs) \
+	$(TESTS_progs_M) \
+	$(HANG) \
+	$(NULL)
+
+libexec_SCRIPTS += \
+	$(TESTS_scripts) \
+	$(TESTS_scripts_M) \
+	$(scripts) \
+	$(NULL)
+
+# We do want the data to be at the same directory as executables.
+igt_tests_datadir = $(libexecdir)
+igt_tests_data_DATA = \
+	$(IMAGES) \
+	$(common_files) \
+	$(NULL)
 
-CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
+CLEANFILES = single-tests.txt multi-tests.txt
 
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
 	-I$(srcdir)/.. \
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 0a974a6..8d4e243 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -1,12 +1,18 @@
 noinst_PROGRAMS = \
 	gem_alive \
 	gem_stress \
-	$(TESTS_progs) \
-	$(TESTS_progs_M) \
 	$(HANG) \
 	$(TESTS_testsuite) \
 	$(NULL)
 
+libexec_PROGRAMS = \
+	$(TESTS_progs) \
+	$(TESTS_progs_M) \
+	$(NULL)
+
+libexec_SCRIPTS = \
+	$(NULL)
+
 NOUVEAU_TESTS_M = \
 	prime_nv_api \
 	prime_nv_pcopy \
-- 
1.9.3


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v2] tests: install test programs to libexec
  2015-03-26 16:05   ` [PATCH i-g-t v2] " Joonas Lahtinen
@ 2015-03-26 16:14     ` Chris Wilson
  2015-03-27  6:33       ` Joonas Lahtinen
  2015-03-26 17:29     ` Thomas Wood
  1 sibling, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2015-03-26 16:14 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Intel Graphics Development, Thomas Wood

On Thu, Mar 26, 2015 at 06:05:27PM +0200, Joonas Lahtinen wrote:
> Install the test programs by default so that they can be packaged.
> 
> v2:
> - Install more tests including scripts and their data

Packaged by whom?

Developers should be using git (otherwise how will they feed back the
patches they generate?), so if you are expecting users to be running them,
please no. Instead write a diagnostic tool.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v2] tests: install test programs to libexec
  2015-03-26 16:05   ` [PATCH i-g-t v2] " Joonas Lahtinen
  2015-03-26 16:14     ` Chris Wilson
@ 2015-03-26 17:29     ` Thomas Wood
  2015-03-27  7:05       ` Joonas Lahtinen
  2015-03-27  8:51       ` [PATCH i-g-t v3] " Joonas Lahtinen
  1 sibling, 2 replies; 13+ messages in thread
From: Thomas Wood @ 2015-03-26 17:29 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Intel Graphics Development

On 26 March 2015 at 16:05, Joonas Lahtinen
<joonas.lahtinen@linux.intel.com> wrote:
> Install the test programs by default so that they can be packaged.

Could you also explain why the tests should be packaged?


>
> v2:
> - Install more tests including scripts and their data
>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  tests/Makefile.am      | 22 +++++++++++++++++++---
>  tests/Makefile.sources | 10 ++++++++--
>  2 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 0ae2541..12675b5 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -27,10 +27,26 @@ multi-tests.txt: Makefile.sources
>         @echo ${multi_kernel_tests} >> $@
>         @echo END TESTLIST >> $@
>
> -EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
> -EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
> +libexec_PROGRAMS += \

Since there are a lot of test programs, it would probably be nicer to
install them into pkglibexecdir.


> +       $(TESTS_progs) \
> +       $(TESTS_progs_M) \
> +       $(HANG) \

The tests listed in $(HANG) are not part of the normal test suite
(they are not included in the generated test lists). However, if you
want to install all built programs, gem_alive and gem_stress also need
to be included.


> +       $(NULL)
> +
> +libexec_SCRIPTS += \
> +       $(TESTS_scripts) \
> +       $(TESTS_scripts_M) \
> +       $(scripts) \
> +       $(NULL)
> +
> +# We do want the data to be at the same directory as executables.

The file path in the executables is defined by IGT_DATADIR, which
currently points to the tests source directory (except in the Android
build) and therefore still needs updating.


> +igt_tests_datadir = $(libexecdir)

The data files should be installed in pkgdatadir.


> +igt_tests_data_DATA = \
> +       $(IMAGES) \
> +       $(common_files) \

$(common_files) is actually a c file, so it shouldn't be installed as data.


> +       $(NULL)
>
> -CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
> +CLEANFILES = single-tests.txt multi-tests.txt
>
>  AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
>         -I$(srcdir)/.. \
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 0a974a6..8d4e243 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -1,12 +1,18 @@
>  noinst_PROGRAMS = \
>         gem_alive \
>         gem_stress \
> -       $(TESTS_progs) \
> -       $(TESTS_progs_M) \
>         $(HANG) \
>         $(TESTS_testsuite) \
>         $(NULL)
>
> +libexec_PROGRAMS = \
> +       $(TESTS_progs) \
> +       $(TESTS_progs_M) \
> +       $(NULL)
> +
> +libexec_SCRIPTS = \
> +       $(NULL)
> +
>  NOUVEAU_TESTS_M = \
>         prime_nv_api \
>         prime_nv_pcopy \
> --
> 1.9.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v2] tests: install test programs to libexec
  2015-03-26 16:14     ` Chris Wilson
@ 2015-03-27  6:33       ` Joonas Lahtinen
  0 siblings, 0 replies; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-27  6:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Intel Graphics Development, Thomas Wood

Hi,

On to, 2015-03-26 at 16:14 +0000, Chris Wilson wrote:
> On Thu, Mar 26, 2015 at 06:05:27PM +0200, Joonas Lahtinen wrote:
> > Install the test programs by default so that they can be packaged.
> > 
> > v2:
> > - Install more tests including scripts and their data
> 
> Packaged by whom?
> 
> Developers should be using git (otherwise how will they feed back the
> patches they generate?), so if you are expecting users to be running them,
> please no. Instead write a diagnostic tool.

I do not expect users to be running them. Installing them properly makes
it much easier to create a build-from-scratch setup including i-g-t.
This way for example with Yocto, which I myself use, a software stack
can be built in complete isolation from development machine stack and
installed into the DUT for inspection (including source-level debugging
with gdb). I do not see why the i-g-t tests would be deliberately made
not to package, when they are used for regression testing.

> -Chris
> 


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v2] tests: install test programs to libexec
  2015-03-26 17:29     ` Thomas Wood
@ 2015-03-27  7:05       ` Joonas Lahtinen
  2015-03-27  8:51       ` [PATCH i-g-t v3] " Joonas Lahtinen
  1 sibling, 0 replies; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-27  7:05 UTC (permalink / raw)
  To: Thomas Wood; +Cc: Intel Graphics Development

On to, 2015-03-26 at 17:29 +0000, Thomas Wood wrote:
> On 26 March 2015 at 16:05, Joonas Lahtinen
> <joonas.lahtinen@linux.intel.com> wrote:
> > Install the test programs by default so that they can be packaged.
> 
> Could you also explain why the tests should be packaged?
> 

Explained in previous e-mail.

> 
> >
> > v2:
> > - Install more tests including scripts and their data
> >
> > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > ---
> >  tests/Makefile.am      | 22 +++++++++++++++++++---
> >  tests/Makefile.sources | 10 ++++++++--
> >  2 files changed, 27 insertions(+), 5 deletions(-)
> >
> > diff --git a/tests/Makefile.am b/tests/Makefile.am
> > index 0ae2541..12675b5 100644
> > --- a/tests/Makefile.am
> > +++ b/tests/Makefile.am
> > @@ -27,10 +27,26 @@ multi-tests.txt: Makefile.sources
> >         @echo ${multi_kernel_tests} >> $@
> >         @echo END TESTLIST >> $@
> >
> > -EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
> > -EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
> > +libexec_PROGRAMS += \
> 
> Since there are a lot of test programs, it would probably be nicer to
> install them into pkglibexecdir.
> 

My bad, as in my build they went into their own subdirectory already,
could be the build QA checker was doing some fixing for me unnoticed.

> 
> > +       $(TESTS_progs) \
> > +       $(TESTS_progs_M) \
> > +       $(HANG) \
> 
> The tests listed in $(HANG) are not part of the normal test suite
> (they are not included in the generated test lists). However, if you
> want to install all built programs, gem_alive and gem_stress also need
> to be included.
> 

Ack.

> 
> > +       $(NULL)
> > +
> > +libexec_SCRIPTS += \
> > +       $(TESTS_scripts) \
> > +       $(TESTS_scripts_M) \
> > +       $(scripts) \
> > +       $(NULL)
> > +
> > +# We do want the data to be at the same directory as executables.
> 
> The file path in the executables is defined by IGT_DATADIR, which
> currently points to the tests source directory (except in the Android
> build) and therefore still needs updating.
> 
> 
> > +igt_tests_datadir = $(libexecdir)
> 
> The data files should be installed in pkgdatadir.

Ack. I was under some kind of impression that there was an assumption
for more files to be present for the tests to run, but obviously not.

> 
> 
> > +igt_tests_data_DATA = \
> > +       $(IMAGES) \
> > +       $(common_files) \
> 
> $(common_files) is actually a c file, so it shouldn't be installed as data.
> 

Ack. Rerolling the patch with changes.

Regards, Joonas
> 
> > +       $(NULL)
> >
> > -CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
> > +CLEANFILES = single-tests.txt multi-tests.txt
> >
> >  AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
> >         -I$(srcdir)/.. \
> > diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> > index 0a974a6..8d4e243 100644
> > --- a/tests/Makefile.sources
> > +++ b/tests/Makefile.sources
> > @@ -1,12 +1,18 @@
> >  noinst_PROGRAMS = \
> >         gem_alive \
> >         gem_stress \
> > -       $(TESTS_progs) \
> > -       $(TESTS_progs_M) \
> >         $(HANG) \
> >         $(TESTS_testsuite) \
> >         $(NULL)
> >
> > +libexec_PROGRAMS = \
> > +       $(TESTS_progs) \
> > +       $(TESTS_progs_M) \
> > +       $(NULL)
> > +
> > +libexec_SCRIPTS = \
> > +       $(NULL)
> > +
> >  NOUVEAU_TESTS_M = \
> >         prime_nv_api \
> >         prime_nv_pcopy \
> > --
> > 1.9.3


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH i-g-t v3] tests: install test programs to libexec
  2015-03-26 17:29     ` Thomas Wood
  2015-03-27  7:05       ` Joonas Lahtinen
@ 2015-03-27  8:51       ` Joonas Lahtinen
  2015-03-27  8:56         ` Joonas Lahtinen
  1 sibling, 1 reply; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-27  8:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: Thomas Wood

Install the test programs by default so that they can be packaged.

Tested the testdisplay test so that it still runs after modifications,
as it depends on script data.

Packaging is useful when building a complete software stack for a
DUT from scratch. This should bring us closer to achieving a
built-from-scratch testing workflow.

Package maintainers can always decide to ignore the installed files.

v2:
- Install more tests including scripts and their data

v3:
- Add clarification to commit message about why we do this.
  (Chris Wilson & Thomas Wood)
- Change libexec into pkglibexec to comply to standard.
  (Thomas Wood)
- Do not install $(common_files). (Thomas Wood)
- Make it really obvious the installed files are tests by using
  tests directory name to avoid any confusion with packagers.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 tests/Makefile.am      | 21 ++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index f45c6c9..5cce450 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
 	@echo ${multi_kernel_tests} >> $@
 	@echo END TESTLIST >> $@
 
-EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
-EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
+igt_tests_bin_PROGRAMS += \
+	$(TESTS_progs) \
+	$(TESTS_progs_M) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS += \
+	$(TESTS_scripts) \
+	$(TESTS_scripts_M) \
+	$(scripts) \
+	$(NULL)
+
+igt_tests_data_DATA += \
+	$(IMAGES) \
+	$(NULL)
+
+EXTRA_PROGRAMS = $(HANG)
+EXTRA_DIST = $(common_files)
 
 CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
 
@@ -36,7 +51,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
 	-I$(srcdir)/.. \
 	-I$(srcdir)/../lib \
 	-include "$(srcdir)/../lib/check-ndebug.h" \
-	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
+	-DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
 	$(LIBUNWIND_CFLAGS) \
 	$(NULL)
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 0a974a6..e8297dd 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -1,10 +1,22 @@
+igt_tests_bindir = $(pkglibexecdir)/tests
+igt_tests_datadir = $(pkgdatadir)/tests
+
 noinst_PROGRAMS = \
+	$(HANG) \
+	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_PROGRAMS = \
 	gem_alive \
 	gem_stress \
 	$(TESTS_progs) \
 	$(TESTS_progs_M) \
-	$(HANG) \
-	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS = \
+	$(NULL)
+
+igt_tests_data_DATA = \
 	$(NULL)
 
 NOUVEAU_TESTS_M = \
-- 
1.9.3



_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v3] tests: install test programs to libexec
  2015-03-27  8:51       ` [PATCH i-g-t v3] " Joonas Lahtinen
@ 2015-03-27  8:56         ` Joonas Lahtinen
  2015-03-31  6:51           ` [PATCH i-g-t v4] " Joonas Lahtinen
  0 siblings, 1 reply; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-27  8:56 UTC (permalink / raw)
  To: intel-gfx; +Cc: Thomas Wood

On pe, 2015-03-27 at 10:51 +0200, Joonas Lahtinen wrote:
> Install the test programs by default so that they can be packaged.
> 
> Tested the testdisplay test so that it still runs after modifications,
> as it depends on script data.
> 

Duh, "s/depends on script data/depends on a data file/".

Also, added Chris.

Regards, Joonas

> Packaging is useful when building a complete software stack for a
> DUT from scratch. This should bring us closer to achieving a
> built-from-scratch testing workflow.
> 
> Package maintainers can always decide to ignore the installed files.
> 
> v2:
> - Install more tests including scripts and their data
> 
> v3:
> - Add clarification to commit message about why we do this.
>   (Chris Wilson & Thomas Wood)
> - Change libexec into pkglibexec to comply to standard.
>   (Thomas Wood)
> - Do not install $(common_files). (Thomas Wood)
> - Make it really obvious the installed files are tests by using
>   tests directory name to avoid any confusion with packagers.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Thomas Wood <thomas.wood@intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  tests/Makefile.am      | 21 ++++++++++++++++++---
>  tests/Makefile.sources | 16 ++++++++++++++--
>  2 files changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index f45c6c9..5cce450 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
>  	@echo ${multi_kernel_tests} >> $@
>  	@echo END TESTLIST >> $@
>  
> -EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
> -EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
> +igt_tests_bin_PROGRAMS += \
> +	$(TESTS_progs) \
> +	$(TESTS_progs_M) \
> +	$(NULL)
> +
> +igt_tests_bin_SCRIPTS += \
> +	$(TESTS_scripts) \
> +	$(TESTS_scripts_M) \
> +	$(scripts) \
> +	$(NULL)
> +
> +igt_tests_data_DATA += \
> +	$(IMAGES) \
> +	$(NULL)
> +
> +EXTRA_PROGRAMS = $(HANG)
> +EXTRA_DIST = $(common_files)
>  
>  CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
>  
> @@ -36,7 +51,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
>  	-I$(srcdir)/.. \
>  	-I$(srcdir)/../lib \
>  	-include "$(srcdir)/../lib/check-ndebug.h" \
> -	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
> +	-DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
>  	$(LIBUNWIND_CFLAGS) \
>  	$(NULL)
>  
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 0a974a6..e8297dd 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -1,10 +1,22 @@
> +igt_tests_bindir = $(pkglibexecdir)/tests
> +igt_tests_datadir = $(pkgdatadir)/tests
> +
>  noinst_PROGRAMS = \
> +	$(HANG) \
> +	$(TESTS_testsuite) \
> +	$(NULL)
> +
> +igt_tests_bin_PROGRAMS = \
>  	gem_alive \
>  	gem_stress \
>  	$(TESTS_progs) \
>  	$(TESTS_progs_M) \
> -	$(HANG) \
> -	$(TESTS_testsuite) \
> +	$(NULL)
> +
> +igt_tests_bin_SCRIPTS = \
> +	$(NULL)
> +
> +igt_tests_data_DATA = \
>  	$(NULL)
>  
>  NOUVEAU_TESTS_M = \


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH i-g-t v4] tests: install test programs to libexec
  2015-03-27  8:56         ` Joonas Lahtinen
@ 2015-03-31  6:51           ` Joonas Lahtinen
  2015-03-31 10:04             ` Thomas Wood
  0 siblings, 1 reply; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-31  6:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: Thomas Wood

Install the test programs by default so that they can be packaged.

Tested with the testdisplay test so that it still runs after the
modifications as it depends on a data file to be present.

Packaging is useful when building a complete software stack for a
DUT from scratch. This should bring us closer to achieving a
built-from-scratch testing workflow.

Package maintainers can always decide to ignore the installed files.

v2:
- Install more tests including scripts and their data

v3:
- Add clarification to commit message about why we do this.
  (Chris Wilson & Thomas Wood)
- Change libexec into pkglibexec to comply to standard
  (Thomas Wood)
- Do not install $(common_files). (Thomas Wood)
- Make it really obvious the installed files are tests by using
  tests directory name to avoid any confusion with packagers.

v4:
- Fixed commit message.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 tests/Makefile.am      | 21 ++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index f45c6c9..5cce450 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
 	@echo ${multi_kernel_tests} >> $@
 	@echo END TESTLIST >> $@
 
-EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
-EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
+igt_tests_bin_PROGRAMS += \
+	$(TESTS_progs) \
+	$(TESTS_progs_M) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS += \
+	$(TESTS_scripts) \
+	$(TESTS_scripts_M) \
+	$(scripts) \
+	$(NULL)
+
+igt_tests_data_DATA += \
+	$(IMAGES) \
+	$(NULL)
+
+EXTRA_PROGRAMS = $(HANG)
+EXTRA_DIST = $(common_files)
 
 CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
 
@@ -36,7 +51,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
 	-I$(srcdir)/.. \
 	-I$(srcdir)/../lib \
 	-include "$(srcdir)/../lib/check-ndebug.h" \
-	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
+	-DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
 	$(LIBUNWIND_CFLAGS) \
 	$(NULL)
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 0a974a6..e8297dd 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -1,10 +1,22 @@
+igt_tests_bindir = $(pkglibexecdir)/tests
+igt_tests_datadir = $(pkgdatadir)/tests
+
 noinst_PROGRAMS = \
+	$(HANG) \
+	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_PROGRAMS = \
 	gem_alive \
 	gem_stress \
 	$(TESTS_progs) \
 	$(TESTS_progs_M) \
-	$(HANG) \
-	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS = \
+	$(NULL)
+
+igt_tests_data_DATA = \
 	$(NULL)
 
 NOUVEAU_TESTS_M = \
-- 
1.9.3


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v4] tests: install test programs to libexec
  2015-03-31  6:51           ` [PATCH i-g-t v4] " Joonas Lahtinen
@ 2015-03-31 10:04             ` Thomas Wood
  2015-03-31 12:53               ` [PATCH i-g-t v5] " Joonas Lahtinen
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Wood @ 2015-03-31 10:04 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Intel Graphics Development

On 31 March 2015 at 07:51, Joonas Lahtinen
<joonas.lahtinen@linux.intel.com> wrote:
> Install the test programs by default so that they can be packaged.

Patch looks good, but I think we still need to consider how to make
sure the tests continue to work when not installed. One solution might
be to make the installation of tests a configure option so that the
data path can be set accordingly.


>
> Tested with the testdisplay test so that it still runs after the
> modifications as it depends on a data file to be present.
>
> Packaging is useful when building a complete software stack for a
> DUT from scratch. This should bring us closer to achieving a
> built-from-scratch testing workflow.
>
> Package maintainers can always decide to ignore the installed files.
>
> v2:
> - Install more tests including scripts and their data
>
> v3:
> - Add clarification to commit message about why we do this.
>   (Chris Wilson & Thomas Wood)
> - Change libexec into pkglibexec to comply to standard
>   (Thomas Wood)
> - Do not install $(common_files). (Thomas Wood)
> - Make it really obvious the installed files are tests by using
>   tests directory name to avoid any confusion with packagers.
>
> v4:
> - Fixed commit message.
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Thomas Wood <thomas.wood@intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  tests/Makefile.am      | 21 ++++++++++++++++++---
>  tests/Makefile.sources | 16 ++++++++++++++--
>  2 files changed, 32 insertions(+), 5 deletions(-)
>
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index f45c6c9..5cce450 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
>         @echo ${multi_kernel_tests} >> $@
>         @echo END TESTLIST >> $@
>
> -EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
> -EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
> +igt_tests_bin_PROGRAMS += \
> +       $(TESTS_progs) \
> +       $(TESTS_progs_M) \
> +       $(NULL)
> +
> +igt_tests_bin_SCRIPTS += \
> +       $(TESTS_scripts) \
> +       $(TESTS_scripts_M) \
> +       $(scripts) \
> +       $(NULL)
> +
> +igt_tests_data_DATA += \
> +       $(IMAGES) \
> +       $(NULL)
> +
> +EXTRA_PROGRAMS = $(HANG)
> +EXTRA_DIST = $(common_files)
>
>  CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
>
> @@ -36,7 +51,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
>         -I$(srcdir)/.. \
>         -I$(srcdir)/../lib \
>         -include "$(srcdir)/../lib/check-ndebug.h" \
> -       -DIGT_DATADIR=\""$(abs_srcdir)"\" \
> +       -DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
>         $(LIBUNWIND_CFLAGS) \
>         $(NULL)
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 0a974a6..e8297dd 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -1,10 +1,22 @@
> +igt_tests_bindir = $(pkglibexecdir)/tests
> +igt_tests_datadir = $(pkgdatadir)/tests
> +
>  noinst_PROGRAMS = \
> +       $(HANG) \
> +       $(TESTS_testsuite) \
> +       $(NULL)
> +
> +igt_tests_bin_PROGRAMS = \
>         gem_alive \
>         gem_stress \
>         $(TESTS_progs) \
>         $(TESTS_progs_M) \
> -       $(HANG) \
> -       $(TESTS_testsuite) \
> +       $(NULL)
> +
> +igt_tests_bin_SCRIPTS = \
> +       $(NULL)
> +
> +igt_tests_data_DATA = \
>         $(NULL)
>
>  NOUVEAU_TESTS_M = \
> --
> 1.9.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH i-g-t v5] tests: install test programs to libexec
  2015-03-31 10:04             ` Thomas Wood
@ 2015-03-31 12:53               ` Joonas Lahtinen
  2015-04-02 16:43                 ` Thomas Wood
  0 siblings, 1 reply; 13+ messages in thread
From: Joonas Lahtinen @ 2015-03-31 12:53 UTC (permalink / raw)
  To: intel-gfx, Thomas Wood

Install the test programs by default so that they can be packaged.

Tested with the testdisplay test so that it still runs after the
modifications as it depends on a data file to be present. Need to
pass -r option to enable QR code display on success (PNG data file).

Packaging is useful when building a complete software stack for a
DUT from scratch. This should bring us closer to achieving a
built-from-scratch testing workflow.

Package maintainers can always decide to ignore the installed files.

v2:
- Install more tests including scripts and their data

v3:
- Add clarification to commit message about why we do this.
  (Chris Wilson & Thomas Wood)
- Change libexec into pkglibexec to comply to standard
  (Thomas Wood)
- Do not install $(common_files). (Thomas Wood)
- Make it really obvious the installed files are tests by using
  tests directory name to avoid any confusion with packagers.

v4:
- Fixed commit message.

v5:
- Add file locator helper to retain backwards compatibility.
  (Thomas Wood)
- Test with testdisplay -r option that draws the .png file.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 lib/igt_core.c         | 16 ++++++++++++++++
 lib/igt_core.h         | 13 +++++++++++++
 tests/Makefile.am      | 22 +++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 tests/testdisplay.c    | 21 +++++++++++++++++++--
 5 files changed, 81 insertions(+), 7 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 783a219..8d60930 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -54,6 +54,7 @@
 #include <errno.h>
 #include <time.h>
 #include <ctype.h>
+#include <limits.h>
 
 #include "drmtest.h"
 #include "intel_chipset.h"
@@ -1735,3 +1736,18 @@ void igt_set_timeout(unsigned int seconds)
 
 	alarm(seconds);
 }
+
+FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
+		       const char* filename)
+{
+	char path[PATH_MAX];
+	FILE *fp;
+
+	snprintf(path, sizeof(path), "%s/%s", igt_datadir, filename);
+	fp = fopen(path, "r");
+	if (!fp) {
+		snprintf(path, sizeof(path), "%s/%s", igt_srcdir, filename);
+		fp = fopen(path, "r");
+	}
+	return fp;
+}
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 33f8940..4e56be8 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -33,6 +33,7 @@
 #include <setjmp.h>
 #include <stdbool.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 #include <stdarg.h>
@@ -650,4 +651,16 @@ extern enum igt_log_level igt_log_level;
 
 void igt_set_timeout(unsigned int seconds);
 
+FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
+		       const char* filename);
+/**
+ * igt_fopen_data:
+ * @filename: filename to open.
+ *
+ * Open a datafile for test, first try from installation directory
+ * then from build directory.
+ */
+#define igt_fopen_data(filename) \
+	__igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename)
+
 #endif /* IGT_CORE_H */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f45c6c9..69c7c4e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
 	@echo ${multi_kernel_tests} >> $@
 	@echo END TESTLIST >> $@
 
-EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
-EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
+igt_tests_bin_PROGRAMS += \
+	$(TESTS_progs) \
+	$(TESTS_progs_M) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS += \
+	$(TESTS_scripts) \
+	$(TESTS_scripts_M) \
+	$(scripts) \
+	$(NULL)
+
+igt_tests_data_DATA += \
+	$(IMAGES) \
+	$(NULL)
+
+EXTRA_PROGRAMS = $(HANG)
+EXTRA_DIST = $(common_files)
 
 CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
 
@@ -36,7 +51,8 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
 	-I$(srcdir)/.. \
 	-I$(srcdir)/../lib \
 	-include "$(srcdir)/../lib/check-ndebug.h" \
-	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
+	-DIGT_SRCDIR=\""$(abs_srcdir)"\" \
+	-DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
 	$(LIBUNWIND_CFLAGS) \
 	$(NULL)
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 93e05e4..3e3aa57 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -1,10 +1,22 @@
+igt_tests_bindir = $(pkglibexecdir)/tests
+igt_tests_datadir = $(pkgdatadir)/tests
+
 noinst_PROGRAMS = \
+	$(HANG) \
+	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_PROGRAMS = \
 	gem_alive \
 	gem_stress \
 	$(TESTS_progs) \
 	$(TESTS_progs_M) \
-	$(HANG) \
-	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS = \
+	$(NULL)
+
+igt_tests_data_DATA = \
 	$(NULL)
 
 NOUVEAU_TESTS_M = \
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index f864940..92ea08c 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -68,6 +68,7 @@
 #include "drmtest.h"
 #include "testdisplay.h"
 #include "igt_kms.h"
+#include "igt_core.h"
 
 #include <stdlib.h>
 #include <signal.h>
@@ -238,12 +239,21 @@ paint_color_key(struct igt_fb *fb_info)
 	munmap(fb_ptr, fb_info->size);
 }
 
+static cairo_status_t
+stdio_read_func(void* closure, unsigned char* data, unsigned int size)
+{
+	if (fread (data, 1, size, (FILE*)closure) != size)
+		return CAIRO_STATUS_READ_ERROR;
+	return CAIRO_STATUS_SUCCESS;
+}
+
 static void paint_image(cairo_t *cr, const char *file)
 {
 	int img_x, img_y, img_w, img_h, img_w_o, img_h_o;
 	double img_w_scale, img_h_scale;
 
 	cairo_surface_t *image;
+	FILE* fp;
 
 	img_y = height * (0.10 );
 	img_h = height * 0.08 * 4;
@@ -251,7 +261,14 @@ static void paint_image(cairo_t *cr, const char *file)
 
 	img_x = (width / 2) - (img_w / 2);
 
-	image = cairo_image_surface_create_from_png(file);
+	fp = igt_fopen_data(file);
+	if (!fp) {
+                igt_warn("data file \'%s\' missing: %s\n",
+		         file, strerror(errno));
+                return;
+	}
+	image = cairo_image_surface_create_from_png_stream(&stdio_read_func,
+							   (void*)fp);
 
 	img_w_o = cairo_image_surface_get_width(image);
 	img_h_o = cairo_image_surface_get_height(image);
@@ -318,7 +335,7 @@ static void paint_output_info(struct connector *c, struct igt_fb *fb)
 	}
 
 	if (qr_code)
-		paint_image(cr, IGT_DATADIR"/pass.png");
+		paint_image(cr, "pass.png");
 
 	igt_assert(!cairo_status(cr));
 
-- 
1.9.3



_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH i-g-t v5] tests: install test programs to libexec
  2015-03-31 12:53               ` [PATCH i-g-t v5] " Joonas Lahtinen
@ 2015-04-02 16:43                 ` Thomas Wood
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Wood @ 2015-04-02 16:43 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Intel Graphics Development

On 31 March 2015 at 13:53, Joonas Lahtinen
<joonas.lahtinen@linux.intel.com> wrote:
> Install the test programs by default so that they can be packaged.
>
> Tested with the testdisplay test so that it still runs after the
> modifications as it depends on a data file to be present. Need to
> pass -r option to enable QR code display on success (PNG data file).
>
> Packaging is useful when building a complete software stack for a
> DUT from scratch. This should bring us closer to achieving a
> built-from-scratch testing workflow.
>
> Package maintainers can always decide to ignore the installed files.
>
> v2:
> - Install more tests including scripts and their data
>
> v3:
> - Add clarification to commit message about why we do this.
>   (Chris Wilson & Thomas Wood)
> - Change libexec into pkglibexec to comply to standard
>   (Thomas Wood)
> - Do not install $(common_files). (Thomas Wood)
> - Make it really obvious the installed files are tests by using
>   tests directory name to avoid any confusion with packagers.
>
> v4:
> - Fixed commit message.
>
> v5:
> - Add file locator helper to retain backwards compatibility.
>   (Thomas Wood)
> - Test with testdisplay -r option that draws the .png file.


Thanks, patch merged.


>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Thomas Wood <thomas.wood@intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  lib/igt_core.c         | 16 ++++++++++++++++
>  lib/igt_core.h         | 13 +++++++++++++
>  tests/Makefile.am      | 22 +++++++++++++++++++---
>  tests/Makefile.sources | 16 ++++++++++++++--
>  tests/testdisplay.c    | 21 +++++++++++++++++++--
>  5 files changed, 81 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 783a219..8d60930 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -54,6 +54,7 @@
>  #include <errno.h>
>  #include <time.h>
>  #include <ctype.h>
> +#include <limits.h>
>
>  #include "drmtest.h"
>  #include "intel_chipset.h"
> @@ -1735,3 +1736,18 @@ void igt_set_timeout(unsigned int seconds)
>
>         alarm(seconds);
>  }
> +
> +FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
> +                      const char* filename)
> +{
> +       char path[PATH_MAX];
> +       FILE *fp;
> +
> +       snprintf(path, sizeof(path), "%s/%s", igt_datadir, filename);
> +       fp = fopen(path, "r");
> +       if (!fp) {
> +               snprintf(path, sizeof(path), "%s/%s", igt_srcdir, filename);
> +               fp = fopen(path, "r");
> +       }
> +       return fp;
> +}
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 33f8940..4e56be8 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -33,6 +33,7 @@
>  #include <setjmp.h>
>  #include <stdbool.h>
>  #include <stdlib.h>
> +#include <stdio.h>
>  #include <string.h>
>  #include <sys/types.h>
>  #include <stdarg.h>
> @@ -650,4 +651,16 @@ extern enum igt_log_level igt_log_level;
>
>  void igt_set_timeout(unsigned int seconds);
>
> +FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
> +                      const char* filename);
> +/**
> + * igt_fopen_data:
> + * @filename: filename to open.
> + *
> + * Open a datafile for test, first try from installation directory
> + * then from build directory.
> + */
> +#define igt_fopen_data(filename) \
> +       __igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename)
> +
>  #endif /* IGT_CORE_H */
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index f45c6c9..69c7c4e 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
>         @echo ${multi_kernel_tests} >> $@
>         @echo END TESTLIST >> $@
>
> -EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
> -EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
> +igt_tests_bin_PROGRAMS += \
> +       $(TESTS_progs) \
> +       $(TESTS_progs_M) \
> +       $(NULL)
> +
> +igt_tests_bin_SCRIPTS += \
> +       $(TESTS_scripts) \
> +       $(TESTS_scripts_M) \
> +       $(scripts) \
> +       $(NULL)
> +
> +igt_tests_data_DATA += \
> +       $(IMAGES) \
> +       $(NULL)
> +
> +EXTRA_PROGRAMS = $(HANG)
> +EXTRA_DIST = $(common_files)
>
>  CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
>
> @@ -36,7 +51,8 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
>         -I$(srcdir)/.. \
>         -I$(srcdir)/../lib \
>         -include "$(srcdir)/../lib/check-ndebug.h" \
> -       -DIGT_DATADIR=\""$(abs_srcdir)"\" \
> +       -DIGT_SRCDIR=\""$(abs_srcdir)"\" \
> +       -DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
>         $(LIBUNWIND_CFLAGS) \
>         $(NULL)
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 93e05e4..3e3aa57 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -1,10 +1,22 @@
> +igt_tests_bindir = $(pkglibexecdir)/tests
> +igt_tests_datadir = $(pkgdatadir)/tests
> +
>  noinst_PROGRAMS = \
> +       $(HANG) \
> +       $(TESTS_testsuite) \
> +       $(NULL)
> +
> +igt_tests_bin_PROGRAMS = \
>         gem_alive \
>         gem_stress \
>         $(TESTS_progs) \
>         $(TESTS_progs_M) \
> -       $(HANG) \
> -       $(TESTS_testsuite) \
> +       $(NULL)
> +
> +igt_tests_bin_SCRIPTS = \
> +       $(NULL)
> +
> +igt_tests_data_DATA = \
>         $(NULL)
>
>  NOUVEAU_TESTS_M = \
> diff --git a/tests/testdisplay.c b/tests/testdisplay.c
> index f864940..92ea08c 100644
> --- a/tests/testdisplay.c
> +++ b/tests/testdisplay.c
> @@ -68,6 +68,7 @@
>  #include "drmtest.h"
>  #include "testdisplay.h"
>  #include "igt_kms.h"
> +#include "igt_core.h"
>
>  #include <stdlib.h>
>  #include <signal.h>
> @@ -238,12 +239,21 @@ paint_color_key(struct igt_fb *fb_info)
>         munmap(fb_ptr, fb_info->size);
>  }
>
> +static cairo_status_t
> +stdio_read_func(void* closure, unsigned char* data, unsigned int size)
> +{
> +       if (fread (data, 1, size, (FILE*)closure) != size)
> +               return CAIRO_STATUS_READ_ERROR;
> +       return CAIRO_STATUS_SUCCESS;
> +}
> +
>  static void paint_image(cairo_t *cr, const char *file)
>  {
>         int img_x, img_y, img_w, img_h, img_w_o, img_h_o;
>         double img_w_scale, img_h_scale;
>
>         cairo_surface_t *image;
> +       FILE* fp;
>
>         img_y = height * (0.10 );
>         img_h = height * 0.08 * 4;
> @@ -251,7 +261,14 @@ static void paint_image(cairo_t *cr, const char *file)
>
>         img_x = (width / 2) - (img_w / 2);
>
> -       image = cairo_image_surface_create_from_png(file);
> +       fp = igt_fopen_data(file);
> +       if (!fp) {
> +                igt_warn("data file \'%s\' missing: %s\n",
> +                        file, strerror(errno));
> +                return;
> +       }
> +       image = cairo_image_surface_create_from_png_stream(&stdio_read_func,
> +                                                          (void*)fp);
>
>         img_w_o = cairo_image_surface_get_width(image);
>         img_h_o = cairo_image_surface_get_height(image);
> @@ -318,7 +335,7 @@ static void paint_output_info(struct connector *c, struct igt_fb *fb)
>         }
>
>         if (qr_code)
> -               paint_image(cr, IGT_DATADIR"/pass.png");
> +               paint_image(cr, "pass.png");
>
>         igt_assert(!cairo_status(cr));
>
> --
> 1.9.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-02 16:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 10:43 [PATCH i-g-t] tests: install test programs to libexec Joonas Lahtinen
2015-03-25 12:01 ` Thomas Wood
2015-03-26 16:05   ` [PATCH i-g-t v2] " Joonas Lahtinen
2015-03-26 16:14     ` Chris Wilson
2015-03-27  6:33       ` Joonas Lahtinen
2015-03-26 17:29     ` Thomas Wood
2015-03-27  7:05       ` Joonas Lahtinen
2015-03-27  8:51       ` [PATCH i-g-t v3] " Joonas Lahtinen
2015-03-27  8:56         ` Joonas Lahtinen
2015-03-31  6:51           ` [PATCH i-g-t v4] " Joonas Lahtinen
2015-03-31 10:04             ` Thomas Wood
2015-03-31 12:53               ` [PATCH i-g-t v5] " Joonas Lahtinen
2015-04-02 16:43                 ` Thomas Wood

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.