diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2006-12-11 07:46:34 -0200 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2006-12-11 07:46:34 -0200 |
commit | 6928477436823359850941fabd78444635752095 (patch) | |
tree | 3e8fbb19770aad82a67522fd7af93e376fcd7a4f /libparted/tests/common.c | |
parent | c95d7f912f577c6188c4900826f50ddd54505b4e (diff) | |
download | parted-6928477436823359850941fabd78444635752095.tar.gz |
Include a disk probing test
Diffstat (limited to 'libparted/tests/common.c')
-rw-r--r-- | libparted/tests/common.c | 22 |
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); +} |