Skip to contentSkip to conversation

tests: install test programs to libexec

PATCH Superseded Joonas Lahtinen 3 participants 13 messages Mar 25, 2015 – Apr 2, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: install test programs to libexec

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

---
 tests/Makefile.sources | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/Makefile.sources +5 -2
index a165978..ac0ee99 100644
@@ -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 \
Signature · 8 lines
1.9.3



_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 1 line · Joonas Lahtinen

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.

Quoted 15 lines
---
 tests/Makefile.sources | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/Makefile.sources +0 -1
index a165978..ac0ee99 100644
@@ -1,12 +1,15 @@
 noinst_PROGRAMS = \
        gem_alive \
        gem_stress \
-       $(TESTS_progs) \

tests/Makefile.sources line 12

Quoted 10 lines
tests/Makefile.sources +5 -1
-       $(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.

Quoted 8 lines
tests/Makefile.sources +0 -1
 NOUVEAU_TESTS_M = \
        prime_nv_api \
        prime_nv_pcopy \
--

1.9.3

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH v2 1/1 tests: install test programs to libexec

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

v2:
- Install more tests including scripts and their data

---
 tests/Makefile.am      | 22 +++++++++++++++++++---
 tests/Makefile.sources | 10 ++++++++--
 2 files changed, 27 insertions(+), 5 deletions(-)
tests/Makefile.am +19 -3
index 0ae2541..12675b5 100644
@@ -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)/.. \
tests/Makefile.sources +8 -2
index 0a974a6..8d4e243 100644
@@ -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 \
Signature · 7 lines
1.9.3


_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 4 lines · Joonas Lahtinen

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

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Hi,

Quoted 11 lines · Chris Wilson
Quoted 4 lines · Joonas Lahtinen

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.

Quoted 2 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Joonas Lahtinen
Quoted 1 line · Joonas Lahtinen

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

Could you also explain why the tests should be packaged?

Quoted 15 lines

v2:
- Install more tests including scripts and their data

---
 tests/Makefile.am      | 22 +++++++++++++++++++---
 tests/Makefile.sources | 10 ++++++++--
 2 files changed, 27 insertions(+), 5 deletions(-)
tests/Makefile.am +0 -0
index 0ae2541..12675b5 100644

tests/Makefile.am multi-tests.txt: Makefile.sources · line 30

Quoted 6 lines
tests/Makefile.am +1 -2
@@ -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/Makefile.am multi-tests.txt: Makefile.sources · line 33

Quoted 3 lines
tests/Makefile.am +3 -0
+       $(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.

tests/Makefile.am multi-tests.txt: Makefile.sources · line 42

Quoted 9 lines
tests/Makefile.am +9 -0
+       $(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.

tests/Makefile.am multi-tests.txt: Makefile.sources · line 43

Quoted 1 line
tests/Makefile.am +1 -0
+igt_tests_datadir = $(libexecdir)

The data files should be installed in pkgdatadir.

tests/Makefile.am multi-tests.txt: Makefile.sources · line 46

Quoted 3 lines
tests/Makefile.am +3 -0
+igt_tests_data_DATA = \
+       $(IMAGES) \
+       $(common_files) \

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

Quoted 33 lines
tests/Makefile.am +2 -1
+       $(NULL)
 
-CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
+CLEANFILES = single-tests.txt multi-tests.txt
 
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
        -I$(srcdir)/.. \
tests/Makefile.sources +8 -3
index 0a974a6..8d4e243 100644
@@ -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 \
--
Quoted 1 line

1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 6 lines · Thomas Wood
Quoted 1 line · Joonas Lahtinen

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.

Quoted 19 lines
Quoted 19 lines

v2:
- Install more tests including scripts and their data

---
 tests/Makefile.am      | 22 +++++++++++++++++++---
 tests/Makefile.sources | 10 ++++++++--
 2 files changed, 27 insertions(+), 5 deletions(-)
tests/Makefile.am +0 -0
index 0ae2541..12675b5 100644
@@ -27,10 +27,26 @@ multi-tests.txt: Makefile.sources
        @echo ${multi_kernel_tests} >> $@
        @echo END TESTLIST >> $@
 
Quoted 7 lines

tests/Makefile.am multi-tests.txt: Makefile.sources · line 30

Quoted 3 lines
tests/Makefile.am +1 -2
-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.

Quoted 10 lines

tests/Makefile.am multi-tests.txt: Makefile.sources · line 33

Quoted 4 lines
tests/Makefile.am +3 -0
+       $(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.

Quoted 16 lines

tests/Makefile.am multi-tests.txt: Makefile.sources · line 42

Quoted 10 lines
tests/Makefile.am +9 -0
+       $(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.

Quoted 3 lines

tests/Makefile.am multi-tests.txt: Makefile.sources · line 43

Quoted 1 line
tests/Makefile.am +1 -0
+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.

Quoted 8 lines

tests/Makefile.am multi-tests.txt: Makefile.sources · line 46

Quoted 5 lines
tests/Makefile.am +3 -0
+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

Quoted 22 lines
Quoted 22 lines
tests/Makefile.am +2 -1
+       $(NULL)
 
-CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
+CLEANFILES = single-tests.txt multi-tests.txt
 
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
        -I$(srcdir)/.. \
tests/Makefile.sources +0 -2
index 0a974a6..8d4e243 100644
@@ -1,12 +1,18 @@
 noinst_PROGRAMS = \
        gem_alive \
        gem_stress \
-       $(TESTS_progs) \
-       $(TESTS_progs_M) \
        $(HANG) \
        $(TESTS_testsuite) \
        $(NULL)
 
Quoted 13 lines
Quoted 12 lines
tests/Makefile.sources +8 -1
+libexec_PROGRAMS = \
+       $(TESTS_progs) \
+       $(TESTS_progs_M) \
+       $(NULL)
+
+libexec_SCRIPTS = \
+       $(NULL)
+
 NOUVEAU_TESTS_M = \
        prime_nv_api \
        prime_nv_pcopy \
--
Quoted 1 line

1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

PATCH v3 1/1 tests: install test programs to libexec

In reply to 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 <[email protected]>
Cc Thomas Wood <[email protected]>
---
 tests/Makefile.am      | 21 ++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)
tests/Makefile.am +18 -3
index f45c6c9..5cce450 100644
@@ -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)
 
tests/Makefile.sources +14 -2
index 0a974a6..e8297dd 100644
@@ -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 = \
Signature · 8 lines
1.9.3



_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 5 lines · Joonas Lahtinen

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

Quoted 84 lines

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 <[email protected]>
Cc Thomas Wood <[email protected]>
---
 tests/Makefile.am      | 21 ++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)
tests/Makefile.am +18 -3
index f45c6c9..5cce450 100644
@@ -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)
 
