summaryrefslogtreecommitdiff
path: root/libparted/tests/common.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2006-12-11 07:46:34 -0200
committerOtavio Salvador <otavio@ossystems.com.br>2006-12-11 07:46:34 -0200
commit6928477436823359850941fabd78444635752095 (patch)
tree3e8fbb19770aad82a67522fd7af93e376fcd7a4f /libparted/tests/common.c
parentc95d7f912f577c6188c4900826f50ddd54505b4e (diff)
downloadparted-6928477436823359850941fabd78444635752095.tar.gz
Include a disk probing test
Diffstat (limited to 'libparted/tests/common.c')
-rw-r--r--libparted/tests/common.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libparted/tests/common.c b/libparted/tests/common.c
new file mode 100644
index 0000000..9a4aeb5
--- /dev/null
+++ b/libparted/tests/common.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+
+#include "common.h"
+
+
+char *_create_disk(const off_t size)
+{
+ char filename[] = "parted-test-XXXXXX";
+ mktemp(filename);
+
+ FILE *disk = fopen(filename, "w");
+ off_t total_size = size * 1024 * 1024; /* Mb */
+
+ fseek(disk, total_size, SEEK_SET);
+ fwrite("", sizeof(char), sizeof(char), disk);
+ fclose(disk);
+
+ return strdup(filename);
+}