export PKG_CONFIG_PATH=../../src/libvaladoc
VALAC=valac
-VALAFLAGS="--vapidir ../../src/libvaladoc --pkg valadoc-1.0 --pkg gee-1.0 --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast -X -L../../src/libvaladoc/.libs -X -I../../src/libvaladoc ../libvaladoc/parser/generic-scanner.vala ../drivers/generic-api-test.vala"
+VALAFLAGS="-X -D -X TOP_SRC_DIR=\"$topsrcdir\" --vapidir $topsrcdir/src/libvaladoc --pkg valadoc-1.0 --pkg gee-1.0 --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast -X -L$topsrcdir//src/libvaladoc/.libs -X -I$topsrcdir/src/libvaladoc $topsrcdir/tests/libvaladoc/parser/generic-scanner.vala $topsrcdir/tests/drivers/generic-api-test.vala"
VAPIGEN=$topbuilddir/vapigen/vapigen
VAPIGENFLAGS=
-function testheader() {
- if [ "$1" = "Packages:" ]; then
- shift
- PACKAGES="$PACKAGES $@"
- elif [ "$1" = "D-Bus" ]; then
- echo 'eval `dbus-launch --sh-syntax`' >> prepare
- echo 'trap "kill $DBUS_SESSION_BUS_PID" INT TERM EXIT' >> prepare
- elif [ "$1" = "GIR" ]; then
- GIRTEST=1
- fi
-}
-
-function sourceheader() {
- if [ "$1" = "Program:" ]; then
- testpath=${testfile/.test/}/$2
- ns=${testpath//\//.}
- ns=${ns//-/_}
- SOURCEFILE=$ns.vala
- SOURCEFILES="$SOURCEFILES $SOURCEFILE"
- echo " case \"/$testpath\": $ns.main (); break;" >> main.vala
- echo "namespace $ns {" > $SOURCEFILE
- elif [ $GIRTEST -eq 1 ]; then
- if [ "$1" = "Input:" ]; then
- testpath=${testfile/.test/}
- ns=${testpath//\//.}
- ns=${ns//-/_}
- SOURCEFILE=$ns.gir
- cat <<EOF > $SOURCEFILE
-<?xml version="1.0"?>
-<repository version="1.2"
- xmlns="http://www.gtk.org/introspection/core/1.0"
- xmlns:c="http://www.gtk.org/introspection/c/1.0"
- xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
- <include name="GLib" version="2.0"/>
- <include name="GObject" version="2.0"/>
- <c:include name="test.h"/>
- <namespace name="Test"
- version="1.2"
- c:identifier-prefixes="Test"
- c:symbol-prefixes="test">
-EOF
- elif [ "$1" = "Output:" ]; then
- testpath=${testfile/.test/}
- ns=${testpath//\//.}
- ns=${ns//-/_}
- SOURCEFILE=$ns.vapi.ref
- fi
- fi
-}
-
-function sourceend() {
- if [ -n "$testpath" ]; then
- if [ $GIRTEST -eq 1 ]; then
- if [ $PART -eq 1 ]; then
- echo " </namespace>" >> $SOURCEFILE
- echo "</repository>" >> $SOURCEFILE
- fi
- echo "$VAPIGEN $VAPIGENFLAGS --library $ns $ns.gir && tail -n +5 $ns.vapi|head -n -1|diff -wu $ns.vapi.ref -" > check
- else
- echo "}" >> $SOURCEFILE
- echo "./test$EXEEXT /$testpath" > check
- fi
- fi
-}
testdir=_test
rm -rf $testdir
echo "./test$EXEEXT /$testpath" > check
;;
- *.test)
- PART=0
- INHEADER=1
- GIRTEST=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
cat prepare check > $ns.check