aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2018, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.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 (gnu tests dict)
  #:use-module (gnu tests)
  #:use-module (gnu system)
  #:use-module (gnu system nss)
  #:use-module (gnu system vm)
  #:use-module (gnu services)
  #:use-module (gnu services dict)
  #:use-module (gnu services networking)
  #:use-module (gnu packages wordnet)
  #:use-module (guix gexp)
  #:use-module (guix store)
  #:use-module (guix packages)
  #:use-module (guix modules)
  #:export (%test-dicod))

(define %dicod-os
  (simple-operating-system
   (service dhcp-client-service-type)
   (service dicod-service-type
            (dicod-configuration
             (interfaces '("0.0.0.0"))
             (handlers (list (dicod-handler
                              (name "wordnet")
                              (module "dictorg")
                              (options
                               ;; XXX: Not useful since WordNet does not
                               ;; provide DICT-formatted data?
                               (list #~(string-append "dbdir=" #$wordnet))))))
             (databases (list (dicod-database
                               (name "wordnet")
                               (complex? #t)
                               (handler "wordnet")
                               (options '("database=wn")))
                              %dicod-database:gcide))))))

(define* (run-dicod-test)
  "Run tests of 'dicod-service-type'."
  (define os
    (marionette-operating-system
     %dicod-os
     #:imported-modules
     (source-module-closure '((gnu services herd)))))

  (define vm
    (virtual-machine
     (operating-system os)
     (port-forwardings '((8000 . 2628)))
     (memory-size 1024)))

  (define test
    (with-imported-modules '((gnu build marionette))
      #~(begin
          (use-modules (ice-9 rdelim)
                       (ice-9 regex)
                       (srfi srfi-64)
                       (gnu build marionette))
          (define marionette
            ;; Forward the guest's DICT port to local port 8000.
            (make-marionette (list #$vm)))

          (define %dico-socket
            (socket PF_INET SOCK_STREAM 0))

          (test-runner-current (system-test-runner #$output))
          (test-begin "dicod")

          ;; Wait for the service to be started.
          (test-assert "service is running"
            (marionette-eval
             '(begin
                (use-modules (gnu services herd))
                (start-service 'dicod))
             marionette))

          ;; Wait until dicod is actually listening.
          ;; TODO: Use a PID file instead.
          (test-assert "connect inside"
            (wait-for-tcp-port 2628 marionette))

          (test-assert "connect"
            (let ((addr (make-socket-address AF_INET INADDR_LOOPBACK 8000)))
              (connect %dico-socket addr)
              (read-line %dico-socket 'concat)))

          (test-equal "CLIENT"
            "250 ok\r\n"
            (begin
              (display "CLIENT \"GNU Guile\"\r\n" %dico-socket)
              (read-line %dico-socket 'concat)))

          (test-assert "DEFINE"
            (begin
              (display "DEFINE ! hello\r\n" %dico-socket)
              (display "QUIT\r\n" %dico-socket)
              (let ((result (read-string %dico-socket)))
                (and (string-contains result "gcide")
                     (string-contains result "hello")
                     result))))

          (test-end))))

  (gexp->derivation "dicod" test))

(define %test-dicod
  (system-test
   (name "dicod")
   (description "Connect to the dicod DICT server.")
   (value (run-dicod-test))))
efine package. [source]: Remove trailing #t from snippet field and improve regexp. [phases]: Use gexps. Maxim Cournoyer 2022-09-27gnu: opendjk11: Reduce size by removing extraneous files....By removing the *.diz and src.zip files, the size of the main output of OpenJDK 11 is reduced from 345 MiB to 116 MiB for OpenJDK 11, while the 'jdk' output is reduced from 805 MiB to 353 MiB. * gnu/packages/java.scm (openjdk11)[modules]: New field. [phases]{remove-diz-files}: New phase. {strip-character-data-timestamps}: Order after remove-diz-files. Maxim Cournoyer 2022-09-27gnu: opendjk11: Improve regular expressions....* gnu/packages/java.scm (openjdk11) [phases]{strip-archive-timestamps}: Replace '.*.' with '\\.' in regexps. Maxim Cournoyer 2022-09-27gnu: opendjk11: Remove input labels....* gnu/packages/java.scm (openjdk11)[inputs, native-inputs]: Remove labels. Maxim Cournoyer 2022-09-27gnu: opendjk11: Remove trailing #t and use gexps....* gnu/packages/java.scm (openjdk11): Properly punctuate comments. [source]: Remove trailing #t in snippet. [configure-flags]: Use gexps and this-package-input. [phases]: Delete trailing #t and use gexps to refer to outputs. Maxim Cournoyer 2022-09-19gnu: Add java-argparse4j....* gnu/packages/java.scm (java-argparse4j): New variable. Signed-off-by: Julien Lepiller <julien@lepiller.eu> Artyom V. Poptsov 2022-09-16gnu: antlr4: Update to 4.10.1....* gnu/packages/java.scm (java-antlr4-runtime): Update to 4.10.1. [source](patches): Remove obsolete patch. (java-antlr4-runtime-cpp): Add #:configure-flags. (antlr4)[arguments]: Don't run tests from removed directory. Enable one test; exclude one file. * gnu/packages/fontutils.scm (python-afdko)[arguments]: Add phase to build with the C++ 17 standard. Marius Bakke 2022-09-14gnu: Add java-slf4j-nop....* gnu/packages/java.scm (java-slf4j-nop): New variable. Signed-off-by: Christopher Baines <mail@cbaines.net> Artyom V. Poptsov 2022-09-11gnu: java-slf4j-api: Update the source URI....* gnu/packages/java.scm (java-slf4j-api)[source]: Replace the URI with "git-reference" to GitHub as the origin reference to "https://www.slf4j.org/dist/slf4j-..." seems to be broken. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Artyom V. Poptsov 2022-09-10gnu: Add comments to the bottom of a few package modules....This will hopefully discourage patches which add new packages to the bottom of files, as this increases the likelihood of conflicts when applying patches. If there are more specific ways that packages should be arranged in specific modules, this message can be updated accordingly. * gnu/packages/bioconductor.scm: Add comment discouraging adding packages to the bottom of the file. * gnu/packages/bioinformatics.scm: ditto. * gnu/packages/cran.scm: ditto. * gnu/packages/crates-io.scm: ditto. * gnu/packages/emacs-xyz.scm: ditto. * gnu/packages/golang.scm: ditto. * gnu/packages/guile-xyz.scm: ditto. * gnu/packages/haskell-xyz.scm: ditto. * gnu/packages/java.scm: ditto. * gnu/packages/julia-xyz.scm: ditto. * gnu/packages/lisp-xyz.scm: ditto. * gnu/packages/ocaml.scm: ditto. * gnu/packages/perl.scm: ditto. * gnu/packages/python-science.scm: ditto. * gnu/packages/python-xyz.scm: ditto. * gnu/packages/ruby.scm: ditto. * gnu/packages/tex.scm: ditto. Christopher Baines 2022-08-17gnu: openjdk: Add a variable tracking the latest openjdk package....* gnu/packages/java.scm (openjdk): New variable. Maxim Cournoyer 2022-07-03gnu: abcl: Update to 1.9.0....* gnu/packages/java.scm (abcl): Update to 1.9.0. * gnu/packages/patches/abcl-fix-build-xml.patch: Update for 1.9.0. Pierre Neidhardt 2022-07-03gnu: abcl: Fix loading of cl-* packages....* gnu/packages/java.scm (abcl)[native-search-paths]: Add XDG_DATA_DIRS where to cl-* libraries get installed. Pierre Neidhardt 2022-06-25gnu: Add java-commons-text....* gnu/packages/java.scm (java-commons-text): New variable. Signed-off-by: Julien Lepiller <julien@lepiller.eu> Artyom V. Poptsov 2022-06-18gnu: Add java-asm-commons....* gnu/packages/java.scm (java-asm-commons-8): New variable. Signed-off-by: Julien Lepiller <julien@lepiller.eu> Artyom V. Poptsov 2022-06-13gnu: java-commons-lang3: Update to 3.12.0...* gnu/packages/java.scm (java-commons-lang3): Update to 3.12.0. * gnu/packages/patches/java-commons-lang-fix-dependency.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Julien Lepiller <julien@lepiller.eu> Artyom V. Poptsov 2022-06-12gnu: java-plexus-component-metadata: Fix package....* gnu/packages/java.scm (java-plexus-component-metadata): Apply fix for newer jdom. Julien Lepiller 2022-06-08gnu: java-plexus-component-metadata: Fix package....* gnu/packages/java.scm (java-plexus-component-metadat): Apply fix for newer jdom. Julien Lepiller 2022-05-29gnu: openjdk: Update to 17.0.3....* gnu/packages/java.scm (openjdk17): Update to 17.0.3. Danny Milosavljevic 2022-05-12gnu: Add java-antlr4-runtime-cpp....* gnu/packages/java.scm (java-antlr4-runtime-cpp): New variable. Maxim Cournoyer 2022-05-10gnu: openjdk12: Fix build....* gnu/packages/java.scm (openjdk12)[arguments]: Override inherited 'fix-java-shebangs phase. Efraim Flashner 2022-05-09gnu: openjdk: Update to 11.0.15....* gnu/packages/java (openjdk): Update to 11.0.15. [arguments]<#:phases>[fix-java-shebangs]: Adapt phase. Danny Milosavljevic 2022-05-07gnu: openjdk17: Update to 17.0.2...* gnu/packages/java.scm (openjdk17): Update to 17.0.2. Rostislav Svoboda 2022-04-18gnu: openjdk17: Make big cursors work....* gnu/packages/java.scm (openjdk17)[source]: Add patch. Danny Milosavljevic 2022-04-18gnu: openjdk16: Make big cursors work....* gnu/packages/java.scm (openjdk16)[source]: Add patch. Danny Milosavljevic 2022-04-18gnu: openjdk15: Make big cursors work....* gnu/packages/patches/openjdk-15-xcursor-no-dynamic.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/java.scm (openjdk15)[source]: Add it. Danny Milosavljevic 2022-02-05gnu: maven: Update to 3.8.4....* gnu/packages/maven.scm (maven-pom): Update to 3.8.4. (maven-resolver-api): Update to 1.6.3. * gnu/packages/java.scm (java-modello-core): Update to 1.11. Julien Lepiller 2022-02-05gnu: maven-enforcer-api: Update to 3.0.0....* gnu/packages/maven.scm (maven-enforcer-api): Update to 3.0.0. * gnu/packages/java.scm (java-bsh): Do not patch pom file anymore. Julien Lepiller 2022-02-05gnu: java-plexus-container-default-bootstrap: Update to 2.1.0....* gnu/packages/java.scm (java-plexus-container-default-bootstrap): Update to 2.1.0. (java-plexus-container-default-1.7, java-plexus-containers-parent-pom-1.7) (java-plexus-component-annotations-1.7, java-plexus-component-metadata-1.7): New variables. Julien Lepiller 2022-02-05gnu: java-eclipse-sisu-plexus: Update to 0.3.5....* gnu/packages/java.scm (java-eclipse-sisu-plexus): Update to 0.3.5. Julien Lepiller 2022-02-05gnu: java-eclipse-sisu-inject: Update to 0.3.5....* gnu/packages/java.scm (java-eclipse-sisu-inject): Update to 0.3.5. Julien Lepiller 2022-02-05gnu: java-jsr250: Use proper source....Sources from maven.org are autogenerated, not actual sources. * gnu/packages/java.scm (java-jsr250)[source]: Use git repository. * gnu/packages/maven.scm (maven-embedder): Fix pom to use it. Julien Lepiller 2022-02-05gnu: java-plexus-sec-dispatcher: Update to 2.0....* gnu/packages/java.scm (java-plexus-sec-dispatcher): Update to 2.0. (java-plexus-sec-dispatcher-1.4): New variable. Julien Lepiller 2022-02-05gnu: java-plexus-cipher: Update to 2.0....* gnu/packages/java.scm (java-plexus-cipher): Update to 2.0. (java-plexus-cipher-1.7): New variable. Julien Lepiller 2022-02-05gnu: Add java-plexus-build-api....This is the proper name for java-sisu-build-api. * gnu/packages/java.scm (java-sisu-build-api): Rename to... (java-plexus-build-api): ...this. [source]: Use new source repository. Julien Lepiller 2022-02-05gnu: java-plexus-utils: Default to the newer one....* gnu/packages/java.scm (java-plexus-utils-3.3.0): Rename to... (java-plexus-utils): ...this. (java-plexus-utils-3.2.1): New variable. Julien Lepiller 2022-02-05gnu: java-commons-codec: Use latest commons parent....* gnu/packages/java.scm (java-commons-codec)[propagated-inputs]: Fix commons parent version. Julien Lepiller 2022-01-31gnu: java-log4j-api: Update to 2.17.1....* gnu/packages/java.scm (java-log4j-api): Update to 2.17.1. Julien Lepiller