From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Daniel_Sch=c3=a4fer?= Subject: Fwd: Running individual system tests Date: Sat, 19 Oct 2019 12:06:25 +0200 Message-ID: <7a1ea893-6ec0-5312-a013-cdc246a1e1e5@danielschaefer.me> References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------4F4BB7D907A75490861B1851" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:49812) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLld6-0005k3-Vq for guix-devel@gnu.org; Sat, 19 Oct 2019 06:06:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLld5-0001xq-48 for guix-devel@gnu.org; Sat, 19 Oct 2019 06:06:36 -0400 Received: from ciffreo.uberspace.de ([185.26.156.173]:55806) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iLld4-0001sT-Pc for guix-devel@gnu.org; Sat, 19 Oct 2019 06:06:35 -0400 In-Reply-To: Content-Language: en-US List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org This is a multi-part message in MIME format. --------------4F4BB7D907A75490861B1851 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Guix developers, I'm still trying to figure out, how to run a single Guix system test without building the entirety of Guix. Does anybody do this? Has anybody written a Guix system test for something not in Guix? Maybe a personal or work-related project. CC'ing some people who've added guix system tests. Thanks, Daniel -------- Forwarded Message -------- Subject: Running individual system tests Date: Tue, 15 Oct 2019 13:21:45 +0200 From: Daniel Schäfer To: help-guix@gnu.org Hi Guix, Guix System has nice system tests, as described in [1] but they don't easily allow to run a single test. The manual says to run `make check-system TESTS="basic mcron"` in the guix source tree. That, however, (apparently) requires to be bootstrapped, configured and all Scheme files to be fully built. Is there something as simple as: $ guix build -f gnu/tests/rsync.scm guix build: error: #: not something we can build --- I hacked together a solution that works but is far from nice. It is based off of build-aux/run-system-tests.scm and I tried to strip it down to the core. $ cat run-test.scm (use-modules (gnu tests rsync)              (gnu tests)              (guix store)              (guix status)              (guix monads)              (guix derivations)              (guix ui)              (srfi srfi-1)              (srfi srfi-34)) (define (built-derivations* drv)   (lambda (store)     (guard (c ((store-protocol-error? c)                (values #f store)))       (values (build-derivations store drv) store)))) (system-test-value %test-rsync)   (with-store store     (with-status-verbosity 2       (run-with-store store         (mlet* %store-monad ((drv (mapm %store-monad system-test-value (list %test-rsync)))                              (out -> (map derivation->output-path drv)))           (mbegin %store-monad             (show-what-to-build* drv)             (set-build-options* #:keep-going? #t #:keep-failed? #t                                 #:print-build-trace #t                                 #:print-extended-build-trace? #t                                 #:fallback? #t)             (built-derivations* drv)             (display out)))))) $ guile -s run-test.scm (/gnu/store/scifaigbvcj20lplj3mvqj3ndr9w0nlv-rsync-test)Backtrace:            8 (apply-smob/1 #) In ice-9/boot-9.scm:     705:2  7 (call-with-prompt _ _ #) In ice-9/eval.scm:     619:8  6 (_ #(#(#))) In ice-9/boot-9.scm:    2312:4  5 (save-module-excursion _)   3831:12  4 (_) In /home/zoid/guix/gnu/tests/run-test.scm:      19:4  3 (_) In guix/status.scm:     810:4  2 (call-with-status-report _ _) In guix/store.scm:   1737:24  1 (run-with-store _ _ #:guile-for-build _ #:system _ # _) In unknown file:            0 (_ #) ERROR: Wrong type to apply: # It shows the derivation output path before the backtrace and thus I can inspect the log. Can I do this in a nicer way? It would be very helpful for out-of-tree system tests. Thanks - Daniel [1] https://guix.gnu.org/blog/2016/guixsd-system-tests/ --------------4F4BB7D907A75490861B1851 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi Guix developers,

I'm still trying to figure out, how to run a single Guix system test without building the entirety of Guix.
Does anybody do this? Has anybody written a Guix system test for something not in Guix? Maybe a personal or work-related project.

CC'ing some people who've added guix system tests.

Thanks,
Daniel

-------- Forwarded Message --------
Subject: Running individual system tests
Date: Tue, 15 Oct 2019 13:21:45 +0200
From: Daniel Schäfer <daniel@danielschaefer.me>
To: help-guix@gnu.org


Hi Guix,

Guix System has nice system tests, as described in [1] but they don't easily allow to run a single test.

The manual says to run `make check-system TESTS="basic mcron"` in the guix source tree.
That, however, (apparently) requires to be bootstrapped, configured and all Scheme files to be fully built.

Is there something as simple as:

$ guix build -f gnu/tests/rsync.scm
guix build: error: #<unspecified>: not something we can build

---

I hacked together a solution that works but is far from nice.
It is based off of build-aux/run-system-tests.scm and I tried to strip it down to the core.

$ cat run-test.scm
(use-modules (gnu tests rsync)
             (gnu tests)
             (guix store)
             (guix status)
             (guix monads)
             (guix derivations)
             (guix ui)
             (srfi srfi-1)
             (srfi srfi-34))

(define (built-derivations* drv)
  (lambda (store)
    (guard (c ((store-protocol-error? c)
               (values #f store)))
      (values (build-derivations store drv) store))))

(system-test-value %test-rsync)
  (with-store store
    (with-status-verbosity 2
      (run-with-store store
        (mlet* %store-monad ((drv (mapm %store-monad system-test-value (list %test-rsync)))
                             (out -> (map derivation->output-path drv)))
          (mbegin %store-monad
            (show-what-to-build* drv)
            (set-build-options* #:keep-going? #t #:keep-failed? #t
                                #:print-build-trace #t
                                #:print-extended-build-trace? #t
                                #:fallback? #t)
            (built-derivations* drv)
            (display out))))))

$ guile -s run-test.scm
(/gnu/store/scifaigbvcj20lplj3mvqj3ndr9w0nlv-rsync-test)Backtrace:
           8 (apply-smob/1 #<catch-closure 7353e0>)
In ice-9/boot-9.scm:
    705:2  7 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
    619:8  6 (_ #(#(#<directory (guile-user) 7cd140>)))
In ice-9/boot-9.scm:
   2312:4  5 (save-module-excursion _)
  3831:12  4 (_)
In /home/zoid/guix/gnu/tests/run-test.scm:
     19:4  3 (_)
In guix/status.scm:
    810:4  2 (call-with-status-report _ _)
In guix/store.scm:
  1737:24  1 (run-with-store _ _ #:guile-for-build _ #:system _ # _)
In unknown file:
           0 (_ #<store-connection 256.99 3b8dd20>)

ERROR: Wrong type to apply: #<unspecified>


It shows the derivation output path before the backtrace and thus I can inspect the log.
Can I do this in a nicer way?
It would be very helpful for out-of-tree system tests.

Thanks

- Daniel

[1] https://guix.gnu.org/blog/2016/guixsd-system-tests/


--------------4F4BB7D907A75490861B1851--