unit-tests: Make fixture functions optional
authorTobias Brunner <tobias@strongswan.org>
Tue, 20 May 2014 17:27:50 +0000 (19:27 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 19 Jun 2014 12:00:48 +0000 (14:00 +0200)
src/libstrongswan/tests/test_runner.c

index 443c0ae..8f2e985 100644 (file)
@@ -187,11 +187,17 @@ static bool call_fixture(test_case_t *tcase, bool up)
                {
                        if (up)
                        {
-                               fixture->setup();
+                               if (fixture->setup)
+                               {
+                                       fixture->setup();
+                               }
                        }
                        else
                        {
-                               fixture->teardown();
+                               if (fixture->teardown)
+                               {
+                                       fixture->teardown();
+                               }
                        }
                }
                else