5 # Note the target name for the documentation targets (-C, -Python, -Gjs)
6 # incorrectly include a relative path to the srcdir, strip that off for usage
8 targetbase=${targetname##*/}
13 limit=$(expr $len - 4)
14 diff -u -U 10 ${srcdir}/${targetname:0:${limit}}-expected.gir ${builddir}/${targetname}
18 # Do nothing for typelibs, this just ensures they build as part of the tests
22 diff -r -u -w -I '^\s*$' -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase}
26 diff -r -u -w -I '^\s*$' -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase}
30 diff -r -u -w -I '^\s*$' -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase}
34 diff -u -w -I '^\s*$' -U 10 ${srcdir}/${targetname::-4}-expected.txt ${builddir}/${targetname}
38 if [[ -z "${TESTARGS}" ]]; then
39 # Run as regular Python file if TESTARGS is empty
40 PYTHONPATH=${top_builddir}:${top_srcdir} ${PYTHON} ${targetname}
43 # Run as Python unittest module with TESTARGS concatenated to the basename of target.
44 # Ensure we are in the directory containing the python module first.
45 export PYTHONPATH=$(readlink -f ${top_builddir}):$(readlink -f ${top_srcdir})
46 modulename=$(basename "${targetbase}" .py)
47 (cd $(dirname ${targetname}) && ${PYTHON} -m unittest -v "${modulename}.${TESTARGS}")
52 echo $"Usage: [TESTARGS=<args>] gi-tester <targetname>"