From 79477def6b08437e4eacaf67c012ae8717bd64e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 11 Jun 2015 23:17:16 +0200 Subject: [PATCH] tests: Write the random seed to the error port. * guix/tests.scm (random-seed): New procedure. (%seed): Use it, and write the random seed to the error port. --- guix/tests.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/guix/tests.scm b/guix/tests.scm index 87e6cc2830..a19eda250c 100644 --- a/guix/tests.scm +++ b/guix/tests.scm @@ -63,8 +63,16 @@ store))) +(define (random-seed) + (or (and=> (getenv "GUIX_TESTS_RANDOM_SEED") + number->string) + (logxor (getpid) (car (gettimeofday))))) + (define %seed - (seed->random-state (logxor (getpid) (car (gettimeofday))))) + (let ((seed (random-seed))) + (format (current-error-port) "random seed for tests: ~a~%" + seed) + (seed->random-state seed))) (define (random-text) "Return the hexadecimal representation of a random number."