From e297d8fc565861794c7d85cf7d158a846ab25aac Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 18 Mar 2014 23:59:57 +0100 Subject: tests: Test recovery from 'valid-path?' RPCs with an invalid parameter. * tests/store.scm ("valid-path? live", "valid-path? false", "valid-path? error", "valid-path? recovery"): New tests. --- tests/store.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/store.scm b/tests/store.scm index 78023a423d..d23024bcbc 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -87,7 +87,39 @@ (define (random-text) (%store-prefix) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile"))))) -(test-skip (if %store 0 11)) +(test-skip (if %store 0 13)) + +(test-assert "valid-path? live" + (let ((p (add-text-to-store %store "hello" "hello, world"))) + (valid-path? %store p))) + +(test-assert "valid-path? false" + (not (valid-path? %store + (string-append (%store-prefix) "/" + (make-string 32 #\e) "-foobar")))) + +(test-assert "valid-path? error" + (with-store s + (guard (c ((nix-protocol-error? c) #t)) + (valid-path? s "foo") + #f))) + +(test-assert "valid-path? recovery" + ;; Prior to Nix commit 51800e0 (18 Mar. 2014), the daemon would immediately + ;; close the connection after receiving a 'valid-path?' RPC with a non-store + ;; file name. See + ;; for + ;; details. + (with-store s + (let-syntax ((true-if-error (syntax-rules () + ((_ exp) + (guard (c ((nix-protocol-error? c) #t)) + exp #f))))) + (and (true-if-error (valid-path? s "foo")) + (true-if-error (valid-path? s "bar")) + (true-if-error (valid-path? s "baz")) + (true-if-error (valid-path? s "chbouib")) + (valid-path? s (add-text-to-store s "valid" "yeah")))))) (test-assert "hash-part->path" (let ((p (add-text-to-store %store "hello" "hello, world"))) -- cgit v1.2.3 root/gnu/packages/mp3.scm
AgeCommit message (Expand)Author
2023-02-19gnu: mpg123: Update to 1.31.2.Vasile Dumitrascu via Guix-patches via
2023-02-19gnu: Use HTTPS package home pages wherever possible.Tobias Geerinckx-Rice
2022-12-12gnu: ffmpeg: Promote version 5 to the default.Marius Bakke
2022-08-06gnu: Add wavbreaker.Joeke de Graaf
2022-08-03gnu: Add minimp3.John Kehayias
2022-04-04gnu: eyeD3: Update to 0.9.6.Leo Famulari
2022-01-16gnu: chromaprint: Update to 1.5.1.Tobias Geerinckx-Rice
2021-12-13gnu: Simplify package inputs.Ludovic Courtès
2021-09-18gnu: mpg321: Fix compiling with gcc 10.Guillaume Le Vaillant
2021-09-11gnu: mpc123: Allow compilation with GCC 10.Ludovic Courtès
2021-09-07Merge branch 'master' into core-updates-frozenLudovic Courtès
2021-09-04gnu: python-pyacoustid: Update to 1.2.2.Lars-Dominik Braun
2021-08-12Merge branch 'master' into core-updates-frozenMarius Bakke
2021-08-04gnu: mpg123: Update to 1.28.2.Efraim Flashner
2021-07-25gnu: gs-font: Rename to 'font-ghostscript'.Maxime Devos