build: Fix typo that would lead to hitting the socket name length limit.
[jackhill/guix/guix.git] / tests / guix-build.sh
... / ...
CommitLineData
1# GNU Guix --- Functional package management for GNU
2# Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3#
4# This file is part of GNU Guix.
5#
6# GNU Guix is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or (at
9# your option) any later version.
10#
11# GNU Guix is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19#
20# Test the `guix build' command-line utility.
21#
22
23guix build --version
24
25# Should fail.
26if guix build -e +;
27then false; else true; fi
28
29# Should fail because this is a source-less package.
30if guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
31then false; else true; fi
32
33# Should pass.
34guix build -e '(@@ (gnu packages base) %bootstrap-guile)' | \
35 grep -e '-guile-'
36guix build hello -d | \
37 grep -e '-hello-[0-9\.]\+\.drv$'
38
39# Should all return valid log files.
40drv="`guix build -d -e '(@@ (gnu packages base) %bootstrap-guile)'`"
41out="`guix build -e '(@@ (gnu packages base) %bootstrap-guile)'`"
42log="`guix build --log-file $drv`"
43echo "$log" | grep log/.*guile.*drv
44test -f "$log"
45test "`guix build -e '(@@ (gnu packages base) %bootstrap-guile)' --log-file`" \
46 = "$log"
47test "`guix build --log-file guile-bootstrap`" = "$log"
48test "`guix build --log-file $out`" = "$log"
49
50# Should fail because the name/version combination could not be found.
51if guix build hello-0.0.1 -n; then false; else true; fi
52
53# Keep a symlink to the result, registered as a root.
54result="t-result-$$"
55guix build -r "$result" \
56 -e '(@@ (gnu packages base) %bootstrap-guile)'
57test -x "$result/bin/guile"
58
59# Should fail, because $result already exists.
60if guix build -r "$result" -e '(@@ (gnu packages base) %bootstrap-guile)'
61then false; else true; fi
62
63rm -f "$result"
64
65# Cross building.
66guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes
67
68# Parsing package names and versions.
69guix build -n time # PASS
70guix build -n time-1.7 # PASS, version found
71if guix build -n time-3.2; # FAIL, version not found
72then false; else true; fi
73if guix build -n something-that-will-never-exist; # FAIL
74then false; else true; fi
75
76# Invoking a monadic procedure.
77guix build -e "(begin
78 (use-modules (guix gexp))
79 (lambda ()
80 (gexp->derivation \"test\"
81 (gexp (mkdir (ungexp output))))))" \
82 --dry-run
83
84# Running a gexp.
85guix build -e '#~(mkdir #$output)' -d
86guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv'