summary refs log tree commit diff
path: root/gnu/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-15 12:09:48 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-15 12:18:51 +0200
commit8b310793d2b7d3cf5b3a5301423640dcf68e2528 (patch)
treec797a640beb291bb2083e8120cdf4c369d68b2f1 /gnu/tests
parent604b167bf27d307c5bd30145b6486f90417d0d06 (diff)
downloadguix-8b310793d2b7d3cf5b3a5301423640dcf68e2528.tar.gz
tests: 'getlogin' test creates its file atomically.
Previously we could end up reading an empty /root/login-id file.

* gnu/tests/base.scm (run-basic-test)["getlogin on tty1"]: Create
/root/login-id atomically.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/base.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index d578f1977a..cf942fe5e1 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -311,7 +311,9 @@ info --version")
             "\"root\""
             (begin
               ;; Assume we logged in in the previous test and type.
-              (marionette-type "guile -c '(write (getlogin))' > /root/login-id\n"
+              (marionette-type "guile -c '(write (getlogin))' > /root/login-id.tmp\n"
+                               marionette)
+              (marionette-type "mv /root/login-id{.tmp,}\n"
                                marionette)
 
               ;; It can take a while before the shell commands are executed.