Blob Blame History Raw
From 3298a5520d5ac4ec331b0b3b7a2211d4d94172cf Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 12 Aug 2015 13:16:28 +0200
Subject: [PATCH] test-limits: improve test without target

When there is no target available, the unit test would fail with a
non-fatal error (because emulation would be done). The non-fatal error
would however not be overwritten by the real error when we exceed the
limits.

First relax the first compilation test to check for FATAL errors. Then
reset the program (and clear any non-fatal errors) before triggering
the next error.
---
 testsuite/test-limits.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testsuite/test-limits.c b/testsuite/test-limits.c
index ed19d8a..0e43924 100644
--- a/testsuite/test-limits.c
+++ b/testsuite/test-limits.c
@@ -35,9 +35,11 @@ test_simple (int max, int (*adder) (OrcProgram *, int, const char *))
   for (v = 0; v < max; v++)
     (*adder) (p, 2, names + v);
   result = orc_program_compile (p);
-  if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL (result))
+  if (ORC_COMPILE_RESULT_IS_FATAL (result))
     error = TRUE;
 
+  orc_program_reset (p);
+
   /* Check we can not add one more */
   (*adder) (p, 2, names + v);
   result = orc_program_compile (p);
-- 
2.4.3