| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 |
|
| 22 | |
| 23 | |
| 24 | |
| 25 |
|
| 26 | guix build --version
|
| 27 |
|
| 28 | |
| 29 | guix build -e + && false
|
| 30 |
|
| 31 | |
| 32 | guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
|
| 33 | test "`guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S`" = ""
|
| 34 |
|
| 35 | |
| 36 | case "$(guix build intelmetool -s armhf-linux -v0 -n 2>&1)" in
|
| 37 | *warning:*intelmetool*support*armhf*)
|
| 38 | true
|
| 39 | break;;
|
| 40 | *)
|
| 41 | false;
|
| 42 | break;;
|
| 43 | esac
|
| 44 |
|
| 45 | |
| 46 | guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
|
| 47 | grep -e '-guile-'
|
| 48 | guix build hello -d | \
|
| 49 | grep -e '-hello-[0-9\.]\+\.drv$'
|
| 50 |
|
| 51 | |
| 52 | drv="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' -d`"
|
| 53 | out="`guix build "$drv"`"
|
| 54 | out2="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
|
| 55 | test "$out" = "$out2"
|
| 56 |
|
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | guix build "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo.drv" 2>&1 \
|
| 62 | | grep "missing derivation"
|
| 63 |
|
| 64 | |
| 65 | GUIX_DAEMON_SOCKET="file://$GUIX_STATE_DIRECTORY/daemon-socket/socket" \
|
| 66 | guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
| 67 |
|
| 68 | ( if GUIX_DAEMON_SOCKET="weird://uri" \
|
| 69 | guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'; \
|
| 70 | then exit 1; fi )
|
| 71 |
|
| 72 | |
| 73 | test `guix build sed -s x86_64-linux -d | wc -l` = 1
|
| 74 |
|
| 75 | |
| 76 | all_systems="-s x86_64-linux -s i686-linux -s armhf-linux -s aarch64-linux \
|
| 77 | -s powerpc64le-linux"
|
| 78 | test `guix build sed $all_systems -d | sort -u | wc -l` = 5
|
| 79 |
|
| 80 | |
| 81 | |
| 82 | drv1="`guix build sed -s x86_64-linux -s armhf-linux -d | sort`"
|
| 83 | drv2="`guix build sed -s armhf-linux -s x86_64-linux -d | sort`"
|
| 84 | test "$drv1" = "$drv2"
|
| 85 |
|
| 86 | |
| 87 | module_dir="t-guix-build-$$"
|
| 88 | mkdir "$module_dir"
|
| 89 | trap "rm -rf $module_dir" EXIT
|
| 90 |
|
| 91 | |
| 92 | cat > "$module_dir/foo.scm" <<EOF
|
| 93 | (use-modules (guix))
|
| 94 | ) ;extra closing paren
|
| 95 | EOF
|
| 96 | guix build -f "$module_dir/foo.scm" 2> "$module_dir/stderr" && false
|
| 97 | grep "read error" "$module_dir/stderr"
|
| 98 | rm "$module_dir/stderr" "$module_dir/foo.scm"
|
| 99 |
|
| 100 | |
| 101 | cat > "$module_dir/foo.scm"<<EOF
|
| 102 | (define-module (foo)
|
| 103 | #:use-module (guix tests)
|
| 104 | #:use-module (guix packages)
|
| 105 | #:use-module (guix download)
|
| 106 | #:use-module (guix build-system trivial))
|
| 107 |
|
| 108 | (define-public foo
|
| 109 | (package
|
| 110 | (name "foo")
|
| 111 | (version "42")
|
| 112 | (source (origin
|
| 113 | (method url-fetch)
|
| 114 | (uri "http://www.example.com/foo.tar.gz")
|
| 115 | (sha256
|
| 116 | (base32
|
| 117 | "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))))
|
| 118 | (build-system trivial-build-system)
|
| 119 | (inputs
|
| 120 | (quasiquote (("bar" ,bar))))
|
| 121 | (home-page "www.example.com")
|
| 122 | (synopsis "Dummy package")
|
| 123 | (description "foo is a dummy package for testing.")
|
| 124 | (license #f)))
|
| 125 |
|
| 126 | (define-public bar
|
| 127 | (package
|
| 128 | (name "bar")
|
| 129 | (version "9001")
|
| 130 | (source (origin
|
| 131 | (method url-fetch)
|
| 132 | (uri "http://www.example.com/bar.tar.gz")
|
| 133 | (sha256
|
| 134 | (base32
|
| 135 | "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"))))
|
| 136 | (build-system trivial-build-system)
|
| 137 | (inputs
|
| 138 | (quasiquote
|
| 139 | (("data" ,(origin
|
| 140 | (method url-fetch)
|
| 141 | (uri "http://www.example.com/bar.dat")
|
| 142 | (sha256
|
| 143 | (base32
|
| 144 | "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz")))))))
|
| 145 | (home-page "www.example.com")
|
| 146 | (synopsis "Dummy package")
|
| 147 | (description "bar is a dummy package for testing.")
|
| 148 | (license #f)))
|
| 149 |
|
| 150 | (define-public baz
|
| 151 | (dummy-package "baz" (replacement foo)))
|
| 152 |
|
| 153 | (define-public superseded
|
| 154 | (deprecated-package "superseded" bar))
|
| 155 |
|
| 156 | EOF
|
| 157 |
|
| 158 | GUIX_PACKAGE_PATH="$module_dir"
|
| 159 | export GUIX_PACKAGE_PATH
|
| 160 |
|
| 161 | |
| 162 | guix build -d -S foo
|
| 163 | guix build -d -S foo | grep -e 'foo\.tar\.gz'
|
| 164 |
|
| 165 | |
| 166 | test "$(guix build -Sd coreutils -s x86_64-linux)" \
|
| 167 | != "$(guix build -Sd coreutils -s aarch64-linux)"
|
| 168 |
|
| 169 | |
| 170 | (unset GUIX_BUILD_OPTIONS;
|
| 171 | test "`guix build -d -S baz`" = "`guix build -d -S foo`")
|
| 172 |
|
| 173 | guix build -d --sources=package foo
|
| 174 | guix build -d --sources=package foo | grep -e 'foo\.tar\.gz'
|
| 175 |
|
| 176 | |
| 177 | guix build -d --sources bar
|
| 178 | test `guix build -d --sources bar \
|
| 179 | | grep -e 'bar\.tar\.gz' -e 'bar\.dat' \
|
| 180 | | wc -l` -eq 2
|
| 181 |
|
| 182 | |
| 183 | guix build -d --sources=all bar
|
| 184 | test `guix build -d --sources bar \
|
| 185 | | grep -e 'bar\.tar\.gz' -e 'bar\.dat' \
|
| 186 | | wc -l` -eq 2
|
| 187 |
|
| 188 | |
| 189 | guix build -d --sources=transitive foo
|
| 190 | test `guix build -d --sources=transitive foo \
|
| 191 | | grep -e 'foo\.tar\.gz' -e 'bar\.tar\.gz' -e 'bar\.dat' \
|
| 192 | | wc -l` -eq 3
|
| 193 |
|
| 194 | |
| 195 | guix build -D hello -n
|
| 196 | test `guix build -D hello -d \
|
| 197 | | grep -e 'glibc.*\.drv$' -e 'gcc.*\.drv$' -e 'binutils.*\.drv$' \
|
| 198 | | wc -l` -ge 3
|
| 199 |
|
| 200 | |
| 201 | test `guix build -P1 libgcrypt -P1 libssh -d \
|
| 202 | | grep -e 'guile-gcrypt.*\.drv$' -e 'guile-ssh.*\.drv$' \
|
| 203 | -e 'libgcrypt-[0-9].*\.drv$' -e 'libssh-[0-9].*\.drv$' \
|
| 204 | | sort -u \
|
| 205 | | wc -l` -eq 4
|
| 206 |
|
| 207 | |
| 208 | cat > "$module_dir/foo.scm" <<EOF
|
| 209 | (define-module (foo)
|
| 210 | #:use-module (guix tests)
|
| 211 | #:use-module (guix build-system trivial))
|
| 212 |
|
| 213 | (define-public foo
|
| 214 | (dummy-package "package-with-something-wrong"
|
| 215 | (build-system trivial-build-system)
|
| 216 | (inputs (quasiquote (("sed" ,sed)))))) ;unbound variable
|
| 217 | EOF
|
| 218 |
|
| 219 | guix build package-with-something-wrong -n && false
|
| 220 | guix build package-with-something-wrong -n 2> "$module_dir/err" || true
|
| 221 | grep "unbound" "$module_dir/err" |
| 222 | grep "forget.*(gnu packages base)" "$module_dir/err" |
| 223 |
|
| 224 | |
| 225 | cat > "$module_dir/foo.scm" <<EOF
|
| 226 | (define-module (foo)
|
| 227 | #:use-module (guix tests))
|
| 228 |
|
| 229 | (define-public foo
|
| 230 | (dummy-package "package-with-something-wrong"
|
| 231 | (build-system gnu-build-system))) ;unbound variable
|
| 232 | EOF
|
| 233 |
|
| 234 | guix build sed -n 2> "$module_dir/err"
|
| 235 | grep "unbound" "$module_dir/err" |
| 236 | grep "forget.*(guix build-system gnu)" "$module_dir/err" |
| 237 |
|
| 238 | rm -f "$module_dir"/*
|
| 239 |
|
| 240 | |
| 241 | cat > "$module_dir/aa-private.scm" <<EOF
|
| 242 | (define-module (aa-private))
|
| 243 | (define make-thing #f)
|
| 244 | (set! make-thing make-thing) ;don't inline
|
| 245 | EOF
|
| 246 |
|
| 247 | cat > "$module_dir/bb-public.scm" <<EOF
|
| 248 | (define-module (bb-public) #:export (make-thing))
|
| 249 | (define make-thing identity)
|
| 250 | EOF
|
| 251 |
|
| 252 | cat > "$module_dir/cc-user.scm" <<EOF
|
| 253 | ;; Make those module available in the global name space.
|
| 254 | (load-from-path "aa-private.scm")
|
| 255 | (load-from-path "bb-public.scm")
|
| 256 |
|
| 257 | (define-module (cc-user))
|
| 258 | (make-thing 42)
|
| 259 | EOF
|
| 260 | guix build -f "$module_dir/cc-user.scm" -n 2> "$module_dir/err" && false
|
| 261 | cat "$module_dir/err"
|
| 262 | grep "make-thing.*unbound" "$module_dir/err" |
| 263 | grep "forget.*(bb-public)" "$module_dir/err" |
| 264 |
|
| 265 | rm -f "$module_dir"/*
|
| 266 |
|
| 267 | |
| 268 | cat > "$module_dir/foo.scm" <<EOF
|
| 269 | (define-module (something foo)
|
| 270 | #:use-module (guix)
|
| 271 | #:use-module (gnu))
|
| 272 | EOF
|
| 273 | guix build guile-bootstrap -n 2> "$module_dir/err"
|
| 274 | grep "does not match file name" "$module_dir/err"
|
| 275 |
|
| 276 | rm "$module_dir"/*
|
| 277 |
|
| 278 | |
| 279 | drv="`guix build -d -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
|
| 280 | out="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
|
| 281 | log="`guix build --log-file $drv`"
|
| 282 | echo "$log" | grep log/.*guile.*drv
|
| 283 | test -f "$log"
|
| 284 | test "`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' --log-file`" \
|
| 285 | = "$log"
|
| 286 | test "`guix build --log-file guile-bootstrap`" = "$log"
|
| 287 | test "`guix build --log-file $out`" = "$log"
|
| 288 |
|
| 289 | |
| 290 | guix build hello-0.0.1 -n && false
|
| 291 |
|
| 292 | |
| 293 | result="t-result-$$"
|
| 294 | guix build -r "$result" \
|
| 295 | -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
| 296 | test -x "$result/bin/guile"
|
| 297 |
|
| 298 | |
| 299 | guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' && false
|
| 300 |
|
| 301 | rm -f "$result"
|
| 302 |
|
| 303 | |
| 304 | mkdir "$result"
|
| 305 | guix build -r "$result/x" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
| 306 | test -x "$result/x/bin/guile"
|
| 307 | rm "$result/x"
|
| 308 | rmdir "$result"
|
| 309 |
|
| 310 | |
| 311 | guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes
|
| 312 |
|
| 313 | |
| 314 | guix build --target=arm-linux-gnueabihf --dry-run \
|
| 315 | -e '(@ (gnu packages base) coreutils)'
|
| 316 |
|
| 317 | |
| 318 | drv1=`guix build guix --with-input=guile-zstd=idutils -d`
|
| 319 | drv2=`guix build guix -d`
|
| 320 | test "$drv1" != "$drv2"
|
| 321 |
|
| 322 | drv1=`guix build guile -d`
|
| 323 | drv2=`guix build guile --with-input=gimp=ruby -d`
|
| 324 | test "$drv1" = "$drv2"
|
| 325 |
|
| 326 | |
| 327 | drv1=`guix build glib -d`
|
| 328 | drv2=`guix build glib -d --with-input=libreoffice=inkscape`
|
| 329 | test "$drv1" = "$drv2"
|
| 330 |
|
| 331 | |
| 332 | |
| 333 | drv1=`guix build inkscape -d --no-grafts`
|
| 334 | drv2=`guix build inkscape -d --no-grafts --with-graft=glib=glib-networking`
|
| 335 | test "$drv1" = "$drv2"
|
| 336 |
|
| 337 | |
| 338 | drv1=`guix build grep -d`
|
| 339 | drv2=`guix build grep -d --with-input=coreutils=hello`
|
| 340 | test "$drv1" != "$drv2"
|
| 341 | guix gc -R "$drv2" | grep `guix build -d hello`
|
| 342 |
|
| 343 | guix build guile --with-input=libunistring=something-really-silly && false
|
| 344 |
|
| 345 | |
| 346 | test "`guix build superseded -d`" = "`guix build bar -d`"
|
| 347 |
|
| 348 | |
| 349 | guix build -n time |
| 350 | guix build -n [email protected] |
| 351 | guix build -n [email protected] && false |
| 352 | guix build -n something-that-will-never-exist && false |
| 353 |
|
| 354 | |
| 355 | guix build -e "(begin
|
| 356 | (use-modules (guix gexp))
|
| 357 | (lambda ()
|
| 358 | (gexp->derivation \"test\"
|
| 359 | (gexp (mkdir (ungexp output))))))" \
|
| 360 | --dry-run
|
| 361 |
|
| 362 | |
| 363 | guix build -e '#~(mkdir #$output)' -d
|
| 364 | guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv'
|
| 365 |
|
| 366 | |
| 367 | guix build -e '(computed-file "foo" #~(mkdir #$output))' -d
|
| 368 | guix build -e '(computed-file "foo" #~(mkdir #$output))' -d | grep 'foo\.drv'
|
| 369 |
|
| 370 | |
| 371 | cat > "$module_dir/package.scm"<<EOF
|
| 372 | (use-modules (gnu))
|
| 373 | (use-package-modules bootstrap)
|
| 374 |
|
| 375 | %bootstrap-guile
|
| 376 | EOF
|
| 377 | guix build --file="$module_dir/package.scm"
|
| 378 |
|
| 379 | |
| 380 | cat > "$module_dir/proc.scm"<<EOF
|
| 381 | (use-modules (guix gexp))
|
| 382 | (lambda ()
|
| 383 | (gexp->derivation "test"
|
| 384 | (gexp (mkdir (ungexp output)))))
|
| 385 | EOF
|
| 386 | guix build --file="$module_dir/proc.scm" --dry-run
|
| 387 |
|
| 388 | |
| 389 | cat > "$module_dir/gexp.scm"<<EOF
|
| 390 | (use-modules (guix gexp))
|
| 391 |
|
| 392 | (gexp (mkdir (ungexp output)))
|
| 393 | EOF
|
| 394 | guix build --file="$module_dir/gexp.scm" -d
|
| 395 | guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
|
| 396 |
|
| 397 | |
| 398 | cat > "$module_dir/manifest.scm"<<EOF
|
| 399 | (specifications->manifest '("hello" "guix"))
|
| 400 | EOF
|
| 401 | test `guix build -d --manifest="$module_dir/manifest.scm" \
|
| 402 | | grep -e '-hello-' -e '-guix-' \
|
| 403 | | wc -l` -eq 2
|
| 404 |
|
| 405 | |
| 406 | cat > "$module_dir/manifest.scm"<<EOF
|
| 407 | (manifest
|
| 408 | (list (manifest-entry (name "foo") (version "0")
|
| 409 | (item (computed-file "computed-thingie"
|
| 410 | #~(mkdir (ungexp output)))))))
|
| 411 | EOF
|
| 412 | guix build -d -m "$module_dir/manifest.scm" \
|
| 413 | | grep 'computed-thingie\.drv$'
|
| 414 |
|
| 415 | rm "$module_dir"/*.scm
|
| 416 |
|
| 417 | if [ -n "$BASH_VERSION" ]
|
| 418 | then
|
| 419 | |
| 420 | |
| 421 | guix build -m <(echo '(specifications->manifest (list "guile"))') -n
|
| 422 | fi
|
| 423 |
|
| 424 | |
| 425 | |
| 426 | scheme_file=$(guix build -e \
|
| 427 | "(use-modules (guix gexp)) \
|
| 428 | (scheme-file \"mathematics\" \
|
| 429 | '(begin \
|
| 430 | (define add +) \
|
| 431 | (define multiply *) \
|
| 432 | (add 5 (multiply 2 10)))
|
| 433 | #:guile (@@ (gnu packages bootstrap) %bootstrap-guile))")
|
| 434 | guile -c \
|
| 435 | "(begin \
|
| 436 | (use-modules (guix ui) (rnrs base) (srfi srfi-26)) \
|
| 437 | (assert (= 25 (call-with-input-file \"$scheme_file\" \
|
| 438 | (cut read/eval <>)))))"
|
| 439 |
|
| 440 | |
| 441 | GUIX_BUILD_OPTIONS="--dry-run --no-grafts"
|
| 442 | export GUIX_BUILD_OPTIONS
|
| 443 |
|
| 444 | guix build emacs
|
| 445 |
|
| 446 | GUIX_BUILD_OPTIONS="--something-completely-crazy"
|
| 447 | guix build emacs && false
|
| 448 |
|
| 449 | exit 0
|