diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | tests/Makefile-test-matrix.am.inc | 23 | ||||
-rw-r--r-- | tests/Makefile.am.inc | 33 | ||||
-rwxr-xr-x | tests/expand-test-matrix.sh | 111 | ||||
-rwxr-xr-x | tests/test-bundle-system.sh | 22 | ||||
-rwxr-xr-x | tests/test-oci-registry-system.sh | 22 | ||||
-rwxr-xr-x | tests/test-repo-collections-server-only.sh | 23 | ||||
-rwxr-xr-x | tests/test-repo-collections.sh | 23 | ||||
-rwxr-xr-x | tests/test-repo-system.sh | 22 | ||||
-rwxr-xr-x | tests/test-run-deltas.sh | 22 | ||||
-rwxr-xr-x | tests/test-run-system-deltas.sh | 23 | ||||
-rwxr-xr-x | tests/test-run-system.sh | 22 | ||||
-rw-r--r-- | tests/test-wrapper.sh | 32 |
13 files changed, 189 insertions, 193 deletions
@@ -99,6 +99,10 @@ Flatpak-1.0.* /tests/*.sh.log /tests/*.sh.test /tests/*.sh.trs +/tests/*.wrap.log +/tests/*.wrap.test +/tests/*.wrap.trs +/tests/*.wrap po/.intltool-merge-cache po/Makefile.in.in po/POTFILES diff --git a/tests/Makefile-test-matrix.am.inc b/tests/Makefile-test-matrix.am.inc new file mode 100644 index 00000000..e248c7a5 --- /dev/null +++ b/tests/Makefile-test-matrix.am.inc @@ -0,0 +1,23 @@ +# This file is autogenerated by make update-test-matrix, don't edit +TEST_MATRIX= \ + tests/test-basic.sh \ + tests/test-build-update-repo.sh \ + tests/test-http-utils.sh \ + tests/test-run@user,nodeltas.wrap \ + tests/test-run@user,deltas.wrap \ + tests/test-run@system,nodeltas.wrap \ + tests/test-run@system,deltas.wrap \ + tests/test-repo@user.wrap \ + tests/test-repo@system.wrap \ + tests/test-repo@collections.wrap \ + tests/test-repo@collections-server-only.wrap \ + tests/test-extensions.sh \ + tests/test-bundle@user.wrap \ + tests/test-bundle@system.wrap \ + tests/test-oci.sh \ + tests/test-oci-registry@user.wrap \ + tests/test-oci-registry@system.wrap \ + tests/test-unsigned-summaries.sh \ + tests/test-update-remote-configuration.sh \ + $(NULL) +TEST_MATRIX_DIST= tests/test-run.sh tests/test-repo.sh tests/test-bundle.sh tests/test-oci-registry.sh diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc index 56fb5dbc..38f5b46c 100644 --- a/tests/Makefile.am.inc +++ b/tests/Makefile.am.inc @@ -85,34 +85,39 @@ dist_installed_test_keyring2_DATA = \ $(NULL) endif -dist_test_scripts = \ +# Run make update-test-matrix after changing this +TEST_MATRIX_SOURCE = \ tests/test-basic.sh \ tests/test-build-update-repo.sh \ tests/test-http-utils.sh \ - tests/test-run.sh \ - tests/test-run-system.sh \ - tests/test-run-deltas.sh \ - tests/test-run-system-deltas.sh \ - tests/test-repo.sh \ - tests/test-repo-collections.sh \ - tests/test-repo-collections-server-only.sh \ - tests/test-repo-system.sh \ + tests/test-run.sh{{user+system},{nodeltas+deltas}} \ + tests/test-repo.sh{user+system+collections+collections-server-only} \ tests/test-extensions.sh \ - tests/test-bundle.sh \ - tests/test-bundle-system.sh \ + tests/test-bundle.sh{user+system} \ tests/test-oci.sh \ - tests/test-oci-registry.sh \ - tests/test-oci-registry-system.sh \ + tests/test-oci-registry.sh{user+system} \ tests/test-unsigned-summaries.sh \ tests/test-update-remote-configuration.sh \ $(NULL) +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 $@ + +include tests/Makefile-test-matrix.am.inc + +dist_test_scripts = ${TEST_MATRIX} +dist_installed_test_extra_scripts += ${TEST_MATRIX_DIST} + test_programs = testlibrary test_extra_programs = tests/httpcache @VALGRIND_CHECK_RULES@ VALGRIND_SUPPRESSIONS_FILES=tests/flatpak.supp tests/glib.supp -EXTRA_DIST += tests/flatpak.supp tests/glib.supp +EXTRA_DIST += tests/flatpak.supp tests/glib.supp tests/Makefile-test-matrix.am.inc tests/expand-test-matrix.sh tests/test-wrapper.sh DISTCLEANFILES += \ tests/services/org.freedesktop.Flatpak.service \ tests/services/org.freedesktop.Flatpak.SystemHelper.service \ diff --git a/tests/expand-test-matrix.sh b/tests/expand-test-matrix.sh new file mode 100755 index 00000000..8d1ecb81 --- /dev/null +++ b/tests/expand-test-matrix.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +# This script expands test-matrix expressions into indiviual featuressets +# +# The basic element is a feature, which is just a name: +# "a" == enable feature a +# +# A featureset is a comma separated list of features: +# "a,b,c" == enable feature a, b and c +# +# A test-matrix is a list of featuresets to test and are specified by +# separating featuresets by '+': +# "a,b+a,c+e" == featuresets "a,b", "a,c" and "e" +# +# At any point in the expression where a feature is expected you can +# instead specify an entire test-matrix by enclosing a sub-expression +# in brackets. The result is the combinatorial combination of the +# sub-test-matrix with the current featureset. +# +# For example: +# +# "a,{b+c}" == "a,b+a,c" +# or: +# "a,b,{c,d+e,f}" == "a,b,c,d+a,b,e,f" +# +# This can happen multple times in an optionset which will fully expand all +# instances: +# "a,{b+c},{d+e}" == "a,{b+c},d+a,{b+c},e" == "a,b,d+a,c,d+a,{b+c},e" == "a,b,d+a,c,d+a,b,e+a,c,e" +# +# +# The common way to use this is to eiter list all the options to instance the test for each case: +# foo+bar+gazonk +# Or to create all combination of features: +# {foo+nofoo},{bar+nobar} + +tokens=( ) +current_token="" + +function next_token { + if [ ${#tokens[@]} -eq 0 ]; then + current_token="$" + else + current_token=${tokens[0]} + tokens=("${tokens[@]:1}") + fi +} + +parse_res="" +function parse { + local res=( ) + local cur=( ) + while true; do + next_token + local t=$current_token + if [ $t == "}" -o $t == "$" ]; then + break; + elif [ $t == "{" ]; then + parse + local sub=$parse_res + if [ ${#cur} -eq 0 ]; then + cur=( ${sub[@]} ) + else + local sub_res=( ) + for left in "${cur[@]}"; do + for right in $sub; do + sub_res+=("$left,$right") + done + done + cur=( ${sub_res[@]} ) + fi + elif [ $t == "+" ]; then + res+=( "${cur[@]}" ) + cur=( ) + else # ,t + if [ ${#cur} -eq 0 ]; then + cur=( $t ) + else + for i in "${!cur[@]}"; do + cur[$i]="${cur[$i]:+${cur[$i]},}$t" + done + fi + fi + done + if [ ${#cur} -ne 0 ]; then + res+=( "${cur[@]}" ) + fi + + parse_res="${res[@]}" +} + +needs_dist="" +function parse_test { + if [[ $1 =~ ^(.*).sh\{(.*)\}$ ]]; then + tokens=( $(awk -v RS='[{}+,]' '{if ($0 != "" && $0 != "\n") print $0; if (RT != "" && RT != ",") print RT}' <<< "${BASH_REMATCH[2]}") ) + parse + for r in $parse_res; do + echo " ${BASH_REMATCH[1]}@$r.wrap \\" + done + needs_dist="$needs_dist ${BASH_REMATCH[1]}.sh" + else + echo " $1 \\" + fi +} + +echo "# This file is autogenerated by make update-test-matrix, don't edit" +echo "TEST_MATRIX= \\" +for test in $1; do + parse_test $test +done +echo " \$(NULL)" +echo "TEST_MATRIX_DIST=$needs_dist" diff --git a/tests/test-bundle-system.sh b/tests/test-bundle-system.sh deleted file mode 100755 index f1452c5f..00000000 --- a/tests/test-bundle-system.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2011 Colin Walters <walters@verbum.org> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_SYSTEMDIR=yes - -. $(dirname $0)/test-bundle.sh diff --git a/tests/test-oci-registry-system.sh b/tests/test-oci-registry-system.sh deleted file mode 100755 index c0847760..00000000 --- a/tests/test-oci-registry-system.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2018 Red Hat, Inc. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_SYSTEMDIR=yes - -. $(dirname $0)/test-oci-registry.sh diff --git a/tests/test-repo-collections-server-only.sh b/tests/test-repo-collections-server-only.sh deleted file mode 100755 index 69b71688..00000000 --- a/tests/test-repo-collections-server-only.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Copyright © 2017 Endless Mobile, Inc. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_COLLECTIONS_IN_SERVER=yes -export USE_COLLECTIONS_IN_CLIENT=no - -. $(dirname $0)/test-repo.sh diff --git a/tests/test-repo-collections.sh b/tests/test-repo-collections.sh deleted file mode 100755 index 044ca24c..00000000 --- a/tests/test-repo-collections.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Copyright © 2017 Endless Mobile, Inc. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_COLLECTIONS_IN_SERVER=yes -export USE_COLLECTIONS_IN_CLIENT=yes - -. $(dirname $0)/test-repo.sh diff --git a/tests/test-repo-system.sh b/tests/test-repo-system.sh deleted file mode 100755 index a8410b0a..00000000 --- a/tests/test-repo-system.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2011 Colin Walters <walters@verbum.org> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_SYSTEMDIR=yes - -. $(dirname $0)/test-repo.sh diff --git a/tests/test-run-deltas.sh b/tests/test-run-deltas.sh deleted file mode 100755 index f178231f..00000000 --- a/tests/test-run-deltas.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2011 Colin Walters <walters@verbum.org> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_DELTAS=yes - -. $(dirname $0)/test-run.sh diff --git a/tests/test-run-system-deltas.sh b/tests/test-run-system-deltas.sh deleted file mode 100755 index 507eee44..00000000 --- a/tests/test-run-system-deltas.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2011 Colin Walters <walters@verbum.org> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_SYSTEMDIR=yes -export USE_DELTAS=yes - -. $(dirname $0)/test-run.sh diff --git a/tests/test-run-system.sh b/tests/test-run-system.sh deleted file mode 100755 index d87f6e9c..00000000 --- a/tests/test-run-system.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2011 Colin Walters <walters@verbum.org> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -export USE_SYSTEMDIR=yes - -. $(dirname $0)/test-run.sh diff --git a/tests/test-wrapper.sh b/tests/test-wrapper.sh new file mode 100644 index 00000000..59ad02d9 --- /dev/null +++ b/tests/test-wrapper.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +for feature in $(echo $0 | sed "s/^.*@\(.*\).wrap/\1/" | tr "," "\n"); do + case $feature in + system) + export USE_SYSTEMDIR=yes + ;; + user) + export USE_SYSTEMDIR=no + ;; + deltas) + export USE_DELTAS=yes + ;; + nodeltas) + export USE_DELTAS=no + ;; + collections) + export USE_COLLECTIONS_IN_SERVER=yes + export USE_COLLECTIONS_IN_CLIENT=yes + ;; + collections-server-only) + export USE_COLLECTIONS_IN_SERVER=yes + export USE_COLLECTIONS_IN_CLIENT=no + ;; + *) + echo unsupported test feature $feature + exit 1 + esac +done + +WRAPPED=$(echo $0 | sed "s/@.*/\.sh/") +. $WRAPPED |