Commit e06808d9892911ea9b4102d15688a088945a3c53

Thomas de Grivel 2023-02-02T23:17:40

fix tests

diff --git a/libc3/c3.c b/libc3/c3.c
index 87aa10b..f0b8e22 100644
--- a/libc3/c3.c
+++ b/libc3/c3.c
@@ -24,20 +24,12 @@ void c3_init (s_env *env)
     env = &g_c3_env;
   if (! env_init(env))
     exit(1);
-#ifdef DEBUG
-  buf_init_alloc(&g_debug_buf, 1024);
-  buf_file_open_w(&g_debug_buf, stderr);
-#endif
 }
 
 void c3_clean (s_env *env)
 {
   if (! env)
     env = &g_c3_env;
-#ifdef DEBUG
-  buf_file_close(&g_debug_buf);
-  buf_clean(&g_debug_buf);
-#endif
-  sym_delete_all();
   env_clean(env);
+  sym_delete_all();
 }
diff --git a/libc3/env.c b/libc3/env.c
index 66c88b2..4e30744 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -35,6 +35,12 @@ void env_clean (s_env *env)
   frame_delete_all(env->frame);
   error_handler_delete_all(env->error_handler);
   facts_clean(&env->facts);
+  buf_file_close(&env->in);
+  buf_clean(&env->in);
+  buf_file_close(&env->out);
+  buf_clean(&env->out);
+  buf_file_close(&env->err);
+  buf_clean(&env->err);
 }
 
 void env_error_f (s_env *env, const char *fmt, ...)
@@ -236,12 +242,14 @@ s_module * env_module_load (s_env *env, s_module *module,
   module->facts = facts;
   if (! module_name_path(&env->module_path, name, &path))
     return 0;
+  /*
   buf_write_1(&env->out, "module_load ");
   buf_write_str(&env->out, &name->str);
   buf_write_1(&env->out, " -> ");
   buf_write_str(&env->out, &path);
   buf_write_s8(&env->out, '\n');
   buf_flush(&env->out);
+  */
   if (facts_load_file(facts, path.ptr.ps8) < 0)
     return 0;
   return module;
diff --git a/test/ic3_test b/test/ic3_test
index 83ad141..ce6f9c0 100755
--- a/test/ic3_test
+++ b/test/ic3_test
@@ -38,15 +38,15 @@ for TARGET in $TARGETS; do
     RESULT=test_ok
     $IC3 < ${TARGET}.in > ${TARGET}.out 2> ${TARGET}.err
     echo $? > ${TARGET}.ret
-    if ! diff -u ${TARGET}.out.expected ${TARGET}.out > ${TARGET}.diff
+    if ! diff -au ${TARGET}.out.expected ${TARGET}.out > ${TARGET}.diff
     then
         RESULT=test_ko
     fi
-    if ! diff -u ${TARGET}.err.expected ${TARGET}.err >> ${TARGET}.diff
+    if ! diff -au ${TARGET}.err.expected ${TARGET}.err >> ${TARGET}.diff
     then
         RESULT=test_ko
     fi
-    if ! diff -u ${TARGET}.ret.expected ${TARGET}.ret >> ${TARGET}.diff
+    if ! diff -au ${TARGET}.ret.expected ${TARGET}.ret >> ${TARGET}.diff
     then
         RESULT=test_ko
     fi