Tests are not terminated when they fail in trap
authorMaciej Piechotka <uzytkownik2@gmail.com>
Tue, 29 Sep 2009 06:01:01 +0000 (08:01 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 2 Apr 2010 20:11:46 +0000 (22:11 +0200)
When code in trap succeeds subprocess should be terminated - not only
test case.

Fixes bug 596703.

tests/Makefile.am
tests/testlist.vala
tests/testmap.vala
tests/testreadonlycollection.vala
tests/testreadonlylist.vala
tests/testreadonlymap.vala
tests/testsortedset.vala

index 343859a..7976bb4 100644 (file)
@@ -49,7 +49,7 @@ tests_DEPENDENCIES = $(top_srcdir)/gee/gee-1.0.vapi
 
 tests_SOURCES = tests.vala.stamp $(tests_VALASOURCES:.vala=.c)
 tests.vala.stamp: $(tests_VALASOURCES)
-       $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 $^
+       $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 --pkg posix $^
        touch $@
 tests_LDADD = $(progs_ldadd)
 EXTRA_DIST += $(tests_VALASOURCES)
index 2d8d7a9..48ca387 100644 (file)
@@ -188,7 +188,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.get (0);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -200,7 +200,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.get (1);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -208,7 +208,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.get (-1);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -225,7 +225,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.get (0);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
        }
@@ -241,7 +241,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.set (0, "zero");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (test_list.size == 0);
@@ -260,7 +260,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.set (1, "zero");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (test_list.size == 1);
@@ -277,7 +277,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.insert (1, "zero");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -302,7 +302,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.insert (4, "four");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -317,7 +317,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.insert (-1, "zero");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
        }
@@ -332,14 +332,14 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.remove_at (0);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.remove_at (1);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -376,7 +376,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.remove_at (2);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -384,7 +384,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.remove_at (-1);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
        }
@@ -424,7 +424,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.first ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -445,7 +445,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.first ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
        }
@@ -460,7 +460,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.last ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -481,7 +481,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.last ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
        }
@@ -536,7 +536,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_list.insert_all (1, dummy);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -635,7 +635,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        dummy = test_list.slice (1, 4);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -660,7 +660,7 @@ public abstract class ListTests : CollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        dummy = test_list.slice (0, 9);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
        }
index 8a0a38b..65ac245 100644 (file)
@@ -182,7 +182,7 @@ public abstract class MapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (! keys.add ("three"));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                Test.trap_assert_stderr ("*code should not be reached*");
@@ -221,7 +221,7 @@ public abstract class MapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (! values.add ("two"));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                Test.trap_assert_stderr ("*code should not be reached*");
@@ -260,7 +260,7 @@ public abstract class MapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (! entries.add (new TestEntry<string,string> ("two", "value_of_two")));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                Test.trap_assert_stderr ("*code should not be reached*");
index 7ee6417..510a925 100644 (file)
@@ -100,7 +100,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.remove ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -121,7 +121,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_collection.add ("two"));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_collection.size == 1);
@@ -130,7 +130,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_collection.clear ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_collection.size == 1);
@@ -139,7 +139,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_collection.remove ("one"));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_collection.size == 1);
@@ -148,7 +148,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_collection.add_all (dummy));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_collection.size == 1);
@@ -157,7 +157,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_collection.remove_all (dummy));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_collection.size == 1);
@@ -167,7 +167,7 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_collection.retain_all (dummy));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_collection.size == 1);
index f10d0f6..d1b2220 100644 (file)
@@ -90,7 +90,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.remove ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 2);
@@ -101,7 +101,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.set ("three");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 2);
@@ -112,7 +112,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.insert ("three");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 2);
@@ -123,7 +123,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.add ("three");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 2);
@@ -147,7 +147,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_list.set (0, "two");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 1);
@@ -156,7 +156,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_list.insert (1, "two");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 1);
@@ -165,7 +165,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_list.remove_at (1);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 1);
@@ -174,7 +174,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_list.insert_all (1, dummy);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 1);
@@ -183,7 +183,7 @@ public class ReadOnlyListTests : ReadOnlyCollectionTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_list.sort ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_list.size == 1);
index e33b509..c32f763 100644 (file)
@@ -93,7 +93,7 @@ public class ReadOnlyMapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.remove ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -117,7 +117,7 @@ public class ReadOnlyMapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_map.set ("two", "two");
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_map.size == 1);
@@ -127,7 +127,7 @@ public class ReadOnlyMapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_map.clear ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_map.size == 1);
@@ -137,7 +137,7 @@ public class ReadOnlyMapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_map.unset ("one"));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_map.size == 1);
@@ -147,7 +147,7 @@ public class ReadOnlyMapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        ro_map.set_all (dummy);
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_map.size == 1);
@@ -157,7 +157,7 @@ public class ReadOnlyMapTests : Gee.TestCase {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        assert (ro_map.unset_all (dummy));
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
                assert (ro_map.size == 1);
index c13d9c2..a5172b4 100644 (file)
@@ -100,7 +100,7 @@ public abstract class SortedSetTests : SetTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_set.first ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -120,7 +120,7 @@ public abstract class SortedSetTests : SetTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        test_set.last ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -337,7 +337,7 @@ public abstract class SortedSetTests : SetTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.remove ();
-                       return;
+                       Posix.exit (0);
                }
                Test.trap_assert_failed ();
 
@@ -350,7 +350,7 @@ public abstract class SortedSetTests : SetTests {
                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                       TestTrapFlags.SILENCE_STDERR)) {
                        iterator.get ();
-                       return;
+                       Posix.exit (0);
                }
                assert (!iterator.previous ());
 
@@ -645,7 +645,7 @@ public abstract class SortedSetTests : SetTests {
                                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                                       TestTrapFlags.SILENCE_STDERR)) {
                                        iter.remove ();
-                                       return;
+                                       Posix.exit (0);
                                }
                                Test.trap_assert_failed ();
                        }
@@ -715,11 +715,13 @@ public abstract class SortedSetTests : SetTests {
                                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                                       TestTrapFlags.SILENCE_STDERR)) {
                                        subset.first ();
+                                       Posix.exit (0);
                                }
                                Test.trap_assert_failed ();
                                if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
                                                       TestTrapFlags.SILENCE_STDERR)) {
                                        subset.last ();
+                                       Posix.exit (0);
                                }
                                Test.trap_assert_failed ();
                                break;