[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/11: lint: vulnerabilities: Avoid 'mock' in test.
From: |
guix-commits |
Subject: |
03/11: lint: vulnerabilities: Avoid 'mock' in test. |
Date: |
Fri, 17 Jan 2020 08:25:45 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit fcb2318e51d33a9319619f9486a7ac486db2af37
Author: Ludovic Courtès <address@hidden>
AuthorDate: Fri Jan 17 11:27:37 2020 +0100
lint: vulnerabilities: Avoid 'mock' in test.
* guix/lint.scm (check-vulnerabilities): Add 'package-vulnerabilities'
optional parameter.
* tests/lint.scm ("cve: one vulnerability"): Use it instead of 'mock'.
---
guix/lint.scm | 7 +++++--
tests/lint.scm | 18 ++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/guix/lint.scm b/guix/lint.scm
index 697bd24..24fbf05 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -1029,8 +1029,11 @@ the NIST server non-fatal."
(package-version package))))
((force lookup) name version)))))
-(define (check-vulnerabilities package)
- "Check for known vulnerabilities for PACKAGE."
+(define* (check-vulnerabilities package
+ #:optional (package-vulnerabilities
+ package-vulnerabilities))
+ "Check for known vulnerabilities for PACKAGE. Obtain the list of
+vulnerability records for PACKAGE by calling PACKAGE-VULNERABILITIES."
(let ((package (or (package-replacement package) package)))
(match (package-vulnerabilities package)
(()
diff --git a/tests/lint.scm b/tests/lint.scm
index 3a9b539..4ce45b4 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013 Cyril Roelandt <address@hidden>
;;; Copyright © 2014, 2015, 2016 Eric Bavier <address@hidden>
-;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès
<address@hidden>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès
<address@hidden>
;;; Copyright © 2015, 2016 Mathieu Lirzin <address@hidden>
;;; Copyright © 2016 Hartmut Goebel <address@hidden>
;;; Copyright © 2017 Alex Kost <address@hidden>
@@ -756,14 +756,16 @@
(test-equal "cve: one vulnerability"
"probably vulnerable to CVE-2015-1234"
- (mock ((guix lint) package-vulnerabilities
+ (let ((dummy-vulnerabilities
(lambda (package)
- (list (make-struct/no-tail (@@ (guix cve) <vulnerability>)
- "CVE-2015-1234"
- (list (cons (package-name package)
- (package-version
package)))))))
- (single-lint-warning-message
- (check-vulnerabilities (dummy-package "pi" (version "3.14"))))))
+ (list (make-struct/no-tail
+ (@@ (guix cve) <vulnerability>)
+ "CVE-2015-1234"
+ (list (cons (package-name package)
+ (package-version package))))))))
+ (single-lint-warning-message
+ (check-vulnerabilities (dummy-package "pi" (version "3.14"))
+ dummy-vulnerabilities))))
(test-equal "cve: one patched vulnerability"
'()
- branch master updated (df18ea6 -> 05f8a14), guix-commits, 2020/01/17
- 01/11: packages: Prevent inlining of 'find-best-packages-by-name'., guix-commits, 2020/01/17
- 02/11: lint: derivation: Adjust exception handling for Guile 3., guix-commits, 2020/01/17
- 03/11: lint: vulnerabilities: Avoid 'mock' in test.,
guix-commits <=
- 04/11: doc: cookbook: Avoid URL reference to the manual., guix-commits, 2020/01/17
- 05/11: doc: Replace some invalid uses of @var with @code., guix-commits, 2020/01/17
- 06/11: import: opam: Avoid uses of '@@' in tests., guix-commits, 2020/01/17
- 09/11: gnu: Add imv., guix-commits, 2020/01/17
- 11/11: git-authenticate: Add new key for atheia., guix-commits, 2020/01/17
- 10/11: gnu: imv: Record the absolute file name of 'imv-x11' and 'imv-wayland'., guix-commits, 2020/01/17
- 07/11: import: texlive: Avoid uses of '@@' in tests., guix-commits, 2020/01/17
- 08/11: gnu: Add corsix-th., guix-commits, 2020/01/17