chiark / gitweb /
test: only use assert_se in test_raw_clone
authorFilipe Brandenburger <filbranden@google.com>
Tue, 23 Dec 2014 18:14:46 +0000 (10:14 -0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 25 Dec 2014 16:55:12 +0000 (11:55 -0500)
The asserts used in the tests should never be allowed to be optimized away.

src/test/test-util.c

index 222af9a73a75c0e3ccdbaa8986d622140ebea412..57fd19b2a31ace097cb90fcbcf2e7cb73c091a5a 100644 (file)
@@ -420,7 +420,7 @@ static void check(const char *test, char** expected, bool trailing) {
                 printf("<%s>\n", t);
         }
         printf("<<<%s>>>\n", state);
                 printf("<%s>\n", t);
         }
         printf("<<<%s>>>\n", state);
-        assert(expected[i] == NULL);
+        assert_se(expected[i] == NULL);
         assert_se(isempty(state) == !trailing);
 }
 
         assert_se(isempty(state) == !trailing);
 }
 
@@ -1331,15 +1331,15 @@ static void test_raw_clone(void) {
         assert_se(raw_getpid() == parent);
 
         pid = raw_clone(0, NULL);
         assert_se(raw_getpid() == parent);
 
         pid = raw_clone(0, NULL);
-        assert(pid >= 0);
+        assert_se(pid >= 0);
 
         pid2 = raw_getpid();
         log_info("raw_clone: "PID_FMT" getpid()→"PID_FMT" raw_getpid()→"PID_FMT,
                  pid, getpid(), pid2);
         if (pid == 0)
 
         pid2 = raw_getpid();
         log_info("raw_clone: "PID_FMT" getpid()→"PID_FMT" raw_getpid()→"PID_FMT,
                  pid, getpid(), pid2);
         if (pid == 0)
-                assert(pid2 != parent);
+                assert_se(pid2 != parent);
         else
         else
-                assert(pid2 == parent);
+                assert_se(pid2 == parent);
 }
 
 int main(int argc, char *argv[]) {
 }
 
 int main(int argc, char *argv[]) {