Subject: bug#58984: 29.0.50; M-x compile misinterprets libcheck error message format

From: "Basil L. Contovounesios" <[email-masked]>
Date: Fri, 04 Nov 2022 19:08:04 +0200

Mattias Engdegård [2022-11-04 12:30 +0100] wrote:

> Is this bug conditional on the patches you mentioned?

Yes, but only inasmuch as the tests did not compile previously.  Both
referenced patches are in now, so anyone who has Check installed (in
Debian the package is called... -moments pass- ...'check') should be
able to run the tests and play with their output.

> Can the bug be reproduced from a simple text file that, when presented in
> compilation-mode, results in the incorrect behaviour?

Like this compile log, for instance?

-*- mode: compilation; default-directory: "~/.local/src/emacs-check/test/manual/noverlay/" -*-
Compilation started at Fri Nov  4 19:00:15

make
gcc -O0 -g3 -pthread -I ../../../src  -c -o itree-tests.o itree-tests.c
gcc   itree-tests.o  -lcheck_pic -pthread -lrt -lm -lsubunit -lm -o itree-tests
./itree-tests
Running suite(s): basic
../../../src/itree.c:1359:eassert condition failed: g && g->running
92%: Checks: 51, Failures: 3, Errors: 1
itree-tests.c:71:F:insert1:test_insert_1:0: Assertion 'N_50.red' failed
itree-tests.c:91:F:insert1:test_insert_2:0: Assertion 'N_50.right != NULL' failed: N_50.right == 0
itree-tests.c:740:F:remove3:test_remove_10:0: Assertion 'tree.size != 0' failed: tree.size == 0, 0 == 0
itree-tests.c:749:E:generator:test_generator_1:0: (after this point) Early exit with return value 1
make: *** [Makefile:36: check] Error 1

Compilation exited abnormally with code 2 at Fri Nov  4 19:00:16

I got it from applying this diff:

diff --git a/test/manual/noverlay/Makefile.in b/test/manual/noverlay/Makefile.in
index 3c8dba1ce1..c0fa705174 100644
--- a/test/manual/noverlay/Makefile.in
+++ b/test/manual/noverlay/Makefile.in
@@ -33,7 +33,7 @@ .PHONY:
 all: check
 
 check: $(PROGRAM)
-	./check-sanitize.sh ./$(PROGRAM)
+	./$(PROGRAM)
 
 itree-tests.o: emacs-compat.h $(top_srcdir)/src/itree.c $(top_srcdir)/src/itree.h
 
diff --git a/test/manual/noverlay/itree-tests.c b/test/manual/noverlay/itree-tests.c
index 278e65f9bf..e3cbaffb0f 100644
--- a/test/manual/noverlay/itree-tests.c
+++ b/test/manual/noverlay/itree-tests.c
@@ -68,8 +68,8 @@ START_TEST (test_insert_1)
    */
 
   interval_tree_insert (&tree, &N_50);
-  ck_assert (! N_50.red);
-  ck_assert_ptr_eq (&N_50, tree.root);
+  ck_assert (N_50.red);
+  ck_assert_ptr_ne (&N_50, tree.root);
 }
 END_TEST
 
@@ -88,7 +88,7 @@ START_TEST (test_insert_2)
   ck_assert_ptr_eq (&N_50, tree.root);
   ck_assert_ptr_eq (N_30.parent, &N_50);
   ck_assert_ptr_eq (N_50.left, &N_30);
-  ck_assert_ptr_null (N_50.right);
+  ck_assert_ptr_nonnull (N_50.right);
   ck_assert_ptr_null (N_30.left);
   ck_assert_ptr_null (N_30.right);
 }
@@ -737,7 +737,7 @@ START_TEST (test_remove_10)
       itree_remove (&tree, &nodes[index[i]]);
     }
   ck_assert_ptr_null (tree.root);
-  ck_assert_int_eq (tree.size, 0);
+  ck_assert_int_ne (tree.size, 0);
 }
 END_TEST
 
@@ -749,11 +749,11 @@ START_TEST (test_remove_10)
 START_TEST (test_generator_1)
 {
   struct itree_node node, *n;
-  struct itree_iterator *g;
+  struct itree_iterator *g = NULL;
   interval_tree_init (&tree);
 
   itree_insert (&tree, &node, 10, 20);
-  g = itree_iterator_start (&tree, 0, 30, ITREE_ASCENDING, NULL, 0);
+  /* g = itree_iterator_start (&tree, 0, 30, ITREE_ASCENDING, NULL, 0); */
   n = itree_iterator_next (g);
   ck_assert_ptr_eq (n, &node);
   ck_assert_int_eq (n->begin, 10);

Then building Emacs and finally running 'make' in the
test/manual/noverlay directory.

> If not, what about a simple script that emits the text piecemeal with the
> correct timing for the bug to occur and that can be run in M-x compile?

Let me know if the information above is insufficient and I will try
providing such a script.

> (Not really going to OCR your screenshots to extract the text myself!)

Sorry, that was just an attempt to convey fontification :).

Thanks,

-- 
Basil