diff options
author | Mark Doffman <mark.doffman@codethink.co.uk> | 2014-03-27 20:50:21 +0000 |
---|---|---|
committer | Mark Doffman <mark.doffman@codethink.co.uk> | 2014-03-27 20:50:21 +0000 |
commit | 68ff94340891f1ae4ea24546acdbbc39c4dcbcd0 (patch) | |
tree | 46f02cba671bcb321482c7961acd91aeee57ced5 /tests/gi-tester | |
parent | 19da3f81593614198206c45527f973a22cdd621e (diff) | |
parent | 89e84d06dffbc732bac26a105244b7270c42e3ec (diff) | |
download | gobject-introspection-baserock/markdoffman/1_39_90-merge.tar.gz |
Merge tag 'GOBJECT_INTROSPECTION_1_39_90' into baserock/markdoffman/1_39_90-mergebaserock/markdoffman/1_39_90-merge
Tag 1_39_90
Conflicts:
autogen.sh
configure.ac
Diffstat (limited to 'tests/gi-tester')
-rwxr-xr-x | tests/gi-tester | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/gi-tester b/tests/gi-tester new file mode 100755 index 00000000..51199dde --- /dev/null +++ b/tests/gi-tester @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +targetname=$1 + +# Note the target name for the documentation targets (-C, -Python, -Gjs) +# incorrectly include a relative path to the srcdir, strip that off for usage +# in directory diffs. +targetbase=${targetname##*/} + +case $targetname in +*.gir) + len=${#targetname} + limit=$(expr $len - 4) + diff -u -U 10 ${srcdir}/${targetname:0:${limit}}-expected.gir ${builddir}/${targetname} + exit $? + ;; +*.typelib) + # Do nothing for typelibs, this just ensures they build as part of the tests + exit 0 + ;; +*-C) + diff -r -u -w -B -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase} + exit $? + ;; +*-Python) + diff -r -u -w -B -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase} + exit $? + ;; +*-Gjs) + diff -r -u -w -B -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase} + exit $? + ;; +*-sections.txt) + diff -u -w -B -U 10 ${srcdir}/${targetname::-4}-expected.txt ${builddir}/${targetname} + exit $? + ;; +*.py) + if [[ -z "${TESTARGS}" ]]; then + # Run as regular Python file if TESTARGS is empty + PYTHONPATH=${top_builddir}:${top_srcdir} ${PYTHON} ${targetname} + exit $? + else + # Run as Python unittest module with TESTARGS concatenated to the basename of target. + # Ensure we are in the directory containing the python module first. + export PYTHONPATH=$(readlink -f ${top_builddir}):$(readlink -f ${top_srcdir}) + modulename=$(basename "${targetbase}" .py) + (cd $(dirname ${targetname}) && ${PYTHON} -m unittest -v "${modulename}.${TESTARGS}") + exit $? + fi + ;; +*) + echo $"Usage: [TESTARGS=<args>] gi-tester <targetname>" + exit 1 + ;; +esac |