aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-workers)
  #:use-module (guix workers)
  #:use-module (ice-9 threads)
  #:use-module (srfi srfi-64))

(test-begin "workers")

(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))

;; Same as above, but throw exceptions within the workers and make sure they
;; remain alive.
(test-equal "exceptions"
  4242
  (let* ((pool   (make-pool 10))
         (result 0)
         (1+!    (let ((lock (make-mutex)))
                   (lambda ()
                     (with-mutex lock
                       (set! result (+ result 1)))))))
    (let loop ((i 10))
      (unless (zero? i)
        (pool-enqueue! pool (lambda ()
                              (throw 'whatever)))
        (loop (- i 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))

(test-end)
>gnu: Syncthing: Update to 1.20.3....* gnu/packages/syncthing.scm (syncthing): Update to 1.20.3. Leo Famulari 2022-06-29gnu: Syncthing: Update to 1.20.2....* gnu/packages/syncthing.scm (syncthing): Update to 1.20.2. Leo Famulari 2022-05-31gnu: Remove python2-setuptools....* gnu/packages/python-xyz.scm (python2-setuptools): Delete variable. (python-setuptools)[properties]: Delete field. * gnu/packages/syncthing.scm (syncthing-gtk): Delete commented native input. * guix/lint.scm (check-inputs-should-not-be-an-input-at-all): Remove obsolete entries. Maxim Cournoyer 2022-05-14gnu: Syncthing: Update to 1.20.1....* gnu/packages/syncthing.scm (syncthing): Update to 1.20.1. Leo Famulari 2022-03-05gnu: Syncthing: Update to 1.19.1....* gnu/packages/syncthing.scm (syncthing): Update to 1.19.1. Leo Famulari 2022-02-09gnu: QSyncthingTray: Deprecate in favor of Debian's syncthing-gtk fork....This package is abandoned upstream and depends on the insecure and abandoned QtWebKit. Upstream abandonment: https://github.com/sieren/QSyncthingTray/issues/247 See <https://issues.guix.gnu.org/53289> for more information about this change * gnu/packages/sync.scm (qsyncthingtray): Move this variable ... * gnu/packages/syncthing.scm (qsyncthingtray): ... to here. And make it into a deprecated-package that points to syncthing-gtk. Leo Famulari 2022-02-02gnu: Syncthing: Update to 1.19.0....* gnu/packages/syncthing.scm (syncthing): Update to 1.19.0. Leo Famulari 2022-02-02gnu: syncthing: Add release-monitoring-url....* gnu/packages/syncthing.scm (syncthing)[properties]: New field. Efraim Flashner 2022-01-17Merge branch 'version-1.4.0'...With resolved conflicts in: gnu/packages/gnome.scm gnu/packages/openstack.scm gnu/packages/python-xyz.scm Maxim Cournoyer 2022-01-10gnu: go-github-com-prometheus-common: Remove obsolete phase....* gnu/packages/syncthing.scm (go-github-com-prometheus-common) [arguments]<#:phases>: Remove 'make-gzip-archive-writable phase. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Sarah Morgensen 2022-01-12gnu: Syncthing: Update to 1.18.6....* gnu/packages/syncthing.scm (syncthing): Update to 1.18.6. Leo Famulari 2022-01-05gnu: syncthing-gtk: Make the autostart mechanism invoke the correct executable....Fixes <https://issues.guix.gnu.org/50789>. * gnu/packages/syncthing.scm (syncthing-gtk)[arguments]: Add a 'fix-autostart-path' phase. John Kehayias 2021-12-31gnu: go-github-com-go-ldap-ldap: Update to 3.4.1....* gnu/packages/syncthing.scm (go-github-com-go-ldap-ldap): Update to 3.4.1. [propagated-inputs]: Add go-github-com-azure-go-ntlmssp. Efraim Flashner 2021-12-31gnu: Add go-github-com-azure-go-ntlmssp.... gnu/packages/syncthing.scm (go-github-com-azure-go-ntlmssp): New variable. Efraim Flashner 2021-12-31gnu: go-github-com-go-asn1-ber-asn1-ber: Update to 1.5.3....* gnu/packages/syncthing.scm (go-github-com-go-asn1-ber-asn1-ber): Update to 1.5.3. Efraim Flashner