;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Mathieu Othacehe ;;; ;;; 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 tests image) #:use-module (gnu) #:use-module (gnu image) #:use-module (gnu tests) #:autoload (gnu system image) (system-image root-offset) #:use-module (gnu system uuid) #:use-
aboutsummaryrefslogtreecommitdiff
# GNU Guix --- Functional package management for GNU
# Copyright © 2019, 2020 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/>.

#
# Test the `guix package' aliases.
#

guix install --version

readlink_base ()
{
    basename `readlink "$1"`
}

profile="t-profile-$$"
rm -f "$profile"

trap 'rm -f "$profile" "$profile-"[0-9]*' EXIT

guix install --bootstrap guile-bootstrap -p "$profile"
test -x "$profile/bin/guile"

# Make sure '-r' isn't passed as-is to 'guix package'.
guix install -r guile-bootstrap -p "$profile" --bootstrap && false
test -x "$profile/bin/guile"

# Use a package transformation option and make sure it's recorded.
guix install --bootstrap guile-bootstrap -p "$profile" \
     --with-input=libreoffice=inkscape
test -x "$profile/bin/guile"
grep "libreoffice=inkscape" "$profile/manifest"

guix upgrade --version
guix upgrade -n
guix upgrade gui.e -n
guix upgrade foo bar -n

guix remove --version
guix remove --bootstrap guile-bootstrap -p "$profile"
test ! -x "$profile/bin/guile"
test `guix package -p "$profile" -I | wc -l` -eq 0

guix remove -p "$profile" this-is-not-installed --bootstrap && false

guix remove -i guile-bootstrap -p "$profile" --bootstrap && false

guix search '\<board\>' game | grep '^name: gnubg'

guix show --version
guix show guile
guix show python@3 | grep "^name: python"

# "python@2" exists but is deprecated; make sure it doesn't show up.
guix show python@2 && false

# Specifying multiple packages.
output="`guix show sed grep | grep ^name:`"
test "$output" = "name: sed
name: grep"
(disk-new (get-device img))) (test-runner-current (system-test-runner #$output)) (test-begin "images") ;; Image i1. (define i1-image #$(system-image i1)) (define d1-device (get-device i1-image)) (test-equal "msdos" (disk-type-name (disk-probe d1-device))) (test-equal 1 (disk-get-primary-partition-count (disk-new d1-device))) (test-assert (let* ((disk (disk-new d1-device)) (partitions (disk-partitions disk)) (boot-partition (find normal-partition? partitions))) (partition-get-flag boot-partition PARTITION-FLAG-BOOT))) ;; Image i2. (define i2-image #$(system-image i2)) (define d2-device (get-device i2-image)) (test-equal "gpt" (disk-type-name (disk-probe d2-device))) (test-equal 1 (disk-get-primary-partition-count (disk-new d2-device))) (test-equal "test" (let* ((disk (disk-new d2-device)) (partitions (disk-partitions disk)) (boot-partition (find normal-partition? partitions))) (partition-get-name boot-partition))) ;; Image i3. (define i3-image #$(system-image i3)) (define d3-device (get-device i3-image)) (test-equal "msdos" (disk-type-name (disk-probe d3-device))) (test-equal 2 (disk-get-primary-partition-count (disk-new d3-device))) ;; Image i4. (define i4-image #$(system-image i4)) (define d4-device (get-device i4-image)) (test-equal "gpt" (disk-type-name (disk-probe d4-device))) (test-equal 2 (disk-get-primary-partition-count (disk-new d4-device))) ;; Image i5. (define i5-image #$(system-image i5)) (define d5-device (get-device i5-image)) (define (sector->byte sector) (/ (* sector (device-sector-size d5-device)) MEBIBYTE-SIZE)) (test-equal "gpt" (disk-type-name (disk-probe d5-device))) (test-equal 2 (disk-get-primary-partition-count (disk-new d5-device))) (test-equal '("fat32" "ext4") (map (compose filesystem-type-name partition-fs-type) (filter data-partition? (disk-partitions (disk-new d5-device))))) ;; The first partition has a 1MiB offset has a 128MiB size. The ;; second partition should then start at 129MiB. (test-equal '(1 129) (map (compose sector->byte partition-start) (filter data-partition? (disk-partitions (disk-new d5-device))))) (test-end))))) (gexp->derivation "images-test" test)) (define %test-images (system-test (name "images") (description "Build and test basic system images.") (value (run-images-test))))