summaryrefslogtreecommitdiff
path: root/test/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers.c')
-rw-r--r--test/helpers.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/helpers.c b/test/helpers.c
index 975e7cb..491822e 100644
--- a/test/helpers.c
+++ b/test/helpers.c
@@ -49,14 +49,14 @@ void *t_calloc(size_t nmemb, size_t size)
/*
* Helper for creating file and write @size byte buf with 0xaa value in the file.
*/
-void t_create_file(const char *file, size_t size)
+static void __t_create_file(const char *file, size_t size, char pattern)
{
ssize_t ret;
char *buf;
int fd;
buf = t_malloc(size);
- memset(buf, 0xaa, size);
+ memset(buf, pattern, size);
fd = open(file, O_WRONLY | O_CREAT, 0644);
assert(fd >= 0);
@@ -68,6 +68,16 @@ void t_create_file(const char *file, size_t size)
assert(ret == size);
}
+void t_create_file(const char *file, size_t size)
+{
+ __t_create_file(file, size, 0xaa);
+}
+
+void t_create_file_pattern(const char *file, size_t size, char pattern)
+{
+ __t_create_file(file, size, pattern);
+}
+
/*
* Helper for creating @buf_num number of iovec
* with @buf_size bytes buffer of each iovec.