summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-11-26 12:12:00 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-11-26 12:12:00 +0000
commit0b5513d2ae7ebdebd601fb379f8dcedf4db8ff55 (patch)
tree0a438867bb33ce22880d8e97f884dab4f2821e46 /common
parent48ce703ca92056265f6f036f42c8f8843700d15f (diff)
Add test for files with page size
Diffstat (limited to 'common')
-rw-r--r--common/test_textfile.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/common/test_textfile.c b/common/test_textfile.c
index 1c001f46..14320c17 100644
--- a/common/test_textfile.c
+++ b/common/test_textfile.c
@@ -43,11 +43,26 @@ int main(int argc, char *argv[])
{
char filename[] = "/tmp/textfile";
char key[18], value[512], *str;
- int i, j, fd, max = 10;
+ int i, j, fd, err, size, max = 10;
+
+ size = getpagesize();
+ printf("System uses a page size of %d bytes\n\n", size);
fd = creat(filename, 0644);
+ err = ftruncate(fd, 0);
+
+ memset(value, 0, sizeof(value));
+ for (i = 0; i < (size / sizeof(value)); i++)
+ err = write(fd, value, sizeof(value));
+
close(fd);
+ sprintf(key, "11:11:11:11:11:11");
+ str = textfile_get(filename, key);
+
+ err = truncate(filename, 0);
+
+
sprintf(key, "00:00:00:00:00:00");
if (textfile_del(filename, key) < 0)
fprintf(stderr, "%s (%d)\n", strerror(errno), errno);