test: Install GNOME-style installed-tests metadata This allows these tests to be discovered and run by gnome-desktop-test-runner. Signed-off-by: Simon McVittie <smcv@collabora.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0a7b8a1..e81ead7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -429,6 +429,15 @@ foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY})
${TESTCASE}
PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}"
)
+ if(SDL_INSTALL_TESTS)
+ set(exe ${TESTCASE})
+ set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL2")
+ configure_file(template.test.in "${exe}.test" @ONLY)
+ install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test"
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL2
+ )
+ endif()
endforeach()
if(SDL_INSTALL_TESTS)
diff --git a/test/Makefile.in b/test/Makefile.in
index d14e073..8fce76e 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -88,13 +88,24 @@ TARGETS = \
@OPENGLES2_TARGETS@ += testgles2$(EXE)
-all: Makefile $(TARGETS) copydatafiles
+all: Makefile $(TARGETS) copydatafiles generatetestmeta
installedtestsdir = $(libexecdir)/installed-tests/SDL2
+installedtestsmetadir = $(datadir)/installed-tests/SDL2
+
+generatetestmeta:
+ rm -f *.test
+ set -e; for exe in $(noninteractive) $(needs_audio) $(needs_display); do \
+ sed \
+ -e 's#@installedtestsdir@#$(installedtestsdir)#g' \
+ -e "s#@exe@#$$exe#g" \
+ < $(srcdir)/template.test.in > $$exe.test; \
+ done
install: all
install -D -t $(DESTDIR)$(installedtestsdir) $(TARGETS)
install -m644 -D -t $(DESTDIR)$(installedtestsdir) $(DATA)
+ install -m644 -D -t $(DESTDIR)$(installedtestsmetadir) *.test
Makefile: $(srcdir)/Makefile.in
$(SHELL) config.status $@
@@ -362,7 +373,7 @@ testmouse$(EXE): $(srcdir)/testmouse.c
clean:
- rm -f $(TARGETS)
+ rm -f $(TARGETS) *.test
distclean: clean
rm -f Makefile
diff --git a/test/template.test.in b/test/template.test.in
new file mode 100644
index 0000000..e1ac063
--- /dev/null
+++ b/test/template.test.in
@@ -0,0 +1,3 @@
+[Test]
+Type=session
+Exec=@installedtestsdir@/@exe@