[vala-tests] Update .test scripts, add more tests



commit b07ee41d86e020159dcff7cfa0d7b79cf8693113
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Wed Aug 11 01:11:41 2010 +0200

    Update .test scripts, add more tests

 src/test-common.sh                            |   39 +++++++++++++++++++------
 tests/examples/bmp.xml                        |   15 +++++++++
 tests/examples/cairo-sample.test              |    3 ++
 tests/examples/cairo-shaped.test              |    3 ++
 tests/examples/cairo-threaded.test            |    3 ++
 tests/examples/conditional-compilation-2.test |   10 ++++++
 tests/examples/conditional-compilation.test   |    7 ++++
 tests/examples/couchdb.test                   |    1 +
 tests/examples/dbus-client-waiting.test       |    3 ++
 tests/examples/dbus-demo-client.test          |    3 ++
 tests/examples/dbus-demo-server.test          |    3 ++
 tests/examples/gdbus-demo-client.test         |    4 ++
 tests/examples/gdbus-demo-server.test         |    4 ++
 tests/examples/gio-binary-sample.test         |    1 +
 tests/examples/gio-compression.test           |    9 ++++++
 tests/examples/gio-sample.test                |    1 +
 tests/examples/gtk-cell-renderer.test         |    3 ++
 tests/examples/gtk-filechooser.vala           |    1 +
 tests/examples/input-readline.test            |    1 +
 tests/examples/libxml2.test                   |    3 +-
 tests/examples/lm-send-sync.test              |    1 +
 tests/examples/mx-expander-demo.test          |    3 ++
 tests/examples/mx-expander-demo.vala          |    1 +
 tests/examples/mx-widget-factory.test         |    3 ++
 tests/examples/sdl-sample.test                |    1 +
 tests/examples/sqlite.test                    |    1 +
 tests/examples/tiff.test                      |    1 +
 tests/examples/type-modules-main.test         |    3 ++
 tests/examples/type-modules-myplugin.test     |    3 ++
 tests/examples/zlib.test                      |    1 +
 30 files changed, 125 insertions(+), 10 deletions(-)
