X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Ftest_disk.c;h=f06ffacaf02647cadafc0c092875d40a6b13f033;hb=94f01bdd2fda575769f01f8072689fa6936af8f4;hp=705a24abfd3424c375d1678ef2909c10d6c56d2b;hpb=d44fc929558cd9cbe3c94d057f0a2711a383b85c;p=oweals%2Fgnunet.git diff --git a/src/util/test_disk.c b/src/util/test_disk.c index 705a24abf..f06ffacaf 100644 --- a/src/util/test_disk.c +++ b/src/util/test_disk.c @@ -36,8 +36,11 @@ testReadWrite () char tmp[100 + 1]; int ret; - if (GNUNET_OK != GNUNET_DISK_fn_write (".testfile", TESTSTRING, strlen ( - TESTSTRING), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)) + if (strlen (TESTSTRING) != + GNUNET_DISK_fn_write (".testfile", TESTSTRING, + strlen (TESTSTRING), + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE)) return 1; if (GNUNET_OK != GNUNET_DISK_file_test (".testfile")) return 1; @@ -90,8 +93,9 @@ testOpenClose () long avail; fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE - | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE); + | GNUNET_DISK_OPEN_CREATE, + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE); GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh)); GNUNET_break (5 == GNUNET_DISK_file_write (fh, "Hello", 5)); GNUNET_DISK_file_close (fh); @@ -106,8 +110,9 @@ testOpenClose () avail = GNUNET_DISK_get_blocks_available (".testfile"); GNUNET_log_skip (0, GNUNET_NO); fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE - | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_WRITE - | GNUNET_DISK_PERM_USER_READ); + | GNUNET_DISK_OPEN_CREATE, + GNUNET_DISK_PERM_USER_WRITE | + GNUNET_DISK_PERM_USER_READ); GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh)); while ((avail == GNUNET_DISK_get_blocks_available (".testfile")) && (avail != -1)) @@ -136,11 +141,14 @@ scan_callback (void *want, const char *filename) static int testDirScan () { - if (GNUNET_OK != GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry")) + if (GNUNET_OK != + GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry")) return 1; - if (GNUNET_OK != GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry_more")) + if (GNUNET_OK != + GNUNET_DISK_directory_create ("test" DIR_SEPARATOR_STR "entry_more")) return 1; - GNUNET_DISK_directory_scan ("test", &scan_callback, "test" DIR_SEPARATOR_STR "entry"); + GNUNET_DISK_directory_scan ("test", &scan_callback, + "test" DIR_SEPARATOR_STR "entry"); if (GNUNET_OK != GNUNET_DISK_directory_remove ("test")) return 1; if (ok < 2) @@ -203,7 +211,7 @@ testGetHome () GNUNET_CONFIGURATION_destroy (cfg); ret = strcmp ("/tmp/test-gnunet-disk-a/b/c/d/e", fn); GNUNET_free (fn); - GNUNET_DISK_directory_remove ("/tmp/test-gnunet-disk-a"); + GNUNET_break (GNUNET_OK == GNUNET_DISK_directory_remove ("/tmp/test-gnunet-disk-a")); return ret; }