Skip to content

Commit

Permalink
test: Install GNOME-style installed-tests metadata
Browse files Browse the repository at this point in the history
This allows these tests to be discovered and run by
gnome-desktop-test-runner.

Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv authored and slouken committed May 5, 2022
1 parent 38ef678 commit ce50205
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
9 changes: 9 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 13 additions & 2 deletions test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand Down Expand Up @@ -362,7 +373,7 @@ testmouse$(EXE): $(srcdir)/testmouse.c


clean:
rm -f $(TARGETS)
rm -f $(TARGETS) *.test

distclean: clean
rm -f Makefile
Expand Down
3 changes: 3 additions & 0 deletions test/template.test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Test]
Type=session
Exec=@installedtestsdir@/@exe@

0 comments on commit ce50205

Please sign in to comment.