;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Eric Bavier ;;; ;;; 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 . (define-module (gnu packages ci) #:use-module ((guix licenses) #:prefix l:) #:use-module (gnu packages) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (gnu packages autotools) #:use-module (gnu packag
aboutsummaryrefslogtreecommitdiff
blob: 44b882f69166d8cf7eaa7fa5839962ee3e90ff20 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; 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))

(test-end)
h-docbook-xsl=" docbook "/xml/xsl/docbook-xsl-" ,(package-version docbook-xsl)) (string-append "--docdir=" %output "/doc/hydra-" ,version))) #:phases (modify-phases %standard-phases (add-after 'unpack 'bootstrap (lambda _ (zero? (system* "autoreconf" "-vfi")))) (add-before 'check 'check-setup (lambda _ (setenv "LOGNAME" "test.log"))) (add-after 'install 'wrap-program (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (for-each (lambda (file) (wrap-program file `("PATH" ":" prefix (,(string-append out "/bin") ,@(map (lambda (i) (string-append (assoc-ref inputs i) "/bin")) '("subversion" "git" "bazaar" "mercurial" "coreutils" "gzip" "sed" "unzip" "nix")))) `("PERL5LIB" ":" prefix (,(string-append out "/libexec/hydra/lib") ,@(search-path-as-string->list (getenv "PERL5LIB")))) `("HYDRA_RELEASE" = (,,version)) `("HYDRA_HOME" = (,(string-append out "/libexec/hydra"))) `("NIX_RELEASE" = (,,(package-version nix))))) (find-files (string-append out "/bin") ".*")))))))) (home-page "https://nixos.org/hydra") (synopsis "Continuous build system") (description "Hydra is a tool for continuous integration testing and software release that uses a purely functional language to describe build jobs and their dependencies.") (license l:gpl3+))))