Skip to content

Commit

Permalink
tests: Don't generate the .wrap tests, launch them via test-wrapper.sh
Browse files Browse the repository at this point in the history
There is no need for these files to be generated on disk

Closes: flatpak#2170
Approved by: alexlarsson
  • Loading branch information
alexlarsson authored and rh-atomic-bot committed Oct 3, 2018
1 parent 5ab1b99 commit 43c7e7e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ Flatpak-1.0.*
/tests/*.wrap.log
/tests/*.wrap.test
/tests/*.wrap.trs
/tests/*.wrap
po/.intltool-merge-cache
po/Makefile.in.in
po/POTFILES
Expand Down
5 changes: 4 additions & 1 deletion buildutil/glib-tap.mk
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ installed_test_meta_DATA = $(installed_testcases:=.test)
%.test: %$(EXEEXT) Makefile
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
echo 'Type=session' >> $@.tmp; \
echo 'Exec=env G_TEST_SRCDIR=$(installed_testdir) G_TEST_BUILDDIR=$(installed_testdir) $(installed_testdir)/$(notdir $<) --tap' >> $@.tmp; \
if [[ $(notdir $<) == *.wrap ]]; then \
wrapper=$(installed_testdir)/test-wrapper.sh; \
fi; \
echo "Exec=env G_TEST_SRCDIR=$(installed_testdir) G_TEST_BUILDDIR=$(installed_testdir) $$wrapper $(installed_testdir)/$(notdir $<) --tap" >> $@.tmp; \
echo 'Output=TAP' >> $@.tmp; \
mv $@.tmp $@)

Expand Down
5 changes: 4 additions & 1 deletion buildutil/tap-test
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ function cleanup () {
}
trap cleanup EXIT
cd ${tempdir}
${srcd}/${bn} -k --tap
if [[ $bn == *.wrap ]]; then
WRAPPER=${srcd}/test-wrapper.sh
fi
$WRAPPER ${srcd}/${bn} -k --tap
6 changes: 3 additions & 3 deletions tests/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dist_installed_test_extra_scripts += \
tests/make-test-runtime.sh \
tests/make-test-bundles.sh \
tests/test-webserver.sh \
tests/test-wrapper.sh \
$(NULL)

dist_installed_test_data = \
Expand Down Expand Up @@ -103,9 +104,8 @@ TEST_MATRIX_SOURCE = \
update-test-matrix:
$(srcdir)/tests/expand-test-matrix.sh "$(TEST_MATRIX_SOURCE)" > tests/Makefile-test-matrix.am.inc

tests/test-%.wrap: tests/test-wrapper.sh
cp $< $@
chmod a+x $@
tests/test-%.wrap:
@true

include tests/Makefile-test-matrix.am.inc

Expand Down
6 changes: 3 additions & 3 deletions tests/test-wrapper.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

for feature in $(echo $0 | sed "s/^.*@\(.*\).wrap/\1/" | tr "," "\n"); do
for feature in $(echo $1 | sed "s/^.*@\(.*\).wrap/\1/" | tr "," "\n"); do
case $feature in
system)
export USE_SYSTEMDIR=yes
Expand Down Expand Up @@ -28,5 +28,5 @@ for feature in $(echo $0 | sed "s/^.*@\(.*\).wrap/\1/" | tr "," "\n"); do
esac
done

WRAPPED=$(echo $0 | sed "s/@.*/\.sh/")
. $WRAPPED
WRAPPED=$(echo $1 | sed "s/@.*/\.sh/")
. $WRAPPED "$@"

0 comments on commit 43c7e7e

Please sign in to comment.