aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_disk.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-11-01 20:47:52 +0000
committerChristian Grothoff <christian@grothoff.org>2009-11-01 20:47:52 +0000
commit652e89b59ed2207c2c12172fdabcd6e659995c81 (patch)
treef054c819d483c1056e18c1099afd4c7fcd2582a0 /src/util/test_disk.c
parent5e4113e83368849500792e57946c3d8dd9e548d8 (diff)
downloadgnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.tar.gz
gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.zip
fixing bio testcase and a bug in bio.c, also indenting
Diffstat (limited to 'src/util/test_disk.c')
-rw-r--r--src/util/test_disk.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/util/test_disk.c b/src/util/test_disk.c
index 8b485edc5..c84ec812a 100644
--- a/src/util/test_disk.c
+++ b/src/util/test_disk.c
@@ -36,10 +36,11 @@ testReadWrite ()
36 char tmp[100 + 1]; 36 char tmp[100 + 1];
37 int ret; 37 int ret;
38 38
39 if (strlen(TESTSTRING) != 39 if (strlen (TESTSTRING) !=
40 GNUNET_DISK_fn_write (".testfile", TESTSTRING, 40 GNUNET_DISK_fn_write (".testfile", TESTSTRING,
41 strlen (TESTSTRING), 41 strlen (TESTSTRING),
42 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)) 42 GNUNET_DISK_PERM_USER_READ |
43 GNUNET_DISK_PERM_USER_WRITE))
43 return 1; 44 return 1;
44 if (GNUNET_OK != GNUNET_DISK_file_test (".testfile")) 45 if (GNUNET_OK != GNUNET_DISK_file_test (".testfile"))
45 return 1; 46 return 1;
@@ -92,8 +93,9 @@ testOpenClose ()
92 long avail; 93 long avail;
93 94
94 fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE 95 fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE
95 | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ 96 | GNUNET_DISK_OPEN_CREATE,
96 | GNUNET_DISK_PERM_USER_WRITE); 97 GNUNET_DISK_PERM_USER_READ |
98 GNUNET_DISK_PERM_USER_WRITE);
97 GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh)); 99 GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh));
98 GNUNET_break (5 == GNUNET_DISK_file_write (fh, "Hello", 5)); 100 GNUNET_break (5 == GNUNET_DISK_file_write (fh, "Hello", 5));
99 GNUNET_DISK_file_close (fh); 101 GNUNET_DISK_file_close (fh);
@@ -108,8 +110,9 @@ testOpenClose ()
108 avail = GNUNET_DISK_get_blocks_available (".testfile"); 110 avail = GNUNET_DISK_get_blocks_available (".testfile");
109 GNUNET_log_skip (0, GNUNET_NO); 111 GNUNET_log_skip (0, GNUNET_NO);
110 fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE 112 fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE
111 | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_WRITE 113 | GNUNET_DISK_OPEN_CREATE,
112 | GNUNET_DISK_PERM_USER_READ); 114 GNUNET_DISK_PERM_USER_WRITE |
115 GNUNET_DISK_PERM_USER_READ);
113 GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh)); 116 GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh));
114 while ((avail == GNUNET_DISK_get_blocks_available (".testfile")) && 117 while ((avail == GNUNET_DISK_get_blocks_available (".testfile")) &&
115 (avail != -1)) 118 (avail != -1))
@@ -138,11 +141,14 @@ scan_callback (void *want, const char *filename)
138static int 141static int
139testDirScan () 142testDirScan ()
140{ 143{
141 if (GNUNET_OK != GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry")) 144 if (GNUNET_OK !=
145 GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry"))
142 return 1; 146 return 1;
143 if (GNUNET_OK != GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry_more")) 147 if (GNUNET_OK !=
148 GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry_more"))
144 return 1; 149 return 1;
145 GNUNET_DISK_directory_scan ("test", &scan_callback, "test" DIR_SEPARATOR_STR "entry"); 150 GNUNET_DISK_directory_scan ("test", &scan_callback,
151 "test" DIR_SEPARATOR_STR "entry");
146 if (GNUNET_OK != GNUNET_DISK_directory_remove ("test")) 152 if (GNUNET_OK != GNUNET_DISK_directory_remove ("test"))
147 return 1; 153 return 1;
148 if (ok < 2) 154 if (ok < 2)