tests: Add more sanity test to make sure we catch different failure modes
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 19 Apr 2012 16:37:40 +0000 (12:37 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 19 Apr 2012 16:37:40 +0000 (12:37 -0400)
tests/sanity-test.c

index 90e55ff..f2abe42 100644 (file)
 
 #include <stdlib.h>
 #include <assert.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <unistd.h>
+
 #include "test-runner.h"
 #include "../src/wayland-util.h"
 
+TEST(empty)
+{
+}
+
+TEST(exit_success)
+{
+       exit(EXIT_SUCCESS);
+}
+
+FAIL_TEST(exit_failure)
+{
+       exit(EXIT_FAILURE);
+}
+
+FAIL_TEST(fail_abort)
+{
+       abort();
+}
+
+FAIL_TEST(fail_kill)
+{
+       kill(getpid(), SIGTERM);
+}
+
+FAIL_TEST(fail_segv)
+{
+       * (char **) 0 = "Goodbye, world";
+}
+
 FAIL_TEST(sanity_assert)
 {
        /* must fail */