From 0f4432c620f8d569ef29ca74bad2b7eebd803441 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 1 Feb 2019 15:58:12 +0100 Subject: import: opam: Fix conditions. * guix/import/opam.scm (condition-eq, condition-neq): The first argument can be empty. * tests/opam.scm: Add test case. --- tests/opam.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/opam.scm b/tests/opam.scm index e0ec5ef3d4..e8c0d15198 100644 --- a/tests/opam.scm +++ b/tests/opam.scm @@ -192,6 +192,8 @@ url { ("{>= \"0.2.0\" | build}" . (condition-or (condition-greater-or-equal (condition-string "0.2.0")) - (condition-var "build")))))) + (condition-var "build"))) + ("{ = \"1.0+beta19\" }" . (condition-eq + (condition-string "1.0+beta19")))))) (test-end "opam") -- cgit v1.2.3 From d59124280851c5d62b6ecf5aa07f6b4f6520a0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 5 Feb 2019 22:58:13 +0100 Subject: daemon: Emit a 'build-succeeded' event in check mode. Until now, something like "guix build sed -v1 --check" would not get a 'build-succeeded' event, which in turn meant that the spinner would not be erased upon build completion. * nix/libstore/build.cc (DerivationGoal::registerOutputs): When 'buildMode' is bmCheck and 'settings.printBuildTrace' emit a "@ build-succeeded" trace upon success. * tests/store.scm ("build-succeeded trace in check mode"): New test. --- tests/store.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/store.scm b/tests/store.scm index e28c0c5aaa..df66feaebb 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -917,6 +917,19 @@ (build-mode check)) #f)))))))) +(test-assert "build-succeeded trace in check mode" + (string-contains + (call-with-output-string + (lambda (port) + (let ((d (build-expression->derivation + %store "foo" '(mkdir (assoc-ref %outputs "out")) + #:guile-for-build + (package-derivation %store %bootstrap-guile)))) + (build-derivations %store (list d)) + (parameterize ((current-build-output-port port)) + (build-derivations %store (list d) (build-mode check)))))) + "@ build-succeeded")) + (test-assert "build multiple times" (with-store store ;; Ask to build twice. -- cgit v1.2.3 From 487cbb0164c715e722b622fa800fa0b217fa132c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 7 Feb 2019 14:54:43 +0100 Subject: profiles: Raise an error for unmatched patterns. Previously, "guix package -r something-not-installed" would silently complete. Now an error is raised. * guix/profiles.scm (&unmatched-pattern-error): New condition type. (manifest-matching-entries): Rewrite to raise an error when one of PATTERNS is not matched. * guix/ui.scm (call-with-error-handling): Handle 'unmatched-pattern-error?'. * tests/guix-package.sh: Add test. * tests/profiles.scm ("manifest-matching-entries"): Don't try to remove unmatched pattern. ("manifest-matching-entries, no match"): New test. ("manifest-transaction-effects"): Remove 'remove' field. --- tests/guix-package.sh | 7 ++++++- tests/profiles.scm | 17 +++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 7eeb4304d1..0d60481895 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès # Copyright © 2013 Nikita Karetnikov # # This file is part of GNU Guix. @@ -97,6 +97,11 @@ then false; else true; fi if guix package --bootstrap -i "guile-bootstrap:does-not-exist" -p "$profile"; then false; else true; fi +# Make sure we get an error when trying to remove something that's not +# installed. +if guix package --bootstrap -r something-not-installed -p "$profile"; +then false; else true; fi + # Check whether `--list-available' returns something sensible. guix package -p "$profile" -A 'gui.*e' | grep guile diff --git a/tests/profiles.scm b/tests/profiles.scm index 9a05030aff..eef93e24cf 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -93,10 +93,7 @@ (test-assert "manifest-matching-entries" (let* ((e (list guile-2.0.9 guile-2.0.9:debug)) (m (manifest e))) - (and (null? (manifest-matching-entries m - (list (manifest-pattern - (name "python"))))) - (equal? e + (and (equal? e (manifest-matching-entries m (list (manifest-pattern (name "guile") @@ -107,6 +104,15 @@ (name "guile") (version "2.0.9")))))))) +(test-assert "manifest-matching-entries, no match" + (let ((m (manifest (list guile-2.0.9))) + (p (manifest-pattern (name "python")))) + (guard (c ((unmatched-pattern-error? c) + (and (eq? p (unmatched-pattern-error-pattern c)) + (eq? m (unmatched-pattern-error-manifest c))))) + (manifest-matching-entries m (list p)) + #f))) + (test-assert "manifest-remove" (let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug))) (m1 (manifest-remove m0 @@ -165,8 +171,7 @@ (test-assert "manifest-transaction-effects" (let* ((m0 (manifest (list guile-1.8.8))) (t (manifest-transaction - (install (list guile-2.0.9 glibc)) - (remove (list (manifest-pattern (name "coreutils"))))))) + (install (list guile-2.0.9 glibc))))) (let-values (((remove install upgrade downgrade) (manifest-transaction-effects m0 t))) (and (null? remove) (null? downgrade) -- cgit v1.2.3