aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-28 21:32:17 +0200
committerLudovic Courtès <ludo@gnu.org>2015-09-28 22:54:04 +0200
commit16748d80158875ae4cd54270be683fcf9c5d5169 (patch)
treed814296cd544ea49a751f9d8de168ae23586fff5 /tests
parentdf0a3b7f9ee8b5134ffedc58dc5e0ae761c45e25 (diff)
downloadpatches-16748d80158875ae4cd54270be683fcf9c5d5169.tar
patches-16748d80158875ae4cd54270be683fcf9c5d5169.tar.gz
store: Add 'query-failed-paths' and 'clear-failed-paths' RPCs.
Suggested by Mark H Weaver <mhw@netris.org>. * guix/store.scm (query-failed-paths, clear-failed-paths): New procedures. * tests/guix-daemon.sh: Add test with daemon started with --cache-failures.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-daemon.sh39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh
index 0de6f278e4..1f9c868293 100644
--- a/tests/guix-daemon.sh
+++ b/tests/guix-daemon.sh
@@ -65,7 +65,7 @@ guile -c "
socket="$NIX_STATE_DIR/alternate-socket"
guix-daemon --no-substitutes --listen="$socket" --disable-chroot &
daemon_pid=$!
-trap "kill $daemon_pid" EXIT
+trap 'kill $daemon_pid' EXIT
# Make sure we DON'T see the substitute.
guile -c "
@@ -77,3 +77,40 @@ guile -c "
#:substitute-urls (list \"$GUIX_BINARY_SUBSTITUTE_URL\"))
(exit (not (has-substitutes? store \"$out\")))"
+
+kill "$daemon_pid"
+
+
+# Check the failed build cache.
+
+guix-daemon --no-substitutes --listen="$socket" --disable-chroot \
+ --cache-failures &
+daemon_pid=$!
+
+guile -c "
+ (use-modules (guix) (guix tests) (srfi srfi-34))
+ (define store (open-connection-for-tests \"$socket\"))
+
+ (define (build-without-failing drv)
+ (lambda (store)
+ (guard (c ((nix-protocol-error? c) (values #t store)))
+ (build-derivations store (list drv))
+ (values #f store))))
+
+ ;; Make sure failed builds are cached and can be removed from
+ ;; the cache.
+ (run-with-store store
+ (mlet* %store-monad ((drv (gexp->derivation \"failure\"
+ #~(begin
+ (ungexp output)
+ #f)))
+ (out -> (derivation->output-path drv))
+ (ok? (build-without-failing drv)))
+ ;; Note the mixture of monadic and direct style. Don't try
+ ;; this at home!
+ (return (exit (and ok?
+ (equal? (query-failed-paths store) (list out))
+ (begin
+ (clear-failed-paths store (list out))
+ (null? (query-failed-paths store)))))))
+ #:guile-for-build (%guile-for-build)) "