guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: tests: Reduce the time required to run the installation test


From: guix-commits
Subject: 01/01: gnu: tests: Reduce the time required to run the installation tests.
Date: Tue, 11 Feb 2020 11:28:52 -0500 (EST)

apteryx pushed a commit to branch test2
in repository guix.

commit 936b146fc73fe5e2ddd133d38bd7d6da3882c9b6
Author: Maxim Cournoyer <address@hidden>
AuthorDate: Sun Nov 17 06:01:00 2019 +0900

    gnu: tests: Reduce the time required to run the installation tests.
    
    When setting the GUIX_DEV_HACKS environment variable, the Guix package used
    inside the instrumented VMs recycles the binaries already found in the Guix
    checkout of the developer instead of rebuilding Guix from scratch.  This
    brings the time required for this component from 20+ minutes down to  
minutes
    on an X200 machine.
    
    * gnu/packages/package-management.scm (current-guix/pre-built): New 
procedure.
    * build-aux/run-system-tests.scm (tests-for-channel-instance): Use it, when
    GUIX_DEV_HACKS is defined.
---
 build-aux/run-system-tests.scm      | 10 +++++-
 gnu/packages/package-management.scm | 66 +++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/build-aux/run-system-tests.scm b/build-aux/run-system-tests.scm
index b0cb3bd..e6fda05 100644
--- a/build-aux/run-system-tests.scm
+++ b/build-aux/run-system-tests.scm
@@ -58,8 +58,16 @@ instance."
   ;; of tests to run in the usual way:
   ;;
   ;;   make check-system TESTS=installed-os
+
+  ;; When the GUIX_DEV_HACKS environment variable is defined, override the
+  ;; package returned by `current-guix' with a flavor that saves recompiling
+  ;; Guix from scratch and reuse the developer's checkout binaries.  The
+  ;; override "builds" about 20 times faster than the regular `current-guix'
+  ;; package, which can help speed iterative development.
   (parameterize ((current-guix-package
-                  (channel-instance->package instance)))
+                  (if (getenv "GUIX_DEV_HACKS")
+                      (current-guix/pre-built)
+                      (channel-instance->package instance))))
     (match (getenv "TESTS")
       (#f
        (all-system-tests))
diff --git a/gnu/packages/package-management.scm 
b/gnu/packages/package-management.scm
index 422d4f1..bd2ed85 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -468,6 +468,72 @@ out) and returning a package that uses that as its 
'source'."
                                 #:recursive? #t
                                 #:select? (force select?))))))))
 
+(define-public (current-guix/pre-built)
+  "Similar to `current-guix', but with a modified build procedure that
+reuses the existing byte compiled artifacts to save recompilation time."
+
+  (let* ( ;; The `current-source-directory' macro doesn't work from the REPL.
+         ;; For testing, you can replace it with a static string pointing to
+         ;; your Guix checkout directory.
+         (repository-root (delay (canonicalize-path
+                                  (string-append (current-source-directory)
+                                                 "/../.."))))
+         (select? (lambda (file stat)
+                    (match (basename file)
+                      ((or ".git"
+                           "configure" "autom4te.cache"
+                           "config.log" "config.status"
+                           "stamp-1" "stamp-2" "stamp-3" "stamp-4" "stamp-5"
+                           "stamp-h1" "stamp-vti"
+                           "Makefile" "Makefile.in" ".libs"
+                           ".deps" ".dirstamp"
+                           "test-tmp"
+                           ) #f)
+                      (_ #t)))))
+    (package
+      (inherit guix)
+      (version (string-append (package-version guix) "+"))
+      (source (local-file (force repository-root) "guix-current"
+                          #:recursive? #t
+                          #:select? select?))
+      (arguments
+       (substitute-keyword-arguments (package-arguments guix)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             ;; XXX: References to tools such as 'mkdir' and 'install' are
+             ;; captured in Makefile.in when 'autoconf' is run.  It'd be nicer
+             ;; to find those at configuration time.
+             (delete 'copy-bootstrap-guile)
+             (delete 'check)
+             (delete 'disable-failing-tests)
+             (delete 'strip)            ;can't strip .go files anyway
+             (replace 'build
+               (lambda _
+                 ;; Set the write permission bit on some files that need to be
+                 ;; touched.
+                 (chmod "nix" #o777)
+                 (for-each (lambda (f)
+                             (chmod f #o666))
+                           (cons* "guix-daemon"
+                                  (find-files "." ".*\\.(a|o)$")))
+
+                 ;; The following prevent 'make install' from rebuilding the
+                 ;; daemon and the documentation.
+                 (invoke "make" "--touch" "info"
+                         ;; TODO: Currently we must rebuild the daemon as it
+                         ;; was linked against external dependencies that
+                         ;; depend on the provenance of the profile (or
+                         ;; environment) that was used to build it.
+
+                         ;; If we could query the provenance of any profile,
+                         ;; we could make this package inherit from the guix
+                         ;; inferior that was used to provide such
+                         ;; dependencies.  The most reliable way would
+                         ;; probably be to record that provenance at build
+                         ;; time (as a make target).
+                         ;"guix-daemon"
+                         ))))))))))
+
 
 ;;;
 ;;; Other tools.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]