summaryrefslogtreecommitdiffstats
path: root/test/testutil.h
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2019-07-26 12:56:01 +1000
committerPauli <paul.dale@oracle.com>2019-07-29 09:11:15 +1000
commite9a5932d04f6b7dd25b39a8ff9dc162d64a78c22 (patch)
tree9acfb870745830b2c6aebcd1bcfc9260af3e1c45 /test/testutil.h
parent5d00f46e1527235ecd28a14c5413355c3ea66dfc (diff)
Add weak platform independent PRNG to test framework.
Implement the GNU C library's random(3) pseudorandom number generator. The algorithm is described: https://www.mscs.dal.ca/~selinger/random/ The rationale is to make the tests repeatable across differing platforms with different underlying implementations of the random(3) library call. More specifically: when executing tests with random ordering. [extended tests] Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/9463)
Diffstat (limited to 'test/testutil.h')
-rw-r--r--test/testutil.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/testutil.h b/test/testutil.h
index 3a5c4866da..00e2d0aa81 100644
--- a/test/testutil.h
+++ b/test/testutil.h
@@ -537,4 +537,12 @@ void test_clearstanza(STANZA *s);
*/
char *glue_strings(const char *list[], size_t *out_len);
+/*
+ * Pseudo random number generator of low quality but having repeatability
+ * across platforms. The two calls are replacements for random(3) and
+ * srandom(3).
+ */
+uint32_t test_random(void);
+void test_random_seed(uint32_t sd);
+
#endif /* HEADER_TESTUTIL_H */