---
diff --git a/src/test-common.sh b/src/test-common.sh
index 1b320f3..6cd129b 100644
--- a/src/test-common.sh
+++ b/src/test-common.sh
@@ -30,9 +30,9 @@ function _test_make_guesses {
     grep "Glade\." $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libglade-2.0"
     grep "Module\." $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gmodule-2.0"
     grep "Gnome\.Desktop" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gnome-desktop-2.0"
-    grep "GMenu\." $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libgnome-menu"
+    grep "GMenu\." $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libgnome-menu" VALAFLAGS="$VALAFLAGS -X -DGMENU_I_KNOW_THIS_IS_UNSTABLE=1"
     grep "Gst\." $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gstreamer-0.10"
-    grep "Gdk\.x11" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gdk-x11-2.0" TESTRUN="${TESTRUN:-interact}"
+    grep "x11_drawable_get_xid" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gdk-x11-2.0" TESTRUN="${TESTRUN:-interact}"
     grep "XOverlay" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gstreamer-interfaces-0.10"
     grep "using Panel" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libpanelapplet-2.0" TESTRUN="${TESTRUN:-interact}"
     grep -i "pango" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg pangocairo"
@@ -45,17 +45,29 @@ function _test_make_guesses {
     grep "Curses" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg curses -X -lncurses" TESTRUN="${TESTRUN:-interact}"
     grep "Soup" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libsoup-2.4"
     grep "Json" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg json-glib-1.0"
-    grep "SDL" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg sdl"
-    grep "CouchDB" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg couchdb-glib-1.0"
+    grep "using SDL;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg sdl"
+    grep "using SDLGraphics;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg sdl-gfx"
+    grep "CouchDB" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg couchdb-glib-1.0 --pkg json-glib-1.0"
     grep "Sqlite" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg sqlite3"
     grep "Posix" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg posix"
     grep "Hildon" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg hildon-1"
-    grep "Readline" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg readline"
+    grep "Readline" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg readline" VALAFLAGS="$VALAFLAGS -X -lreadline"
     grep "DesktopAppInfo" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gio-unix-2.0"
     grep "Gsl" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gsl" VALAFLAGS="$VALAFLAGS -X -lgsl -X -lgslcblas -X -lm"
     grep "ZLib" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg zlib -X -lz"
     grep "Lua" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg lua -X -llua -X -ldl -X -lm"
     grep "using Lm" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg loudmouth-1.0"
+    grep "using GL;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gl"
+    grep "using GLU;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg glu"
+    grep "using GLUT;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg glut" TESTRUN="${TESTRUN:-interact}"
+    grep "using GLX;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg glx"
+    grep "using GLFW;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libglfw" TESTRUN="${TESTRUN:-interact}"
+    grep "using Tiff;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg tiff" VALAFLAGS="$VALAFLAGS -X -ltiff"
+    grep "using Postgres;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg libpq"
+    grep "using Gdl;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gdl-1.0"
+    grep "GLDrawable" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg gtkglext-1.0"
+    grep "using X;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg x11"
+    grep "using Mx;" $TESTSRC >/dev/null && PACKAGES="$PACKAGES --pkg mx-1.0"
 }
 
 function _test_setup() {
@@ -117,7 +129,9 @@ function _test_compile_check {
         exitval=0
     fi
 
-    type test_compile_check >/dev/null 2>&1 && test_compile_check
+    if type test_compile_check >/dev/null 2>&1; then
+        test_compile_check || test_fail
+    fi
 
     if [ "$VALAV" = 1 ]; then
         cat $STDOUT
@@ -126,10 +140,14 @@ function _test_compile_check {
 }
 
 function _test_compile {
+    VALAFLAGS="$VALAFLAGS -X -ggdb -X -O0"
     if [ -n "$CFLAGS" ]; then
-       VALAFLAGS="$VALAFLAGS -X '$CFLAGS'"
+       VALAFLAGS="$VALAFLAGS -X '$(echo $CFLAGS)'"
+    fi
+    if [ -n "$LDFLAGS" ]; then
+       VALAFLAGS="-X '$(echo $LDFLAGS)' $VALAFLAGS"
     fi
-    compile="$VALAC $PACKAGES -o $TESTNAME $TESTSRC $VALAFLAGS"
+    compile="$VALAC $VALAFLAGS $PACKAGES -o $TESTNAME $TESTSRC"
     echo "$compile"
     sh -c "$compile" >$STDOUT 2>$STDERR
     exitval="$?"
@@ -146,7 +164,10 @@ function _test_run_check {
         exitval=0
     fi
 
-    type test_run_check >/dev/null 2>&1 && test_run_check
+    if type test_run_check >/dev/null 2>&1; then
+        test_run_check || test_fail
+    fi
+
     if [ "$TESTV" = 1 ]; then
         cat $STDOUT
         cat $STDERR
diff --git a/tests/examples/bmp.xml b/tests/examples/bmp.xml
new file mode 100644
index 0000000..f835b65
--- /dev/null
+++ b/tests/examples/bmp.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info"; type="image/bmp">
+  <!--Created automatically by update-mime-database. DO NOT EDIT!-->
+  <comment>Windows BMP image</comment>
+  <comment xml:lang="de">Windows-BMP-Bild</comment>
+  <comment xml:lang="en_GB">Windows BMP image</comment>
+  <comment xml:lang="es">imagen BMP de Windows</comment>
+  <comment xml:lang="fr">image Windows BMP</comment>
+  <comment xml:lang="it">Immagine Windows BMP</comment>
+  <comment xml:lang="pl">Obraz BMP Windows</comment>
+  <comment xml:lang="pt">imagem BMP Windows</comment>
+  <glob pattern="*.bmp"/>
+  <alias type="image/x-bmp"/>
+  <alias type="image/x-MS-bmp"/>
+</mime-type>
diff --git a/tests/examples/cairo-sample.test b/tests/examples/cairo-sample.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/cairo-sample.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/cairo-shaped.test b/tests/examples/cairo-shaped.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/cairo-shaped.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/cairo-threaded.test b/tests/examples/cairo-threaded.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/cairo-threaded.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/conditional-compilation-2.test b/tests/examples/conditional-compilation-2.test
new file mode 100755
index 0000000..884c375
--- /dev/null
+++ b/tests/examples/conditional-compilation-2.test
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+function test_run_check() {
+  cat "$STDERR" | grep NOFOO
+}
+
+SRCDIR=`dirname $0`
+TESTSRC="$SRCDIR/conditional-compilation.vala"
+VALAFLAGS="-D FOO -D BAR -D FOOBAR -D NOFOO"
+. test-common.sh
diff --git a/tests/examples/conditional-compilation.test b/tests/examples/conditional-compilation.test
new file mode 100755
index 0000000..c7e1ba8
--- /dev/null
+++ b/tests/examples/conditional-compilation.test
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+function test_run_check() {
+  cat "$STDERR" | grep "Nothing relevant defined"
+}
+
+. test-common.sh
diff --git a/tests/examples/couchdb.test b/tests/examples/couchdb.test
index 8c65445..f6071d2 100755
--- a/tests/examples/couchdb.test
+++ b/tests/examples/couchdb.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=no
 . test-common.sh
diff --git a/tests/examples/dbus-client-waiting.test b/tests/examples/dbus-client-waiting.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/dbus-client-waiting.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/dbus-demo-client.test b/tests/examples/dbus-demo-client.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/dbus-demo-client.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/dbus-demo-server.test b/tests/examples/dbus-demo-server.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/dbus-demo-server.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/gdbus-demo-client.test b/tests/examples/gdbus-demo-client.test
new file mode 100755
index 0000000..7f970bb
--- /dev/null
+++ b/tests/examples/gdbus-demo-client.test
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+VALAFLAGS="--pkg gio-2.0"
+. test-common.sh
diff --git a/tests/examples/gdbus-demo-server.test b/tests/examples/gdbus-demo-server.test
new file mode 100755
index 0000000..7f970bb
--- /dev/null
+++ b/tests/examples/gdbus-demo-server.test
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+VALAFLAGS="--pkg gio-2.0"
+. test-common.sh
diff --git a/tests/examples/gio-binary-sample.test b/tests/examples/gio-binary-sample.test
index 8c65445..bba401b 100755
--- a/tests/examples/gio-binary-sample.test
+++ b/tests/examples/gio-binary-sample.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=interact
 . test-common.sh
diff --git a/tests/examples/gio-compression.test b/tests/examples/gio-compression.test
new file mode 100755
index 0000000..4bd943e
--- /dev/null
+++ b/tests/examples/gio-compression.test
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+function test_run_check() {
+  [ "x`gzip -dc gio-compression.data.gz`" = "xCompress me" ]
+}
+
+echo "Compress me" > gio-compression.data
+TESTARGS=gio-compression.data
+. test-common.sh
diff --git a/tests/examples/gio-sample.test b/tests/examples/gio-sample.test
index 8c65445..b0367b8 100755
--- a/tests/examples/gio-sample.test
+++ b/tests/examples/gio-sample.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+echo "Hello" > data.txt
 . test-common.sh
diff --git a/tests/examples/gtk-cell-renderer.test b/tests/examples/gtk-cell-renderer.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/gtk-cell-renderer.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/gtk-filechooser.vala b/tests/examples/gtk-filechooser.vala
index 393f635..2a56747 100644
--- a/tests/examples/gtk-filechooser.vala
+++ b/tests/examples/gtk-filechooser.vala
@@ -1,5 +1,6 @@
 
 // http://live.gnome.org/Vala/GTKSample vala-test:examples/gtk-filechooser.vala
+using Gtk;
 
 public class OpenFileDialog : FileChooserDialog {
 
diff --git a/tests/examples/input-readline.test b/tests/examples/input-readline.test
index 8c65445..bba401b 100755
--- a/tests/examples/input-readline.test
+++ b/tests/examples/input-readline.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=interact
 . test-common.sh
diff --git a/tests/examples/libxml2.test b/tests/examples/libxml2.test
index 8c65445..c9dd735 100755
--- a/tests/examples/libxml2.test
+++ b/tests/examples/libxml2.test
@@ -1,3 +1,4 @@
 #!/bin/bash
-
+SRCDIR=`dirname $0`
+TESTARGS="$SRCDIR/bmp.xml"
 . test-common.sh
diff --git a/tests/examples/lm-send-sync.test b/tests/examples/lm-send-sync.test
index 8c65445..bba401b 100755
--- a/tests/examples/lm-send-sync.test
+++ b/tests/examples/lm-send-sync.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=interact
 . test-common.sh
diff --git a/tests/examples/mx-expander-demo.test b/tests/examples/mx-expander-demo.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/mx-expander-demo.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/mx-expander-demo.vala b/tests/examples/mx-expander-demo.vala
index 1ad4889..5363715 100644
--- a/tests/examples/mx-expander-demo.vala
+++ b/tests/examples/mx-expander-demo.vala
@@ -1,5 +1,6 @@
 
 // http://live.gnome.org/Vala/MxSample vala-test:examples/mx-expander-demo.vala
+using Mx;
 
 int main (string[] args) {
     Clutter.init (ref args);
diff --git a/tests/examples/mx-widget-factory.test b/tests/examples/mx-widget-factory.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/examples/mx-widget-factory.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/examples/sdl-sample.test b/tests/examples/sdl-sample.test
index 8c65445..bba401b 100755
--- a/tests/examples/sdl-sample.test
+++ b/tests/examples/sdl-sample.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=interact
 . test-common.sh
diff --git a/tests/examples/sqlite.test b/tests/examples/sqlite.test
index 8c65445..bba401b 100755
--- a/tests/examples/sqlite.test
+++ b/tests/examples/sqlite.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=interact
 . test-common.sh
diff --git a/tests/examples/tiff.test b/tests/examples/tiff.test
index 8c65445..bba401b 100755
--- a/tests/examples/tiff.test
+++ b/tests/examples/tiff.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+TESTRUN=interact
 . test-common.sh
diff --git a/tests/examples/type-modules-main.test b/tests/examples/type-modules-main.test
index 8c65445..795fad4 100755
--- a/tests/examples/type-modules-main.test
+++ b/tests/examples/type-modules-main.test
@@ -1,3 +1,6 @@
 #!/bin/bash
 
+SRCDIR=`dirname $0`
+TESTSRC="$SRCDIR/type-modules-main.vala $SRCDIR/type-modules-interface.vala"
+
 . test-common.sh
diff --git a/tests/examples/type-modules-myplugin.test b/tests/examples/type-modules-myplugin.test
index 8c65445..2563d1b 100755
--- a/tests/examples/type-modules-myplugin.test
+++ b/tests/examples/type-modules-myplugin.test
@@ -1,3 +1,6 @@
 #!/bin/bash
 
+SRCDIR=`dirname $0`
+TESTSRC="$SRCDIR/type-modules-myplugin.vala $SRCDIR/type-modules-interface.vala"
+
 . test-common.sh
diff --git a/tests/examples/zlib.test b/tests/examples/zlib.test
index 8c65445..088a1ea 100755
--- a/tests/examples/zlib.test
+++ b/tests/examples/zlib.test
@@ -1,3 +1,4 @@
 #!/bin/bash
 
+PACKAGES="--pkg gio-2.0"
 . test-common.sh



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]