aboutsummaryrefslogtreecommitdiff
path: root/tests/torture.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-12-13 14:49:13 +0100
committerAndreas Schneider <asn@samba.org>2013-12-17 14:30:30 +0100
commit356fc983ec7f3147b5685fa6dc586959ec50b0ea (patch)
tree6891bc7cd2d409d3ac60a8c03693edb60bcdb324 /tests/torture.c
parent2ee37e01cf0a48553a19f2714fb4252d967711df (diff)
downloadsocket_wrapper-356fc983ec7f3147b5685fa6dc586959ec50b0ea.tar.gz
socket_wrapper-356fc983ec7f3147b5685fa6dc586959ec50b0ea.tar.xz
socket_wrapper-356fc983ec7f3147b5685fa6dc586959ec50b0ea.zip
torture: Add torture_generate_random_buffer().
Diffstat (limited to 'tests/torture.c')
-rw-r--r--tests/torture.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/torture.c b/tests/torture.c
index e2bab8c..ea3c9a6 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -46,6 +46,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <time.h>
#define TORTURE_SOCKET_DIR "/tmp/test_socket_wrapper_XXXXXX"
#define TORTURE_ECHO_SRV_PIDFILE "echo_srv.pid"
@@ -168,3 +169,14 @@ void torture_teardown_echo_srv(void **state)
done:
torture_teardown_socket_dir(state);
}
+
+void torture_generate_random_buffer(uint8_t *out, int len)
+{
+ int i;
+
+ srand(time(NULL));
+
+ for (i = 0; i < len; i++) {
+ out[i] = (uint8_t)rand();
+ }
+}