From e31e6b51150cc46bcfdcfb7b05e43a6ec7e0f848 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 16 Apr 2012 22:35:18 +0200 Subject: [PATCH] vala tests: some enhancements * t/vala-vpath.sh, t/vala2.sh, t/vala3.sh, t/vala5.sh: Enhance a little. Signed-off-by: Stefano Lattarini --- t/vala-vpath.sh | 22 ++++++++++++++++++++-- t/vala2.sh | 28 ++++++++++++++++++++++++++-- t/vala3.sh | 7 ++++++- t/vala5.sh | 20 ++++++++++++++++++++ 4 files changed, 72 insertions(+), 5 deletions(-) diff --git a/t/vala-vpath.sh b/t/vala-vpath.sh index e1e2e66..0d2e8c9 100755 --- a/t/vala-vpath.sh +++ b/t/vala-vpath.sh @@ -28,9 +28,11 @@ AC_OUTPUT END cat > Makefile.am <<'END' -bin_PROGRAMS = foo -foo_VALAFLAGS = --profile=posix +bin_PROGRAMS = foo bar +AM_VALAFLAGS = --profile=posix foo_SOURCES = hello.vala +bar_VALAFLAGS = $(AM_VALAFLAGS) -H zardoz.h +bar_SOURCES = $(foo_SOURCES) END cat > hello.vala <<'END' @@ -49,10 +51,13 @@ cd build ../configure || Exit 77 $MAKE test -f ../foo_vala.stamp +test -f ../bar_vala.stamp grep foofoofoo ../hello.c +test -f ../zardoz.h $MAKE distcheck # Rebuild rules work also in VPATH builds. + cat > ../hello.vala <<'END' int main () { @@ -63,10 +68,23 @@ END $MAKE test -f ../foo_vala.stamp +test -f ../bar_vala.stamp grep barbarbar ../hello.c # Rebuild rules are not uselessly triggered. $MAKE -q $MAKE -n | grep '\.stamp' && Exit 1 +# Cleanup rules work also in VPATH builds. +$MAKE clean +test -f ../foo_vala.stamp +test -f ../bar_vala.stamp +grep barbarbar ../hello.c +$MAKE maintainer-clean +# FIXME: Generated C files and stamp files doesn't get correctly +# FIXME: cleaned in a VPATH build. +#test ! -f ../hello.c +#test ! -f ../foo_vala.stamp +#test ! -f ../bar_vala.stamp + : diff --git a/t/vala2.sh b/t/vala2.sh index 2b140b5..7e93ff9 100755 --- a/t/vala2.sh +++ b/t/vala2.sh @@ -63,11 +63,28 @@ $AUTOMAKE -a $MAKE # Test rebuild rules. + rm -f src/zardoz.h $MAKE -C src zardoz.h +test -f src/zardoz.h +rm -f src/zardoz.c +$MAKE -C src +test -f src/zardoz.c + +echo am--error > src/zardoz.h +echo am--error > src/zardoz.c +$sleep +touch src/zardoz.vala +$MAKE +grep 'am--error' src/zardoz.[ch] && Exit 1 + +# Check the distribution. $MAKE distcheck $MAKE distclean + +# Tru a VPATH setup. + mkdir build cd build ../configure @@ -75,11 +92,18 @@ $MAKE $MAKE distcheck # Test rebuild rules from builddir. + +rm -f ../src/zardoz.h +$MAKE -C src ../../src/zardoz.h +test -f ../src/zardoz.h + rm -f ../src/zardoz.c $MAKE grep 'Zardoz!' ../src/zardoz.c -sed 's/Zardoz!/FooBar!/' ../src/zardoz.c > t -mv -f t ../src/zardoz.c + +$sleep +sed 's/Zardoz!/FooBar!/' ../src/zardoz.vala > t +mv -f t ../src/zardoz.vala $MAKE grep 'FooBar!' ../src/zardoz.c grep 'Zardoz!' ../src/zardoz.c && Exit 1 diff --git a/t/vala3.sh b/t/vala3.sh index af8fcb5..706753d 100755 --- a/t/vala3.sh +++ b/t/vala3.sh @@ -55,8 +55,13 @@ $AUTOMAKE -a ./configure || skip_ "configure failure" $MAKE +test -f src/zardoz.c +test -f src_zardoz_vala.stamp $MAKE distcheck -$MAKE distclean +$MAKE maintainer-clean +test ! -f src/zardoz.c +test ! -f src_zardoz_vala.stamp + mkdir build cd build ../configure diff --git a/t/vala5.sh b/t/vala5.sh index 26f391a..0c45d1e 100755 --- a/t/vala5.sh +++ b/t/vala5.sh @@ -80,4 +80,24 @@ if cross_compiling; then :; else test `./src/bar` = bar fi +# Test clean rules. + +cp config.status config.sav + +$MAKE clean +test -f src/xfoo.c +test -f src/xbar.c + +$MAKE distclean +test -f src/xfoo.c +test -f src/xbar.c + +# Re-create Makefile. +mv config.sav config.status +./config.status + +$MAKE maintainer-clean +test ! -f src/xfoo.c +test ! -f src/xbar.c + : -- 2.7.4