123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- set -e
- guix system --version
- tmpfile="t-guix-system-$$"
- errorfile="t-guix-system-error-$$"
- tmpdir="${TMPDIR:-/tmp}/t-guix-system-$$"
- mkdir "$tmpdir"
- trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT
- cat > "$tmpfile"<<EOF
- ;; This is line 1, and the next one is line 2.
- (operating-system)
- ;; The 'T' is at column 3.
- EOF
- if guix system vm "$tmpfile" 2> "$errorfile"
- then
-
- exit 1
- else
- grep "$tmpfile:2:3:.*missing.* initializers" "$errorfile"
- fi
- cat > "$tmpfile"<<EOF
- ;; This is line 1, and the next one is line 2.
- (operating-system
- ;; This is line 3, and there is no closing paren!
- EOF
- if guix system vm "$tmpfile" 2> "$errorfile"
- then
-
- exit 1
- else
- grep "$tmpfile:4:1: missing closing paren" "$errorfile"
- fi
- cat > "$tmpfile" <<EOF
- ;; Line 1.
- (use-modules (gnu))
- (use-service-modules openssh)
- EOF
- if guix system build "$tmpfile" -n 2> "$errorfile"
- then false
- else
- grep "$tmpfile:3:2: .*module .*openssh.*not found" "$errorfile"
- grep "Try.*use-service-modules ssh" "$errorfile"
- fi
- cat > "$tmpfile" <<EOF
- ;; Line 1.
- (use-modules (gnu))
- (use-package-modules qemu)
- EOF
- if guix system build "$tmpfile" -n 2> "$errorfile"
- then false
- else
- grep "$tmpfile:3:2: .*module .*qemu.*not found" "$errorfile"
- grep "Try.*use-package-modules virtualization" "$errorfile"
- fi
- cat > "$tmpfile" <<EOF
- (use-modules (gnu)) ; 1
- (use-service-modules networking) ; 2
- (operating-system ; 4
- (host-name "antelope") ; 5
- (timezone "Europe/Paris") ; 6
- (locale "en_US.UTF-8") ; 7
- (bootloader (GRUB-config (device "/dev/sdX"))) ; 9
- (file-systems (cons (file-system
- (device "root")
- (title 'label)
- (mount-point "/")
- (type "ext4"))
- %base-file-systems)))
- EOF
- if guix system build "$tmpfile" -n 2> "$errorfile"
- then false
- else
- if test "`guile -c '(display (effective-version))'`" = 2.2
- then
- # FIXME: With Guile 2.2.0 the error is reported on line 4.
- # See <http://bugs.gnu.org/26107>.
- grep "$tmpfile:[49]:[0-9]\+: GRUB-config.*[Uu]nbound variable" "$errorfile"
- else
- grep "$tmpfile:9:[0-9]\+: GRUB-config.*[Uu]nbound variable" "$errorfile"
- fi
- fi
- OS_BASE='
- (host-name "antelope")
- (timezone "Europe/Paris")
- (locale "en_US.UTF-8")
- (bootloader (bootloader-configuration
- (bootloader grub-bootloader)
- (device "/dev/sdX")))
- (file-systems (cons (file-system
- (device "root")
- (title (string->symbol "label"))
- (mount-point "/")
- (type "ext4"))
- %base-file-systems))
- '
- # Reporting of duplicate service identifiers.
- cat > "$tmpfile" <<EOF
- (use-modules (gnu))
- (use-service-modules networking)
- (operating-system
- $OS_BASE
- (services (cons* (dhcp-client-service)
- (dhcp-client-service) ;twice!
- %base-services)))
- EOF
- if guix system vm "$tmpfile" 2> "$errorfile"
- then
- # This must not succeed.
- exit 1
- else
- grep "service 'networking'.*more than once" "$errorfile"
- fi
- # Reporting unmet shepherd requirements.
- cat > "$tmpfile" <<EOF
- (use-modules (gnu) (gnu services shepherd))
- (use-service-modules networking)
- (define buggy-service-type
- (shepherd-service-type
- 'buggy
- (lambda _
- (shepherd-service
- (provision '(buggy!))
- (requirement '(does-not-exist))
- (start
- (operating-system
- $OS_BASE
- (services (cons (service buggy-service-type
- %base-services)))
- EOF
- if guix system build "$tmpfile" 2> "$errorfile"
- then
- exit 1
- else
- grep "service 'buggy!'.*'does-not-exist'.*not provided" "$errorfile"
- fi
- make_user_config ()
- {
- cat > "$tmpfile" <<EOF
- (use-modules (gnu))
- (use-service-modules networking)
- (operating-system
- (host-name "antelope")
- (timezone "Europe/Paris")
- (locale "en_US.UTF-8")
- (bootloader (bootloader-configuration
- (bootloader grub-bootloader)
- (device "/dev/sdX")))
- (file-systems (cons (file-system
- (device "root")
- (title 'label)
- (mount-point "/")
- (type "ext4"))
- %base-file-systems))
- (users (list (user-account
- (name "dave")
- (home-directory "/home/dave")
- (group "$1")
- (supplementary-groups '("$2"))))))
- EOF
- }
- make_user_config "users" "wheel"
- guix system build "$tmpfile" -n
- guix system build "$tmpfile" -d
- guix system build "$tmpfile" -d | grep '\.drv$'
- guix system vm "$tmpfile" -d
- guix system vm "$tmpfile" -d | grep '\.drv$'
- make_user_config "group-that-does-not-exist" "users"
- if guix system build "$tmpfile" -n 2> "$errorfile"
- then false
- else grep "primary group.*group-that-does-not-exist.*undeclared" "$errorfile"; fi
- make_user_config "users" "group-that-does-not-exist"
- if guix system build "$tmpfile" -n 2> "$errorfile"
- then false
- else grep "supplementary group.*group-that-does-not-exist.*undeclared" "$errorfile"; fi
- cat > "$tmpdir/config.scm"<<EOF
- (use-modules (gnu))
- (use-service-modules networking)
- (operating-system
- $OS_BASE
- (services (cons (tor-service (local-file "my-torrc"))
- %base-services)))
- EOF
- cat > "$tmpdir/my-torrc"<<EOF
- EOF
- guix system build "$tmpdir/config.scm" -n
- (cd "$tmpdir"; guix system build "config.scm" -n)
- guix system search tor | grep "^name: tor"
- guix system search anonym network | grep "^name: tor"
|