aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 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-size)
  #:use-module (guix store)
  #:use-module (guix monads)
  #:use-module (guix packages)
  #:use-module (guix derivations)
  #:use-module (guix gexp)
  #:use-module (guix tests)
  #:use-module (guix scripts size)
  #:use-module (gnu packages)
  #:use-module (gnu packages bootstrap)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64))


(test-begin "size")

(test-assertm "store-profile"
  (mlet* %store-monad ((file1 (gexp->derivation "file1"
                                                #~(symlink #$%bootstrap-guile
                                                           #$output)))
                       (file2 (text-file* "file2"
                                          "the file => " file1)))
    (define (matching-profile item)
      (lambda (profile)
        (string=? item (profile-file profile))))

    (mbegin %store-monad
      (built-derivations (list file2))
      (mlet %store-monad ((profiles (store-profile
                                     (list (derivation->output-path file2))))
                          (bash     (interned-file
                                     (search-bootstrap-binary
                                      "bash" (%current-system)) "bash"
                                      #:recursive? #t))
                          (guile    (package->derivation %bootstrap-guile)))
        (define (lookup-profile item)
          (find (matching-profile (if (derivation? item)
                                      (derivation->output-path item)
                                      item))
                profiles))

        (letrec-syntax ((match* (syntax-rules (=>)
                                  ((_ ((drv => profile) rest ...) body)
                                   (match (lookup-profile drv)
                                     ((? profile? profile)
                                      (match* (rest ...) body))))
                                  ((_ () body)
                                   body))))
          ;; Make sure we get all three profiles with sensible values.
          (return (and (= (length profiles) 4)
                       (match* ((file1 => profile1)
                                (file2 => profile2)
                                (guile => profile3)
                                (bash  => profile4)) ;dependency of GUILE
                         (and (> (profile-closure-size profile2) 0)
                              (= (profile-closure-size profile2)
                                 (+ (profile-self-size profile1)
                                    (profile-self-size profile2)
                                    (profile-self-size profile3)
                                    (profile-self-size profile4))))))))))))

(test-assertm "store-profile with multiple items"
  (mlet* %store-monad ((file1 (gexp->derivation "file1"
                                                #~(symlink #$%bootstrap-guile
                                                           #$output)))
                       (file2 (text-file* "file2"
                                          "the file => " file1)))
    (mbegin %store-monad
      (built-derivations (list file2))
      (mlet %store-monad ((profiles  (store-profile
                                      (list (derivation->output-path file2)
                                            (derivation->output-path file1))))
                          (reference (store-profile
                                      (list (derivation->output-path file2)))))
        (return (and (= (length profiles) 4)
                     (lset= equal? profiles reference)))))))

(test-end "size")

;;; Local Variables:
;;; eval: (put 'match* 'scheme-indent-function 1)
;;; End:
d>Marius Bakke 2022-09-09gnu: QEMU: Use G-expression....* gnu/packages/virtualization.scm (qemu, qemu-minimal)[arguments]: Rewrite with G-expressions. Marius Bakke 2022-09-09gnu: QEMU: Update to 7.1.0....* gnu/packages/patches/qemu-build-info-manual.patch: Remove configure script stanza. * gnu/packages/patches/qemu-fix-agent-paths.patch: Adjust patch context. Use execl instead of execle to stay consistent with upstream. * gnu/packages/virtualization.scm (qemu): Update to 7.1.0. Marius Bakke 2022-08-29tests: libvirt: Ensure the default network can be started....* gnu/tests/virtualization.scm (run-libvirt-test): Run commands to create and start the default network. Marius Bakke 2022-08-29gnu: libvirt: Use absolute dnsmasq....Fixes <https://bugs.gnu.org/57272>. Reported by Lars-Dominik Braun <lars@6xq.net>. * gnu/packages/virtualization.scm (libvirt)[arguments]: Substitute the absolute dnsmasq file name. Disable one test. Co-authored-by: Marius Bakke <marius@gnu.org> Lars-Dominik Braun 2022-08-11gnu: python-libvirt: Add 'upstream-name' property....* gnu/packages/virtualization.scm (python-libvirt)[properties]: New field. Marius Bakke 2022-08-11gnu: libvirt: Use G-expression....* gnu/packages/virtualization.scm (libvirt)[arguments]: Use gexp. While at it, refer to THIS-PACKAGE instead of the NAME and VERSION fields. Marius Bakke 2022-08-11gnu: libvirt: Remove input labels....* gnu/packages/virtualization.scm (libvirt)[inputs, native-inputs]: Remove labels. Marius Bakke 2022-08-11gnu: libvirt, python-libvirt: Update to 8.6.0....* gnu/packages/patches/libvirt-add-install-prefix.patch: Refresh patch. * gnu/packages/virtualization.scm (libvirt): Update to 8.6.0. (python-libvirt): Update to 8.6.0. [arguments]: Remove, as the default test phase works fine. Marius Bakke 2022-07-24gnu: osinfo-db: Update to 20220516....* gnu/packages/virtualization.scm (osinfo-db): Update to 20220516. Tobias Geerinckx-Rice 2022-06-26gnu: lxd: Update to 4.24....* gnu/packages/virtualization.scm (lxd): Update to 4.24. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Brian Cully 2022-06-23gnu: runc: Update to 1.1.1....* gnu/packages/virtualization.scm (runc): Update to 1.1.1. [native-inputs]: Use new style. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Pierre Langlois 2022-06-19gnu: lxd: Remove input labels....* gnu/packages/virtualization.scm (lxd)[arguments]: In 'install' phase, refer to "bash-minimal" instead of "bash". [inputs]: Remove labels. Ludovic Courtès 2022-06-19gnu: lxd: Add ‘attr’ to inputs and use it in wrapper....Fixes issue with lxd crashing on startup with: Error: exec: "setfattr": executable file not found in $PATH * gnu/packages/virtualization.scm (lxd)[arguments]: In 'install' phase, add "attr" to the list of packages used in 'wrap-program'. [inputs]: Add ATTR. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Brian Cully 2022-06-01Merge remote-tracking branch 'origin/master' into stagingEfraim Flashner 2022-05-31gnu: qmpbackup: Update to 0.23....* gnu/packages/virtualization.scm (qmpbackup): Update to 0.23. [inputs]: Add python-qemu-qmp. [python]: Delete argument. [tests?]: New argument. Maxim Cournoyer 2022-05-31gnu: Add python-qemu-qmp....* gnu/packages/virtualization.scm (python-qemu-qmp): New variable. Maxim Cournoyer 2022-05-26Merge branch 'master' into stagingLudovic Courtès 2022-05-22gnu: lxc: Update to 4.0.12....* gnu/packages/virtualization.scm (lxc): Update to 4.0.12. Tobias Geerinckx-Rice 2022-05-22gnu: criu: Update to 3.17....* gnu/packages/virtualization.scm (criu): Update to 3.17. [arguments]: Set the correct and unused PLUGINDIR. Tobias Geerinckx-Rice 2022-04-29gnu: bubblewrap: Update to 0.6.1....* gnu/packages/virtualization.scm (bubblewrap): Update to 0.6.1. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Zhu Zihao 2022-04-09gnu: ganeti: Update to 3.0.2....* gnu/packages/patches/ganeti-haskell-compat.patch, gnu/packages/patches/ganeti-sphinx-compat.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/virtualization.scm (ganeti): Update to 3.0.2. [source](patches): Remove obsolete. [arguments]: Remove obsolete phases. Disable one more test. Marius Bakke 2022-04-09gnu: ganeti: Fix test failure with PyYAML 6.0....This fixes a regression that was introduced in 27720d0fe14ee4cd413a6745e0782a698a011924. * gnu/packages/patches/ganeti-pyyaml-compat.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/virtualization.scm (ganeti)[source](patches): Add it. Marius Bakke 2022-03-31gnu: Add riscv-pk....* gnu/packages/virtualization.scm (riscv-pk): New variable. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Arun Isaac 2022-03-31gnu: spike: Substitute path to dtc instead of wrapping executables....* gnu/packages/virtualization.scm (spike)[arguments]: Delete the wrap-binary phase. Add a configure-dtc-path phase that substitutes the absolute path to dtc. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Arun Isaac 2022-03-24gnu: xen: Fix compilation....Suggested by Skyler <skyvine@protonmail.com>. * gnu/packages/virtualization.scm (xen)[arguments]: In 'patch' phase, substitute ".note.gnu.build-id" in 'xen.lds.S'. Ludovic Courtès 2022-03-23gnu: spike: Wrap binaries....* gnu/packages/virtualization.scm (spike)[arguments]: Add phase to wrap binaries with dtc. [inputs]: Add bash-minimal. Efraim Flashner 2022-03-22gnu: libosinfo: Update to 1.10.0....* gnu/packages/virtualization.scm (libosinfo): Update to 1.10.0. Maxim Cournoyer 2022-03-22gnu: libosinfo: Use hwdata for pci.ids and usb.ids....* gnu/packages/virtualization.scm (libosinfo) [arguments]: Use gexps. [configure-flags]: Search usb.ids and pci.ids via search-input-file. [phases]{patch-osinfo-path}: Use search-input-directory. [inputs]: Use new style. [native-inputs]: Use new style. Replace pci.ids and usb.ids by the hwdata pci and usb outputs, respectively. Co-authored-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Brendan Tildesley 2022-03-13gnu: Add spike....* gnu/packages/virtualization.scm (spike): New variable. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Ekaitz Zarraga 2022-02-27gnu: qemu: Add liburing support....* gnu/packages/virtualization.scm (qemu)[inputs]: Add liburing. Tobias Geerinckx-Rice 2022-02-27gnu: qemu: Support Zstd compression....* gnu/packages/virtualization.scm (qemu)[inputs]: Add zstd. Tobias Geerinckx-Rice 2022-02-21gnu: criu: Propagate protobuf-c....The header of criu references to protobuf-c, including them in source files would require protobuf-c available in compilation environment. * gnu/packages/virtualization.scm (criu): Move protobuf-c from native-inputs to propagated-inputs. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Zhu Zihao 2022-02-16gnu: qemu: Skip some tests on riscv64-linux....* gnu/packages/virtualization.scm (qemu)[arguments]: Add phase for riscv64-linux to skip some unsupported tests. Efraim Flashner 2022-02-07gnu: ganeti-instance-guix: Update to 0.6.1....* gnu/packages/virtualization.scm (ganeti-instance-guix): Update to 0.6.1. Marius Bakke