diff mbox series

[bug#49766] gnu: rocksdb: set TEST_TMPDIR for faster test i/o.

Message ID 20210729050026.18416-1-ryan@arctype.co
State Accepted
Headers show
Series [bug#49766] gnu: rocksdb: set TEST_TMPDIR for faster test i/o. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Ryan Sundberg July 29, 2021, 5 a.m. UTC
The rocksdb test can take an egregious amount of time on a spinning HDD.
This will inherit guixbuild's /tmp mount for the rocksdb testing
directory.

* gnu/packages/databases.scm (rocksdb)[arguments]: set TEST_TMPDIR for
check phase
---
 gnu/packages/databases.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Ryan Sundberg July 29, 2021, 5:08 a.m. UTC | #1
Revised patch
Ryan Sundberg July 29, 2021, 5:13 a.m. UTC | #2
Revised patch attached.
diff mbox series

Patch

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 5de79de955..cd19d14950 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -1395,10 +1395,19 @@  including field and record folding.")))
                (("install: install-static")
                 "install: install-shared")
                (("#!/bin/sh") (string-append "#!" (which "sh"))))
-             #t))
+             #t)) 
          (delete 'configure)
          ;; The default target is only needed for tests and built on demand.
          (delete 'build)
+         (add-before 'check 'mount-tmp
+           ;; Use the provided workspace directory for test files.
+           ;; Otherwise, /tmp is used which is a mount namespace on /gnu/store.
+           ;; This speeds up the build when the host /tmp is a proper tmpfs or
+           ;; other fast filesystem, as opposed to /gnu which may be a HDD.
+           (lambda _
+             (let ((test-dir (string-append (getcwd) "/../test")))
+               (mkdir test-dir)
+               (setenv "TEST_TMPDIR" (canonicalize-path test-dir)))))
          (add-before 'check 'disable-optimizations
            (lambda _
              ;; Prevent the build from passing '-march=native' to the compiler.
@@ -1429,6 +1438,7 @@  including field and record folding.")))
        ("perl" ,perl)
        ("procps" ,procps)
        ("python" ,python-2)
+       ("util-linux" ,util-linux)
        ("which" ,which)))
     (inputs
      `(("bzip2" ,bzip2)