tests/Makefile.sources +8 -1
index 0a974a6..e8297dd 100644
@@ -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/Makefile.sources line 22

Quoted 10 lines
tests/Makefile.sources +6 -1
-	$(TESTS_testsuite) \
+	$(NULL)
+
+igt_tests_bin_SCRIPTS = \
+	$(NULL)
+
+igt_tests_data_DATA = \
 	$(NULL)
 
 NOUVEAU_TESTS_M = \

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

PATCH v4 1/1 tests: install test programs to libexec

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 <[email protected]>
Cc Thomas Wood <[email protected]>
---
 tests/Makefile.am      | 21 ++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)
tests/Makefile.am +18 -3
index f45c6c9..5cce450 100644
@@ -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)
 
tests/Makefile.sources +14 -2
index 0a974a6..e8297dd 100644
@@ -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 = \
Signature · 7 lines
1.9.3


_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
Quoted 1 line · Joonas Lahtinen

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.

Quoted 102 lines

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 <[email protected]>
Cc Thomas Wood <[email protected]>
---
 tests/Makefile.am      | 21 ++++++++++++++++++---
 tests/Makefile.sources | 16 ++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)
tests/Makefile.am +18 -3
index f45c6c9..5cce450 100644
@@ -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)
 
tests/Makefile.sources +14 -3
index 0a974a6..e8297dd 100644
@@ -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 = \
--
Quoted 1 line

1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

PATCH v5 1/1 tests: install test programs to libexec

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 <[email protected]>
Cc Thomas Wood <[email protected]>
---
 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(-)
lib/igt_core.c +16 -0
index 783a219..8d60930 100644
@@ -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;
+}
lib/igt_core.h +13 -0
index 33f8940..4e56be8 100644
@@ -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 */
tests/Makefile.am +19 -3
index f45c6c9..69c7c4e 100644
@@ -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)
 
tests/Makefile.sources +14 -2
index 93e05e4..3e3aa57 100644
@@ -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 = \
tests/testdisplay.c +19 -2
index f864940..92ea08c 100644
@@ -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));
 
Signature · 8 lines
1.9.3



_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw
Quoted 24 lines · Joonas Lahtinen

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.

Quoted 7 lines

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.

Quoted 201 lines
Cc Chris Wilson <[email protected]>
Cc Thomas Wood <[email protected]>
---
 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(-)
lib/igt_core.c +16 -0
index 783a219..8d60930 100644
@@ -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;
+}
lib/igt_core.h +13 -0
index 33f8940..4e56be8 100644
@@ -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 */
tests/Makefile.am +19 -3
index f45c6c9..69c7c4e 100644
@@ -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)
 
tests/Makefile.sources +14 -2
index 93e05e4..3e3aa57 100644
@@ -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 = \
tests/testdisplay.c +19 -3
index f864940..92ea08c 100644
@@ -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));
 
--
Quoted 1 line

1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx