Commit | Line | Data |
---|---|---|
233e7676 | 1 | # GNU Guix --- Functional package management for GNU |
ada3df03 | 2 | # Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> |
97298ffa | 3 | # |
233e7676 | 4 | # This file is part of GNU Guix. |
97298ffa | 5 | # |
233e7676 | 6 | # GNU Guix is free software; you can redistribute it and/or modify it |
97298ffa LC |
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 | # | |
233e7676 | 11 | # GNU Guix is distributed in the hope that it will be useful, but |
97298ffa LC |
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 | |
233e7676 | 17 | # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
97298ffa LC |
18 | |
19 | # | |
e49951eb | 20 | # Test the `guix build' command-line utility. |
97298ffa LC |
21 | # |
22 | ||
e49951eb | 23 | guix build --version |
97298ffa LC |
24 | |
25 | # Should fail. | |
e49951eb | 26 | if guix build -e +; |
912209ee LC |
27 | then false; else true; fi |
28 | ||
29 | # Should fail because this is a source-less package. | |
e49951eb | 30 | if guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S |
912209ee | 31 | then false; else true; fi |
97298ffa LC |
32 | |
33 | # Should pass. | |
e49951eb | 34 | guix build -e '(@@ (gnu packages base) %bootstrap-guile)' | \ |
97298ffa | 35 | grep -e '-guile-' |
e49951eb | 36 | guix build hello -d | \ |
97298ffa LC |
37 | grep -e '-hello-[0-9\.]\+\.drv$' |
38 | ||
bf421152 LC |
39 | # Should all return valid log files. |
40 | drv="`guix build -d -e '(@@ (gnu packages base) %bootstrap-guile)'`" | |
41 | out="`guix build -e '(@@ (gnu packages base) %bootstrap-guile)'`" | |
42 | log="`guix build --log-file $drv`" | |
43 | echo "$log" | grep log/.*guile.*drv | |
44 | test -f "$log" | |
45 | test "`guix build -e '(@@ (gnu packages base) %bootstrap-guile)' --log-file`" \ | |
46 | = "$log" | |
47 | test "`guix build --log-file guile-bootstrap`" = "$log" | |
48 | test "`guix build --log-file $out`" = "$log" | |
49 | ||
97298ffa | 50 | # Should fail because the name/version combination could not be found. |
e49951eb | 51 | if guix build hello-0.0.1 -n; then false; else true; fi |
97298ffa LC |
52 | |
53 | # Keep a symlink to the result, registered as a root. | |
54 | result="t-result-$$" | |
e49951eb | 55 | guix build -r "$result" \ |
1ffa7090 | 56 | -e '(@@ (gnu packages base) %bootstrap-guile)' |
97298ffa LC |
57 | test -x "$result/bin/guile" |
58 | ||
59 | # Should fail, because $result already exists. | |
e49951eb | 60 | if guix build -r "$result" -e '(@@ (gnu packages base) %bootstrap-guile)' |
97298ffa LC |
61 | then false; else true; fi |
62 | ||
63 | rm -f "$result" | |
5401dd75 | 64 | |
e55ec43d LC |
65 | # Cross building. |
66 | guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes | |
67 | ||
5401dd75 | 68 | # Parsing package names and versions. |
e49951eb MW |
69 | guix build -n time # PASS |
70 | guix build -n time-1.7 # PASS, version found | |
71 | if guix build -n time-3.2; # FAIL, version not found | |
5401dd75 | 72 | then false; else true; fi |
e49951eb | 73 | if guix build -n something-that-will-never-exist; # FAIL |
5401dd75 | 74 | then false; else true; fi |
ac5de156 LC |
75 | |
76 | # Invoking a monadic procedure. | |
77 | guix build -e "(begin | |
ada3df03 | 78 | (use-modules (guix gexp)) |
ac5de156 | 79 | (lambda () |
ada3df03 LC |
80 | (gexp->derivation \"test\" |
81 | (gexp (mkdir (ungexp output))))))" \ | |
ac5de156 | 82 | --dry-run |
56b82106 LC |
83 | |
84 | # Running a gexp. | |
85 | guix build -e '#~(mkdir #$output)' -d | |
86 | guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv' |