diff options
author | Reuben Thomas <rrt@sc3d.org> | 2020-11-03 23:11:34 +0000 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-11-05 08:53:15 +0100 |
commit | 78600a6a0c221e08b1e32912b61042aa1f36775b (patch) | |
tree | 0b55c439dfd6418335a4e090f0a5c7c1df24aa50 | |
parent | 88178a7dbe5bbedc24d672fc3e0a2d9a3086048f (diff) | |
download | vala-78600a6a0c221e08b1e32912b61042aa1f36775b.tar.gz |
tests: Use Automake’s parallel test driver to speed up running tests
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1094
24 files changed, 171 insertions, 290 deletions
diff --git a/Makefile.am b/Makefile.am index c96ea4e84..992f95f51 100644 --- a/Makefile.am +++ b/Makefile.am @@ -100,4 +100,5 @@ EXTRA_DIST = \ .version \ build-aux/git-version-gen \ build-aux/gitlog-to-changelog \ + build-aux/testrunner.sh \ $(NULL) diff --git a/tests/testrunner.sh b/build-aux/testrunner.sh index ac5ffe1ad..a3363310b 100755 --- a/tests/testrunner.sh +++ b/build-aux/testrunner.sh @@ -20,14 +20,18 @@ # Author: # Jürg Billeter <j@bitron.ch> -builddir=$PWD -topbuilddir=$builddir/.. -srcdir=$PWD/`dirname $0` -topsrcdir=$srcdir/.. -vapidir=$topsrcdir/vapi +EXTRA_ENVIRONMENT_FILE=tests-extra-environment.sh + +testfile=$1 +testdirname="$(dirname $testfile)" +if test -f $testdirname/$EXTRA_ENVIRONMENT_FILE; then + source $testdirname/$EXTRA_ENVIRONMENT_FILE +fi + +vapidir=$abs_top_srcdir/vapi run_prefix="" -VALAC=$topbuilddir/compiler/valac$EXEEXT +VALAC=$abs_top_builddir/compiler/valac$EXEEXT VALAFLAGS="$VALAFLAGS \ --vapidir $vapidir \ --enable-checking \ @@ -39,7 +43,7 @@ VALAFLAGS="$VALAFLAGS \ -X -pipe \ -X -lm \ -X -DGETTEXT_PACKAGE=\\\"valac\\\"" -VAPIGEN=$topbuilddir/vapigen/vapigen$EXEEXT +VAPIGEN=$abs_top_builddir/vapigen/vapigen$EXEEXT VAPIGENFLAGS="--vapidir $vapidir" # Incorporate the TEST_CFLAGS. @@ -142,12 +146,12 @@ function sourceend() { fi } -testdir=_test +testdir=_test.$$ rm -rf $testdir mkdir $testdir cd $testdir -echo -n -e "TEST: Preparing...\033[72G" +echo -n -e "TEST: Preparing..." cat << "EOF" > checkall all=0 @@ -155,88 +159,87 @@ fail=0 EOF PACKAGES=$([ -z "$PACKAGES" ] && echo "gio-2.0" || echo $PACKAGES) -for testfile in "$@"; do - rm -f prepare check - echo 'set -e' >> prepare - run_prefix="" +testfile=${testfile#$srcdir/} +rm -f prepare check +echo 'set -e' >> prepare +run_prefix="" - case "$testfile" in - *.vala) - testpath=${testfile/.vala/} - ns=${testpath//\//_} - ns=${ns//-/_} - SOURCEFILE=$ns.vala +case "$testfile" in +*.vala) + testpath=${testfile/.vala/} + ns=${testpath//\//_} + ns=${ns//-/_} + SOURCEFILE=$ns.vala - cat "$srcdir/$testfile" >> $SOURCEFILE + cat "$abs_srcdir/$testfile" >> $SOURCEFILE - PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") - echo "G_DEBUG=fatal-warnings $VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare - echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check - ;; - *.gs) - testpath=${testfile/.gs/} - ns=${testpath//\//_} - ns=${ns//-/_} - SOURCEFILE=$ns.gs + PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") + echo "G_DEBUG=fatal-warnings $VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare + echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check + ;; +*.gs) + testpath=${testfile/.gs/} + ns=${testpath//\//_} + ns=${ns//-/_} + SOURCEFILE=$ns.gs - cat "$srcdir/$testfile" >> $SOURCEFILE + cat "$abs_srcdir/$testfile" >> $SOURCEFILE - PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") - echo "G_DEBUG=fatal-warnings $VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare - echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check - ;; - *.test) - PART=0 - INHEADER=1 - INVALIDCODE=0 - GIRTEST=0 - DBUSTEST=0 - ISSERVER=0 - testpath= - while IFS="" read -r line; do - if [ $PART -eq 0 ]; then - if [ -n "$line" ]; then - testheader $line - else - PART=1 - fi - else - if [ $INHEADER -eq 1 ]; then - if [ -n "$line" ]; then - sourceheader $line - else - INHEADER=0 - fi - else - if echo "$line" | grep -q "^[A-Za-z]\+:"; then - sourceend - PART=$(($PART + 1)) - INHEADER=1 - testpath= - sourceheader $line - else - echo "$line" >> $SOURCEFILE - fi - fi - fi - done < "$srcdir/$testfile" - sourceend - ;; - esac + PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") + echo "G_DEBUG=fatal-warnings $VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare + echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check + ;; +*.test) + PART=0 + INHEADER=1 + INVALIDCODE=0 + GIRTEST=0 + DBUSTEST=0 + ISSERVER=0 + testpath= + while IFS="" read -r line; do + if [ $PART -eq 0 ]; then + if [ -n "$line" ]; then + testheader $line + else + PART=1 + fi + else + if [ $INHEADER -eq 1 ]; then + if [ -n "$line" ]; then + sourceheader $line + else + INHEADER=0 + fi + else + if echo "$line" | grep -q "^[A-Za-z]\+:"; then + sourceend + PART=$(($PART + 1)) + INHEADER=1 + testpath= + sourceheader $line + else + echo "$line" >> $SOURCEFILE + fi + fi + fi + done < "$abs_srcdir/$testfile" + sourceend + ;; +esac - cat prepare check > $ns.check - cat << EOF >> checkall -echo -n -e " /$testpath: \033[72G" +cat prepare check > $ns.check +cat << EOF >> checkall +echo -n -e " $testpath: " ((all++)) if $run_prefix bash $ns.check &>log; then - echo -e "\033[0;32mOK\033[m" + echo -e "OK" else ((fail++)) - echo -e "\033[0;31mFAIL\033[m" + echo -e "FAIL" cat log fi EOF -done cat << "EOF" >> checkall if [ $fail -eq 0 ]; then @@ -247,13 +250,12 @@ else fi EOF -echo -e "\033[0;33mDONE\033[m" +echo -e "DONE" if bash checkall; then - cd $builddir + cd $abs_builddir rm -rf $testdir else - cd $builddir + cd $abs_builddir exit 1 fi - diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 000000000..7e563b8b3 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,2 @@ +*.log +*.trs diff --git a/tests/Makefile.am b/tests/Makefile.am index 57020feee..47e9a711b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -18,7 +18,24 @@ BUILT_SOURCES = \ noinst_PROGRAMS = \ $(NULL) -TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' $(srcdir)/testrunner.sh +TEST_EXTENSIONS = .vala .gs .test + +TEST_RUNNER = $(abs_top_srcdir)/build-aux/testrunner.sh +VALA_LOG_COMPILER = $(TEST_RUNNER) +GS_LOG_COMPILER = $(TEST_RUNNER) +TEST_LOG_COMPILER = $(TEST_RUNNER) + +AM_TESTS_ENVIRONMENT = \ + export EXEEXT=$(EXEEXT); \ + export CFLAGS='$(CFLAGS)'; \ + export CPPFLAGS='$(CPPFLAGS)'; \ + export LDFLAGS='$(LDFLAGS)'; \ + export TEST_CFLAGS='$(TEST_CFLAGS)'; \ + export abs_top_srcdir='$(abs_top_srcdir)'; \ + export abs_top_builddir='$(abs_top_builddir)'; \ + export abs_srcdir='$(abs_srcdir)'; \ + export abs_builddir='$(abs_builddir)'; \ + export CC='$(CC)'; TESTS = \ basic-types/integers.vala \ @@ -1019,9 +1036,6 @@ TESTS = \ semantic/yield-creation-requires-async-context.test \ semantic/yield-creation-requires-async-method.test \ semantic/yield-statement-requires-async-context.test \ - $(NULL) - -NON_NULL_TESTS = \ nullability/bug611223.vala \ nullability/local-variable-invalid-convert.test \ nullability/member-access-nullable-instance.test \ @@ -1029,30 +1043,11 @@ NON_NULL_TESTS = \ nullability/method-return-invalid-convert.test \ nullability/string-concat.test \ nullability/with-non-null.test \ - $(NULL) - -LINUX_TESTS = \ - linux/bug793444.vala \ - posix/file-commandpipe.vala \ - $(NULL) - -POSIX_TESTS = \ - basic-types/arrays.vala \ - arrays/empty-length-0.vala \ - structs/struct_only.vala \ - delegates/delegate_only.vala \ - enums/enum_only.vala \ - $(NULL) - -VERSION_CHECK_TESTS = \ version/since-constant.test \ version/since-field.test \ version/since-local-variable.test \ version/since-method.test \ version/since-parameter.test \ - $(NULL) - -GENIE_TESTS = \ genie/class.gs \ genie/control-flow-if-do.gs \ genie/control-flow-if-else.gs \ @@ -1117,32 +1112,29 @@ GENIE_TESTS = \ genie/preparser-or-expression.gs \ genie/struct.gs \ genie/struct-after-class.gs \ + $(LINUX_TESTS) \ $(NULL) -check-TESTS: $(TESTS) $(NON_NULL_TESTS) - @EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' \ - $(srcdir)/testrunner.sh $(TESTS) +LINUX_TESTS = $(NULL) + if HAVE_LINUX - @EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' \ - PACKAGES="linux" $(srcdir)/testrunner.sh $(LINUX_TESTS) - @EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' \ - VALAFLAGS="--profile posix" PACKAGES="posix linux" $(srcdir)/testrunner.sh $(POSIX_TESTS) +LINUX_TESTS += \ + linux/bug793444.vala \ + linux/file-commandpipe.vala \ + posix/arrays.vala \ + posix/empty-length-0.vala \ + posix/struct_only.vala \ + posix/delegate_only.vala \ + posix/enum_only.vala \ + $(NULL) endif - @EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' \ - VALAFLAGS="--enable-experimental-non-null" $(srcdir)/testrunner.sh $(NON_NULL_TESTS) - @export PKG_CONFIG_PATH=$(abs_srcdir)/version; EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \ - TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' $(srcdir)/testrunner.sh $(VERSION_CHECK_TESTS) - @EXEEXT=$(EXEEXT) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' \ - $(srcdir)/testrunner.sh $(GENIE_TESTS) EXTRA_DIST = \ - testrunner.sh \ + linux/tests-extra-environment.sh \ + nullability/tests-extra-environment.sh \ + posix/tests-extra-environment.sh \ version/glib-2.0.pc \ + version/tests-extra-environment.sh \ $(TESTS) \ - $(NON_NULL_TESTS) \ $(LINUX_TESTS) \ - $(POSIX_TESTS) \ - $(VERSION_CHECK_TESTS) \ - $(GENIE_TESTS) \ $(NULL) - diff --git a/tests/posix/file-commandpipe.vala b/tests/linux/file-commandpipe.vala index 90ef10c0a..90ef10c0a 100644 --- a/tests/posix/file-commandpipe.vala +++ b/tests/linux/file-commandpipe.vala diff --git a/tests/linux/tests-extra-environment.sh b/tests/linux/tests-extra-environment.sh new file mode 100644 index 000000000..b6b38e3ba --- /dev/null +++ b/tests/linux/tests-extra-environment.sh @@ -0,0 +1 @@ +PACKAGES="linux" diff --git a/tests/nullability/tests-extra-environment.sh b/tests/nullability/tests-extra-environment.sh new file mode 100644 index 000000000..0f2be824f --- /dev/null +++ b/tests/nullability/tests-extra-environment.sh @@ -0,0 +1 @@ +VALAFLAGS="--enable-experimental-non-null" diff --git a/tests/posix/arrays.vala b/tests/posix/arrays.vala new file mode 120000 index 000000000..c5acf0047 --- /dev/null +++ b/tests/posix/arrays.vala @@ -0,0 +1 @@ +../basic-types/arrays.vala
\ No newline at end of file diff --git a/tests/posix/delegate_only.vala b/tests/posix/delegate_only.vala new file mode 120000 index 000000000..a6397a094 --- /dev/null +++ b/tests/posix/delegate_only.vala @@ -0,0 +1 @@ +../delegates/delegate_only.vala
\ No newline at end of file diff --git a/tests/posix/empty-length-0.vala b/tests/posix/empty-length-0.vala new file mode 120000 index 000000000..7ded9d744 --- /dev/null +++ b/tests/posix/empty-length-0.vala @@ -0,0 +1 @@ +../arrays/empty-length-0.vala
\ No newline at end of file diff --git a/tests/posix/enum_only.vala b/tests/posix/enum_only.vala new file mode 120000 index 000000000..4d86cb050 --- /dev/null +++ b/tests/posix/enum_only.vala @@ -0,0 +1 @@ +../enums/enum_only.vala
\ No newline at end of file diff --git a/tests/posix/struct_only.vala b/tests/posix/struct_only.vala new file mode 120000 index 000000000..fb269184e --- /dev/null +++ b/tests/posix/struct_only.vala @@ -0,0 +1 @@ +../structs/struct_only.vala
\ No newline at end of file diff --git a/tests/posix/tests-extra-environment.sh b/tests/posix/tests-extra-environment.sh new file mode 100644 index 000000000..ef342f591 --- /dev/null +++ b/tests/posix/tests-extra-environment.sh @@ -0,0 +1,2 @@ +VALAFLAGS="--profile posix" +PACKAGES="posix linux" diff --git a/tests/version/tests-extra-environment.sh b/tests/version/tests-extra-environment.sh new file mode 100644 index 000000000..26cb79797 --- /dev/null +++ b/tests/version/tests-extra-environment.sh @@ -0,0 +1 @@ +PKG_CONFIG_PATH=$abs_srcdir/version diff --git a/valadoc/tests/.gitignore b/valadoc/tests/.gitignore new file mode 100644 index 000000000..7e563b8b3 --- /dev/null +++ b/valadoc/tests/.gitignore @@ -0,0 +1,2 @@ +*.log +*.trs diff --git a/valadoc/tests/Makefile.am b/valadoc/tests/Makefile.am index 13670e268..62edb7b7c 100644 --- a/valadoc/tests/Makefile.am +++ b/valadoc/tests/Makefile.am @@ -2,23 +2,32 @@ include $(top_srcdir)/Makefile.common NULL = -TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) PACKAGE_SUFFIX=$(PACKAGE_SUFFIX) TOPBUILDDIR=$(abs_top_builddir) TOPSRCDIR=$(abs_top_srcdir) \ - CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' $(srcdir)/testrunner.sh +LOG_COMPILER = $(abs_top_srcdir)/build-aux/testrunner.sh +AM_TESTS_ENVIRONMENT = \ + export EXEEXT=$(EXEEXT); \ + export CFLAGS='$(CFLAGS)'; \ + export CPPFLAGS='$(CPPFLAGS)'; \ + export LDFLAGS='$(LDFLAGS)'; \ + export TEST_CFLAGS='$(TEST_CFLAGS)'; \ + export PACKAGE_SUFFIX='$(PACKAGE_SUFFIX)' \ + export abs_top_srcdir='$(abs_top_srcdir)'; \ + export abs_top_builddir='$(abs_top_builddir)'; \ + export abs_srcdir='$(abs_srcdir)'; \ + export abs_builddir='$(abs_builddir)'; \ + export CC='$(CC)'; TESTS = \ libvaladoc/errorreporter.vala \ libvaladoc/markupreader.vala \ libvaladoc/gtkdoc-scanner.vala \ - libvaladoc/parser/manyrule.vala \ - libvaladoc/parser/oneofrule.vala \ - libvaladoc/parser/sequencerule.vala \ - libvaladoc/parser/optionalrule.vala \ - libvaladoc/parser/stubrule.vala \ + libvaladoc/parser-manyrule.vala \ + libvaladoc/parser-oneofrule.vala \ + libvaladoc/parser-sequencerule.vala \ + libvaladoc/parser-optionalrule.vala \ + libvaladoc/parser-stubrule.vala \ $(NULL) -check-TESTS: $(TESTS) - @EXEEXT=$(EXEEXT) PACKAGE_SUFFIX=$(PACKAGE_SUFFIX) TOPBUILDDIR=$(abs_top_builddir) TOPSRCDIR=$(abs_top_srcdir) \ - CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' TEST_CFLAGS='$(TEST_CFLAGS)' CC='$(CC)' $(srcdir)/testrunner.sh $(TESTS) +check-local: G_DEBUG=fatal_warnings $(builddir)/driver AM_CFLAGS = \ @@ -90,11 +99,11 @@ driver.vala.stamp: $(driver_VALASOURCES) $(top_srcdir)/vala/libvala@PACKAGE_SUFF EXTRA_DIST = \ driver.vala.stamp \ $(driver_SOURCES) \ - testrunner.sh \ drivers/api-test.data.vapi \ drivers/driver-test.vala \ drivers/generic-api-test.vala \ - libvaladoc/parser/generic-scanner.vala \ + libvaladoc/parser-generic-scanner.vala \ + libvaladoc/tests-extra-environment.sh \ $(TESTS) \ $(NULL) diff --git a/valadoc/tests/libvaladoc/parser/generic-scanner.vala b/valadoc/tests/libvaladoc/parser-generic-scanner.vala index d3dc2a0f9..d3dc2a0f9 100644 --- a/valadoc/tests/libvaladoc/parser/generic-scanner.vala +++ b/valadoc/tests/libvaladoc/parser-generic-scanner.vala diff --git a/valadoc/tests/libvaladoc/parser/manyrule.vala b/valadoc/tests/libvaladoc/parser-manyrule.vala index 2af76d302..2af76d302 100644 --- a/valadoc/tests/libvaladoc/parser/manyrule.vala +++ b/valadoc/tests/libvaladoc/parser-manyrule.vala diff --git a/valadoc/tests/libvaladoc/parser/oneofrule.vala b/valadoc/tests/libvaladoc/parser-oneofrule.vala index 5da75267e..5da75267e 100644 --- a/valadoc/tests/libvaladoc/parser/oneofrule.vala +++ b/valadoc/tests/libvaladoc/parser-oneofrule.vala diff --git a/valadoc/tests/libvaladoc/parser/optionalrule.vala b/valadoc/tests/libvaladoc/parser-optionalrule.vala index b7b68eaf7..b7b68eaf7 100644 --- a/valadoc/tests/libvaladoc/parser/optionalrule.vala +++ b/valadoc/tests/libvaladoc/parser-optionalrule.vala diff --git a/valadoc/tests/libvaladoc/parser/sequencerule.vala b/valadoc/tests/libvaladoc/parser-sequencerule.vala index 13b4eec44..13b4eec44 100644 --- a/valadoc/tests/libvaladoc/parser/sequencerule.vala +++ b/valadoc/tests/libvaladoc/parser-sequencerule.vala diff --git a/valadoc/tests/libvaladoc/parser/stubrule.vala b/valadoc/tests/libvaladoc/parser-stubrule.vala index 6a097fd0b..6a097fd0b 100644 --- a/valadoc/tests/libvaladoc/parser/stubrule.vala +++ b/valadoc/tests/libvaladoc/parser-stubrule.vala diff --git a/valadoc/tests/libvaladoc/tests-extra-environment.sh b/valadoc/tests/libvaladoc/tests-extra-environment.sh new file mode 100644 index 000000000..bed7659ed --- /dev/null +++ b/valadoc/tests/libvaladoc/tests-extra-environment.sh @@ -0,0 +1,17 @@ +VALAFLAGS="\ + -X -D -X TOP_SRC_DIR=\"$abs_top_srcdir\" \ + --pkg libgvc \ + --vapidir $abs_top_srcdir/vala \ + --pkg libvala$PACKAGE_SUFFIX \ + --vapidir $abs_top_srcdir/libvaladoc \ + --pkg valadoc$PACKAGE_SUFFIX \ + --main main \ + -X -L$abs_top_builddir/vala/.libs -X -lvala$PACKAGE_SUFFIX \ + -X -L$abs_top_builddir/libvaladoc/.libs -X -lvaladoc$PACKAGE_SUFFIX \ + -X -I$abs_top_srcdir/gee \ + -X -I$abs_top_srcdir/vala \ + -X -I$abs_top_srcdir/libvaladoc \ + $abs_top_srcdir/valadoc/tests/libvaladoc/parser-generic-scanner.vala \ +" +PKG_CONFIG_PATH=$abs_top_builddir:$abs_top_builddir/libvaladoc +LD_LIBRARY_PATH=$abs_top_builddir/vala/.libs:$abs_top_builddir/libvaladoc/.libs diff --git a/valadoc/tests/testrunner.sh b/valadoc/tests/testrunner.sh deleted file mode 100755 index c06dda358..000000000 --- a/valadoc/tests/testrunner.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env bash -# testrunner.sh -# -# Copyright (C) 2006-2008 Jürg Billeter -# -# 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# -# Author: -# Jürg Billeter <j@bitron.ch> - -builddir=$PWD -topbuilddir=$TOPBUILDDIR -topsrcdir=$TOPSRCDIR -vapidir=$topsrcdir/vapi - -export G_DEBUG=fatal_warnings -export PKG_CONFIG_PATH=$topbuilddir:$topbuilddir/libvaladoc -export LD_LIBRARY_PATH=$topbuilddir/vala/.libs:$topbuilddir/libvaladoc/.libs - -VALAC=$topbuilddir/compiler/valac$EXEEXT -VALAFLAGS="$VALAFLAGS \ - -X -D -X TOP_SRC_DIR=\"$topsrcdir\" \ - --vapidir $vapidir --pkg libgvc \ - --vapidir $topsrcdir/vala --pkg libvala$PACKAGE_SUFFIX \ - --vapidir $topsrcdir/libvaladoc --pkg valadoc$PACKAGE_SUFFIX \ - --disable-warnings \ - --main main \ - --save-temps \ - --cc $CC \ - -X -g \ - -X -O0 \ - -X -pipe \ - -X -lm \ - -X -L$topbuilddir/vala/.libs -X -lvala$PACKAGE_SUFFIX \ - -X -L$topbuilddir/libvaladoc/.libs -X -lvaladoc$PACKAGE_SUFFIX \ - -X -I$topsrcdir/gee \ - -X -I$topsrcdir/vala \ - -X -I$topsrcdir/libvaladoc \ - $topsrcdir/valadoc/tests/libvaladoc/parser/generic-scanner.vala" - -# Incorporate the TEST_CFLAGS. -for cflag in ${TEST_CFLAGS}; do - VALAFLAGS="${VALAFLAGS} -X ${cflag}" -done - -# Incorporate the user's CFLAGS. Matters if the user decided to insert -# -m32 in CFLAGS, for example. -for cflag in ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do - if [[ ! $cflag =~ ^\-O[0-9]$ ]]; then - VALAFLAGS="${VALAFLAGS} -X ${cflag}" - fi -done - -testdir=_test -rm -rf $testdir -mkdir $testdir -cd $testdir - -echo -n -e "TEST: Building...\033[72G" - -cat << "EOF" > checkall -all=0 -fail=0 -EOF - -cat << "EOF" > main.vala -void main (string[] args) { - switch (args[1]) { -EOF - -PACKAGES=gio-2.0 -SOURCEFILES= -for testfile in "$@"; do - rm -f prepare check - echo 'set -e' >> prepare - - case "$testfile" in - *.vala) - testpath=${testfile/.vala/} - ns=${testpath//\//.} - ns=${ns//-/_} - SOURCEFILE=$ns.vala - SOURCEFILES="$SOURCEFILES $SOURCEFILE" - - echo " case \"/$testpath\": $ns.main (); break;" >> main.vala - echo "namespace $ns {" > $SOURCEFILE - cat "$topsrcdir/valadoc/tests/$testfile" >> $SOURCEFILE - echo "}" >> $SOURCEFILE - - echo "./test$EXEEXT /$testpath" > check - ;; - esac - - cat prepare check > $ns.check - cat << EOF >> checkall -echo -n -e " /$testpath: \033[72G" -((all++)) -if bash $ns.check &>log; then - echo -e "\033[0;32mOK\033[m" -else - ((fail++)) - echo -e "\033[0;31mFAIL\033[m" - cat log -fi -EOF -done - -cat << "EOF" >> checkall -if [ $fail -eq 0 ]; then - echo "All $all tests passed" -else - echo "$fail of $all tests failed" - exit 1 -fi -EOF - -cat << "EOF" >> main.vala - default: assert_not_reached (); - } -} -EOF - -cat $SOURCEFILES >> main.vala - -if $VALAC $VALAFLAGS -o test$EXEEXT $([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") main.vala &>log; then - echo -e "\033[0;32mOK\033[m" -else - echo -e "\033[0;31mFAIL\033[m" - cat log - - cd $builddir - exit 1 -fi - -if bash checkall; then - cd $builddir - rm -rf $testdir -else - cd $builddir - exit 1 -fi - |