X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/dd1a5a152c679ba2d386dc66127a0de924182e26..ba88eea2b3a8a33ecd7fc0ec64e3917c6c2fe21d:/tests/guix-build.sh diff --git a/tests/guix-build.sh b/tests/guix-build.sh index d66e132c1f..66bf6be8d0 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès # # This file is part of GNU Guix. # @@ -26,23 +26,144 @@ guix build --version if guix build -e +; then false; else true; fi -# Should fail because this is a source-less package. -if guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S -then false; else true; fi +# Source-less packages are accepted; they just return nothing. +guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S +test "`guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S`" = "" # Should pass. -guix build -e '(@@ (gnu packages base) %bootstrap-guile)' | \ +guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \ grep -e '-guile-' guix build hello -d | \ grep -e '-hello-[0-9\.]\+\.drv$' +# Passing a URI. +GUIX_DAEMON_SOCKET="file://$GUIX_STATE_DIRECTORY/daemon-socket/socket" \ +guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' + +( if GUIX_DAEMON_SOCKET="weird://uri" \ + guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'; \ + then exit 1; fi ) + +# Check --sources option with its arguments +module_dir="t-guix-build-$$" +mkdir "$module_dir" +trap "rm -rf $module_dir" EXIT + +cat > "$module_dir/foo.scm"< "$module_dir/foo.scm"< "$module_dir/err" || true +grep "unbound" "$module_dir/err" # actual error +grep "forget.*(gnu packages base)" "$module_dir/err" # hint +rm -f "$module_dir"/* + # Should all return valid log files. -drv="`guix build -d -e '(@@ (gnu packages base) %bootstrap-guile)'`" -out="`guix build -e '(@@ (gnu packages base) %bootstrap-guile)'`" +drv="`guix build -d -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`" +out="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`" log="`guix build --log-file $drv`" echo "$log" | grep log/.*guile.*drv test -f "$log" -test "`guix build -e '(@@ (gnu packages base) %bootstrap-guile)' --log-file`" \ +test "`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' --log-file`" \ = "$log" test "`guix build --log-file guile-bootstrap`" = "$log" test "`guix build --log-file $out`" = "$log" @@ -53,11 +174,11 @@ if guix build hello-0.0.1 -n; then false; else true; fi # Keep a symlink to the result, registered as a root. result="t-result-$$" guix build -r "$result" \ - -e '(@@ (gnu packages base) %bootstrap-guile)' + -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' test -x "$result/bin/guile" # Should fail, because $result already exists. -if guix build -r "$result" -e '(@@ (gnu packages base) %bootstrap-guile)' +if guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' then false; else true; fi rm -f "$result" @@ -65,17 +186,78 @@ rm -f "$result" # Cross building. guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes +# Replacements. +drv1=`guix build guix --with-input=guile@2.0=guile@2.2 -d` +drv2=`guix build guix -d` +test "$drv1" != "$drv2" + +drv1=`guix build guile -d` +drv2=`guix build guile --with-input=gimp=ruby -d` +test "$drv1" = "$drv2" + +if guix build guile --with-input=libunistring=something-really-silly +then false; else true; fi + +# Deprecated/superseded packages. +test "`guix build superseded -d`" = "`guix build bar -d`" + # Parsing package names and versions. guix build -n time # PASS -guix build -n time-1.7 # PASS, version found -if guix build -n time-3.2; # FAIL, version not found +guix build -n time@1.9 # PASS, version found +if guix build -n time@3.2; # FAIL, version not found then false; else true; fi if guix build -n something-that-will-never-exist; # FAIL then false; else true; fi # Invoking a monadic procedure. guix build -e "(begin - (use-modules (guix monads) (guix utils)) + (use-modules (guix gexp)) (lambda () - (derivation-expression \"test\" '(mkdir %output))))" \ + (gexp->derivation \"test\" + (gexp (mkdir (ungexp output))))))" \ --dry-run + +# Running a gexp. +guix build -e '#~(mkdir #$output)' -d +guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv' + +# Same with a file-like object. +guix build -e '(computed-file "foo" #~(mkdir #$output))' -d +guix build -e '(computed-file "foo" #~(mkdir #$output))' -d | grep 'foo\.drv' + +# Building from a package file. +cat > "$module_dir/package.scm"< "$module_dir/proc.scm"<derivation "test" + (gexp (mkdir (ungexp output))))) +EOF +guix build --file="$module_dir/proc.scm" --dry-run + +# Building from a gexp file. +cat > "$module_dir/gexp.scm"<