]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
testrunner: Compile and run tests separately
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Oct 2018 13:28:53 +0000 (15:28 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Oct 2018 14:41:19 +0000 (16:41 +0200)
18 files changed:
tests/dbus/arrays.test
tests/dbus/async-errors.test
tests/dbus/async.test
tests/dbus/basic-types.test
tests/dbus/bug602003.test
tests/dbus/bug735437.test
tests/dbus/bug782719.test
tests/dbus/bug783002.test
tests/dbus/dicts.test
tests/dbus/enum-string-marshalling.vala
tests/dbus/errors.test
tests/dbus/filedescriptor-async.test
tests/dbus/filedescriptor-errors.test
tests/dbus/filedescriptor.test
tests/dbus/rawvariants.test
tests/dbus/signals.test
tests/dbus/structs.test
tests/testrunner.sh

index fa884ca24b08c3c4a2a17c7ff26e4591ff2b2f5e..0557cb23d1aad539f9dec51e9f976a1a347b54ca 100644 (file)
@@ -68,7 +68,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/arrays/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_arrays_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index 4c9483f5d34c434aac3ab3555027822080873f4c..a23f0a65348a63d996085d2cbd4083ac1677bd79 100644 (file)
@@ -102,7 +102,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/async-errors/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_async_errors_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index cb6a541fc1e8031f0e9005a109caa0f5d8b3fea2..fb8fea9df87073f04541bed366c8373107a33e6f 100644 (file)
@@ -83,7 +83,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/async/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_async_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index dbe63b13a467a5aac29b45c689e328ec5b71868a..cb61ea66229da8cc1de73e08c89616706178cfdb 100644 (file)
@@ -80,7 +80,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/basic-types/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_basic_types_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index ceb2327e5de9e33e600ed1f0a3923804447f75ed..ab0bb2213c9de4a569bb791702662383136c4c90 100644 (file)
@@ -46,7 +46,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/bug602003/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_bug602003_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index c2b75821ce5a4325071278dfb033e2190852fd2d..70239859ab857ff2a724aeca4ee6fbce4bd8cbb5 100644 (file)
@@ -60,7 +60,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/bug735437/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_bug735437_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index fe52eb3e2c6d3d8964a63bfcd3aed6c8019823b0..781d9749c3b9e605b27392af0e54badc661eef62 100644 (file)
@@ -55,7 +55,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/bug782719/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_bug782719_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index f300c2beb6714984644e7d6e8e2932d1aa95fa4d..b11ee1b59b1b66bdc3764e459044bcbbe4ad6dcc 100644 (file)
@@ -62,7 +62,7 @@ void main () {
        assert ((uint) request_result.get_child_value (0) == 1);
 
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/bug783002/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_bug783002_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, on_client_exit);
 
        main_loop = new MainLoop ();
index 1e7037ed7ef0eb29184500fc7ebe0fd1873cbea5..9837f933d45d78b7416c226ad1b337c82f4b34d2 100644 (file)
@@ -64,7 +64,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/dicts/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_dicts_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index 2cc764852eee8e5725d51eea80dbaf674e760508..536daad08531d9af9fe058489b05fadbb3a551fe 100644 (file)
@@ -7,7 +7,7 @@ public enum FooEnum {
 public interface Test : GLib.Object {
        public abstract async void test1 (FooEnum e) throws DBusError;
        public abstract void test2 (FooEnum e) throws DBusError;
-       public abstract void test3 (FooEnum e1, UnixOutputStream output_stream, FooEnum e2) throws DBusError;
+       public abstract void test3 (FooEnum e1, int fd, FooEnum e2) throws DBusError;
        public abstract void test4 (FooEnum e);
        public abstract async void test5 (FooEnum e);
 }
index 9088fb4fddce00c5ea163ac16129e76992a7c6da..508254286a1bf5d2454addf957dfbfcf40a381ad 100644 (file)
@@ -85,7 +85,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/errors/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_errors_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index 96fc9764a2f637d809441ce40b4f762aee5226d5..9558866bf29de227b6907a0d38cdc40b33f09a58 100644 (file)
@@ -91,7 +91,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/filedescriptor-async/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_filedescriptor_async_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index ad3081653b00cd67d4995f42bf835855b7ac0f66..c2e102a2a7e5fb69323ac9e1e0969ecb4c8823b5 100644 (file)
@@ -63,7 +63,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/filedescriptor-errors/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_filedescriptor_errors_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index 3eeb9ef283f5fc1681d92f500b88edc3a0448967..3ad29acf9043d333792a0af3eaf8cf4e04936d2a 100644 (file)
@@ -76,7 +76,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/filedescriptor/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_filedescriptor_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index ca80e74fb1633fbc8b5e7e12297553f9de391586..32cf26f03e22eca8cb6ea910befdc3dbc9bf21c4 100644 (file)
@@ -128,7 +128,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/rawvariants/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_rawvariants_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index e46320b75270a9af40128c585e17cb154176b332..10544c52057cb370111c6a22aa02c0ded8243927 100644 (file)
@@ -57,7 +57,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/signals/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_signals_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index d23dd84b81c835a221df0b687bbc93e1f9eec39d..99520e82cdf4616d943da51fbec6939ea1df694f 100644 (file)
@@ -81,7 +81,7 @@ void main () {
 
        // server ready, spawn client
        Pid client_pid;
-       Process.spawn_async (null, { "test", "/dbus/structs/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
+       Process.spawn_async (null, { "dbus_structs_client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
        ChildWatch.add (client_pid, client_exit);
 
        main_loop = new MainLoop ();
index 44fbd78cfe5a345c33ad9c15fabe8c3d7391fdf4..f8f4ba20d860226dff258238c49dbba01696c016 100755 (executable)
@@ -37,7 +37,7 @@ VALAFLAGS="$VALAFLAGS \
        -X -O0 \
        -X -pipe \
        -X -lm \
-       -X -DGETTEXT_PACKAGE=\"valac\" \
+       -X -DGETTEXT_PACKAGE=\\\"valac\\\" \
        -X -Werror=return-type \
        -X -Werror=init-self \
        -X -Werror=implicit \
@@ -69,10 +69,11 @@ function testheader() {
                INVALIDCODE=1
                INHEADER=0
                testpath=${testfile/.test/}
-               ns=${testpath//\//.}
-               ns=${ns//-/_}
+               ns=${testpath//\//_}
+               ns=${ns//-/_}\_invalid
                SOURCEFILE=$ns.vala
        elif [ "$1" = "D-Bus" ]; then
+               DBUSTEST=1
                run_prefix="dbus-run-session -- $run_prefix"
        elif [ "$1" = "GIR" ]; then
                GIRTEST=1
@@ -81,17 +82,18 @@ function testheader() {
 
 function sourceheader() {
        if [ "$1" = "Program:" ]; then
+               if [ "$2" = "server" ]; then
+                       ISSERVER=1
+               fi
                testpath=${testfile/.test/}/$2
-               ns=${testpath//\//.}
+               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=${testpath//\//_}
                        ns=${ns//-/_}
                        SOURCEFILE=$ns.gir
                        cat <<EOF > $SOURCEFILE
@@ -110,7 +112,7 @@ function sourceheader() {
 EOF
                elif [ "$1" = "Output:" ]; then
                        testpath=${testfile/.test/}
-                       ns=${testpath//\//.}
+                       ns=${testpath//\//_}
                        ns=${ns//-/_}
                        SOURCEFILE=$ns.vapi.ref
                fi
@@ -129,8 +131,15 @@ function sourceend() {
                        fi
                        echo "$VAPIGEN $VAPIGENFLAGS --library $ns $ns.gir && tail -n +5 $ns.vapi|sed '\$d'|diff -wu $ns.vapi.ref -" > check
                else
-                       echo "}" >> $SOURCEFILE
-                       echo "./test$EXEEXT /$testpath" > check
+                       PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg")
+                       echo "$VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare
+                       if [ $DBUSTEST -eq 1 ]; then
+                               if [ $ISSERVER -eq 1 ]; then
+                                       echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check
+                               fi
+                       else
+                               echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check
+                       fi
                fi
        fi
 }
@@ -140,20 +149,14 @@ rm -rf $testdir
 mkdir $testdir
 cd $testdir
 
-echo -n -e "TEST: Building...\033[72G"
+echo -n -e "TEST: Preparing...\033[72G"
 
 cat << "EOF" > checkall
 all=0
 fail=0
 EOF
 
-cat << "EOF" > main.vala
-void main (string[] args) {
-       switch (args[1]) {
-EOF
-
 PACKAGES=gio-2.0
-SOURCEFILES=
 for testfile in "$@"; do
        rm -f prepare check
        echo 'set -e' >> prepare
@@ -162,23 +165,23 @@ for testfile in "$@"; do
        case "$testfile" in
        *.vala)
                testpath=${testfile/.vala/}
-               ns=${testpath//\//.}
+               ns=${testpath//\//_}
                ns=${ns//-/_}
                SOURCEFILE=$ns.vala
-               SOURCEFILES="$SOURCEFILES $SOURCEFILE"
 
-               echo "  case \"/$testpath\": $ns.main (); break;" >> main.vala
-               echo "namespace $ns {" > $SOURCEFILE
                cat "$srcdir/$testfile" >> $SOURCEFILE
-               echo "}" >> $SOURCEFILE
 
-               echo "G_DEBUG=fatal-warnings ./test$EXEEXT /$testpath" > check
+               PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg")
+               echo "$VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare
+               echo "G_DEBUG=fatal-warnings ./$ns$EXEEXT" >> check
                ;;
        *.test)
                PART=0
                INHEADER=1
                INVALIDCODE=0
                GIRTEST=0
+               DBUSTEST=0
+               ISSERVER=0
                testpath=
                while IFS="" read -r line; do
                        if [ $PART -eq 0 ]; then
@@ -234,23 +237,7 @@ else
 fi
 EOF
 
-cat << "EOF" >> main.vala
-       default: assert_not_reached ();
-       }
-}
-EOF
-
-cat $SOURCEFILES >> main.vala
-
-if $VALAC $VALAFLAGS -o test$EXEEXT $([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") main.vala &>log; then
-       echo -e "\033[0;32mOK\033[m"
-else
-       echo -e "\033[0;31mFAIL\033[m"
-       cat log
-
-       cd $builddir
-       exit 1
-fi
+echo -e "\033[0;33mDONE\033[m"
 
 if bash checkall; then
        cd $builddir