diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-06-11 23:17:16 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-06-11 23:33:32 +0200 |
commit | 79477def6b08437e4eacaf67c012ae8717bd64e3 (patch) | |
tree | b7b743b63aff785c114035a116a139b4ceaea6d8 | |
parent | e21adc768e7e40362a26b60e73ecc30e988d79e0 (diff) | |
download | guix-79477def6b08437e4eacaf67c012ae8717bd64e3.tar.gz |
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.
-rw-r--r-- | guix/tests.scm | 10 |
1 files changed, 9 insertions, 1 deletions
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." |