[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28779: tests/workers.scm failure
From: |
Eric Bavier |
Subject: |
bug#28779: tests/workers.scm failure |
Date: |
Fri, 17 Nov 2017 02:58:12 +0000 |
Looks good to me.
Thanks,
Eric Bavier, Scientific Libraries, Cray Inc.
________________________________________
From: Ludovic Courtès <address@hidden>
Sent: Thursday, November 16, 2017 02:29
To: Eric Bavier
Cc: address@hidden
Subject: Re: bug#28779: tests/workers.scm failure
Hi Eric,
Eric Bavier <address@hidden> skribis:
> test-name: enqueue
> location: /home/users/bavier/src/guix/tests/workers.scm:26
> source:
> + (test-equal
> + "enqueue"
> + 4242
> + (let* ((pool (make-pool))
> + (result 0)
> + (#{1+!}# (let ((lock (make-mutex)))
> + (lambda ()
> + (with-mutex lock (set! result (+ result 1)))))))
> + (let loop ((i 4242))
> + (unless
> + (zero? i)
> + (pool-enqueue! pool #{1+!}#)
> + (loop (- i 1))))
> + (let poll ()
> + (unless
> + (pool-idle? pool)
> + (pk 'busy result)
> + (sleep 1)
> + (poll)))
> + result))
> expected-value: 4242
> actual-value: 4241
> result: FAIL
>
>
> To me the reason seems to be that the 'pool-idle? procedure indicates whether
> or not the task queue is empty, not whether all tasks have completed
> execution, so the poll loop exits before all 1+! updates are finished and the
> test fails.
Indeed, good catch.
The attached patch is a bit crude but it should fix the problem.
Thoughts?
Thanks,
Ludo’.