Ludovic,

I note that a few years ago you relaxed these tests to “(throw
'unresolved)” due to the problems with testing garbage collection.

If you have time, please briefly review my comments below, and whether
it is sane to also relax these tests in Debian's guile-1.6 package (see
attached).  I will also be investigating this further to confirm that
guardians are working as expected with this version.

Regards

Andreas Beckmann <deb...@abeckmann.de> wrote:
> guile-1.6 does FTBFS on i386 and kfreebsd-i386 (but not hurd-i386) with
> a testsuite failure, see
> https://buildd.debian.org/status/package.php?p=guile-1.6
>
> I can reproduce this locally in a i386 pbuilder chroot on amd64.
> Previous buildd builds for kfreebsd-i386 have succeeded on different hosts, 
> but
> there haven't been any i386 buildd builds for the last 3 years, as the 
> maintainer
> builds were done on i386.
>

> FAIL: guardians.test: g1-garbage saved
> FAIL: guardians.test: g2-saved
> FAIL: guardians.test: g2-garbage saved

[Background: I am a guile user, sometimes contributor, some experience
using guardians.]

These particular tests have long had trouble passing, although this does
not strictly indicate failure.  They make some assumptions about the
order and completeness of garbage collection which (I believe) can not
actually be asserted.

This is documented in guardians.test:

;;; These tests make some questionable assumptions.
;;; - They assume that a GC will find all dead objects, so they
;;;   will become flaky if we have a generational GC.
;;; - They assume that objects won't be saved by the guardian until
;;;   they explicitly invoke GC --- in other words, they assume that GC
;;;   won't happen too often.

and this additional comment is later inserted upstream:

;;; - More generally, when a weakly referenced object doesn't disappear as
;;;   expected, it's hard to tell whether that's because of a guardian bug of
;;;   because a reference to it is being held somewhere, e.g., one some part
;;;   of the stack that hasn't been overwritten.  Thus, most tests cannot
;;;   fail, they can just throw `unresolved'.  We try hard to clear
;;;   references that may have been left on the stacks (see "clear refs left
;;;   on the stack" lines).

Another problem is that they use symbols, which are globally interned
(and thus, not garbage collected in all cases).  Upstream later changed
changed these to strings, making the tests more reliable.

In subsequent revisions, “g1-garbage saved” has been removed, and the
other two tests have been relaxed so that they result in “unresolved”
rather than failure.

The test "g1-garbage not collected yet" strongly relies on the second
assumption.  It is a poor test, even though it seems to pass ok.
Upstream has removed this test also.

The upstream changes can be seen at:
<http://git.savannah.gnu.org/gitweb/?p=guile.git;a=history;f=test-suite/tests/guardians.test;hb=HEAD>

These are relevant:

commit 6a7489ace3f07a8d190110cd1244963526c65729
Author: Ludovic Courtès <l...@gnu.org>
Date:   Sat Feb 28 16:51:19 2009 +0100

    Increase chances that `guardians.test' can be successfully run.

commit e13f1cbdffa4f333d9866d1b22cd2c9a3b17b3bd
Author: Ludovic Courtes <ludovic.cour...@laas.fr>
Date:   Sun Jun 25 22:43:20 2006 +0000

    Fixed `guardians.test' so that it does not use symbols.

commit 2924541ba0b1ec65ef377f3828333c3268e464b9
Author: Marius Vollmer <m...@zagadka.de>
Date:   Sun Jul 31 23:16:45 2005 +0000

    Adapted to new (original) semantics.  test guardingobjects multiple
    times.

> This is blocking 1.6.8-10.2 which fixes one RC bug to be ready for
> going to testing.

Given that the tests fail only on some i386 archs, it may be reasonable
to relax those tests which it makes sense to, and change the use of
symbols to strings.  See attached patch.

I will follow up after investigating more whether something is actually
broken here.  Maybe to do with other debian patches, which I have not
looked at yet.

Regards
--- a/test-suite/tests/guardians.test	2012-11-08 21:42:40.109690325 +0800
+++ b/test-suite/tests/guardians.test	2012-11-08 22:42:13.185701083 +0800
@@ -28,19 +28,21 @@
 (gc)
 
 (define g1 (make-guardian))
-(define not-g1-garbage (list 'not-g1-garbage))
+(define not-g1-garbage (list (string-copy "not-g1-garbage")))
 (g1 not-g1-garbage)
-(g1 (list 'g1-garbage))
+(g1 (list (string-copy "g1-garbage")))
 (pass-if "g1-garbage not collected yet" (equal? (g1) #f))
 (gc)
-(pass-if "g1-garbage saved" (equal? (g1) '(g1-garbage)))
+(pass-if "g1-garbage saved" (or (equal? (g1)
+					(list (string-copy "g1-garbage")))
+				(throw 'unresolved)))
 
 ;;; Who guards the guardian?
 (gc)
 (define g2 (make-guardian))
-(g2 (list 'g2-garbage))
+(g2 (list (string-copy "g2-garbage")))
 (define g3 (make-guardian))
-(g3 (list 'g3-garbage))
+(g3 (list (string-copy "g3-garbage")))
 (g3 g2)
 (pass-if "g2-garbage not collected yet" (equal? (g2) #f))
 (pass-if "g3-garbage not collected yet" (equal? (g3) #f))
@@ -54,12 +56,16 @@
       (if saved
 	  (begin
 	    (cond
-	     ((equal? saved '(g3-garbage)) (set! seen-g3-garbage #t))
+	     ((equal? saved (list (string-copy "g3-garbage")))
+	      (set! seen-g3-garbage #t))
 	     ((procedure? saved) (set! seen-g2 saved))
-	     (else (set! seen-something-else #t)))
+	     (else (pk 'junk saved) (set! seen-something-else #t)))
 	    (loop)))))
-  (pass-if "g3-garbage saved" seen-g3-garbage)
-  (pass-if "g2-saved" (procedure? seen-g2))
+  (pass-if "g3-garbage saved" (or seen-g3-garbage (throw 'unresolved)))
+  (pass-if "g2-saved" (or (procedure? seen-g2) (throw 'unresolved)))
   (pass-if "nothing else saved" (not seen-something-else))
-  (pass-if "g2-garbage saved" (and (procedure? seen-g2)
-				   (equal? (seen-g2) '(g2-garbage)))))
+  (pass-if "g2-garbage saved" (or (and (procedure? seen-g2)
+				       (equal? (seen-g2)
+					       (list (string-copy
+						      "g2-garbage"))))
+				  (throw 'unresolved))))

Reply via email to