summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-02-14 19:05:45 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-02-14 19:05:45 +0100
commit7edafc884c2a21258541b17a231051702c458263 (patch)
treed4202c8d6516bacd32fa55ee23c54b069ef8abd6 /tests
parent89da127035737bdf922bc566970c5506c2e01b00 (diff)
parent64fc4f3705423c83c680a95d8dea81a39fce9a70 (diff)
downloadguix-7edafc884c2a21258541b17a231051702c458263.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/gem.scm4
-rw-r--r--tests/graph.scm4
-rw-r--r--tests/guix-build.sh9
-rw-r--r--tests/syscalls.scm55
4 files changed, 44 insertions, 28 deletions
diff --git a/tests/gem.scm b/tests/gem.scm
index 5158238d18..455fc15189 100644
--- a/tests/gem.scm
+++ b/tests/gem.scm
@@ -55,7 +55,7 @@
       { \"name\": \"bundler\" },
     ]
   },
-  \"licenses\": [\"MIT\", \"Apache 2.0\"]
+  \"licenses\": null
 }")
 
 (define test-bundler-json
@@ -138,7 +138,7 @@
               ('synopsis "Another cool gem")
               ('description "Another cool gem")
               ('home-page "https://example.com")
-              ('license ('list 'license:expat 'license:asl2.0)))
+              ('license #f))                      ;no licensing info
             ('package
               ('name "ruby-bundler")
               ('version "1.14.2")
diff --git a/tests/graph.scm b/tests/graph.scm
index b7732ec709..402847102f 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -195,7 +195,7 @@ edges."
   (let-values (((dune bap ocaml-base)
                 (values (specification->package "dune")
                         (specification->package "bap")
-                        (specification->package "ocaml-base")))
+                        (specification->package "ocaml4.07-base")))
                ((backend nodes+edges) (make-recording-backend)))
     (run-with-store %store
       (export-graph (list dune) 'port
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 21b6af4395..c1df6db3a4 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -1,5 +1,6 @@
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -308,6 +309,14 @@ cat > "$module_dir/gexp.scm"<<EOF
 EOF
 guix build --file="$module_dir/gexp.scm" -d
 guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
+
+# Building from a manifest file.
+cat > "$module_dir/manifest.scm"<<EOF
+(specifications->manifest '("hello" "guix"))
+EOF
+test `guix build -d --manifest="$module_dir/manifest.scm" \
+      | grep -e '-hello-' -e '-guix-' \
+      | wc -l` -eq 2
 rm "$module_dir"/*.scm
 
 # Using 'GUIX_BUILD_OPTIONS'.
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 1b3121e503..7fe0cd1545 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -161,29 +161,22 @@
              (waitpid fork-pid)
              result))))))))
 
-;; XXX: Skip this test when running Linux > 4.7.5 to work around
-;; <https://bugzilla.kernel.org/show_bug.cgi?id=183461>.
-(when (or (not perform-container-tests?)
-          (version>? (utsname:release (uname)) "4.7.5")
-
-          ;; Skip on Ubuntu's 4.4 kernels, which contain a backport of the
-          ;; faulty code: <https://bugs.gnu.org/25476>.
-          (member (utsname:release (uname))
-                  '("4.4.0-21-generic" "4.4.0-59-generic"
-                    "4.4.0-116-generic")))
+(when (not perform-container-tests?)
   (test-skip 1))
 (test-equal "pivot-root"
-  #t
-  (match (pipe)
-    ((in . out)
+  'success!
+  (match (socketpair AF_UNIX SOCK_STREAM 0)
+    ((parent . child)
      (match (clone (logior CLONE_NEWUSER CLONE_NEWNS SIGCHLD))
        (0
         (dynamic-wind
           (const #t)
           (lambda ()
-            (close in)
+            (close parent)
             (call-with-temporary-directory
              (lambda (root)
+               (display "ready\n" child)
+               (read child)                       ;wait for "go!"
                (let ((put-old (string-append root "/real-root")))
                  (mount "none" root "tmpfs")
                  (mkdir put-old)
@@ -192,18 +185,32 @@
                      (display "testing\n" port)))
                  (pivot-root root put-old)
                  ;; The test file should now be located inside the root directory.
-                 (write (file-exists? "/test") out)
-                 (close out)))))
+                 (write (and (file-exists? "/test") 'success!) child)
+                 (close child)))))
           (lambda ()
             (primitive-exit 0))))
        (pid
-        (close out)
-        (let ((result (read in)))
-          (close in)
-          (and (zero? (match (waitpid pid)
-                        ((_ . status)
-                         (status:exit-val status))))
-               (eq? #t result))))))))
+        (close child)
+        (match (read parent)
+          ('ready
+           ;; Set up the UID/GID mapping so that we can mkdir on the tmpfs:
+           ;; <https://bugzilla.kernel.org/show_bug.cgi?id=183461>.
+           (call-with-output-file (format #f "/proc/~d/setgroups" pid)
+             (lambda (port)
+               (display "deny" port)))
+           (call-with-output-file (format #f "/proc/~d/uid_map" pid)
+             (lambda (port)
+               (format port "0 ~d 1" (getuid))))
+           (call-with-output-file (format #f "/proc/~d/gid_map" pid)
+             (lambda (port)
+               (format port "0 ~d 1" (getgid))))
+           (display "go!\n" parent)
+           (let ((result (read parent)))
+             (close parent)
+             (and (zero? (match (waitpid pid)
+                           ((_ . status)
+                            (status:exit-val status))))
+                  result)))))))))
 
 (test-equal "scandir*, ENOENT"
   ENOENT