Clean-up: tests: fd-tracker: change spaces to tabs
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 Aug 2020 16:22:19 +0000 (12:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 Aug 2020 16:23:15 +0000 (12:23 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I24fde39587495f5f48f900898755e57c10fbf303

tests/unit/test_fd_tracker.c

index 7c818b94bd2fb6cee2749016f89fc902f4278cce..db9b4248b4b137d239d58872b0bfa9a86e46aa2f 100644 (file)
@@ -82,12 +82,12 @@ int fd_count(void)
 {
        DIR *dir;
        struct dirent *entry;
-        int count = 0;
+       int count = 0;
 
        dir = opendir("/proc/self/fd");
        if (!dir) {
                perror("# Failed to enumerate /proc/self/fd/ to count the number of used file descriptors");
-               count = -1;
+               count = -1;
                goto end;
        }
 
@@ -95,10 +95,10 @@ int fd_count(void)
                if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) {
                        continue;
                }
-               count++;
+               count++;
        }
        /* Don't account for the file descriptor opened by opendir(). */
-        count--;
+       count--;
        if (closedir(dir)) {
                perror("# Failed to close test program's self/fd directory file descriptor");
        }
@@ -109,9 +109,9 @@ end:
 static
 void check_fd_count(int expected_count)
 {
-        int count = 0;
+       int count = 0;
 
-        count = fd_count();
+       count = fd_count();
        ok(count == expected_count, "Expected %d open file descriptors (%d are open)",
                        expected_count, count);
 }
@@ -119,7 +119,7 @@ void check_fd_count(int expected_count)
 static
 int noop_open(void *data, int *fds)
 {
-        *fds = *((int *) data);
+       *fds = *((int *) data);
        return 0;
 }
 
@@ -133,7 +133,7 @@ static
 void track_std_fds(struct fd_tracker *tracker)
 {
        int i;
-        struct { int fd; const char *name; } files[] = {
+       struct { int fd; const char *name; } files[] = {
                { .fd = fileno(stdin), .name = "stdin" },
                { .fd = fileno(stdout), .name = "stdout" },
                { .fd = fileno(stderr), .name = "stderr" },
@@ -155,7 +155,7 @@ static
 void untrack_std_fds(struct fd_tracker *tracker)
 {
        int i;
-        struct { int fd; const char *name; } files[] = {
+       struct { int fd; const char *name; } files[] = {
                { .fd = fileno(stdin), .name = "stdin" },
                { .fd = fileno(stdout), .name = "stdout" },
                { .fd = fileno(stderr), .name = "stderr" },
@@ -185,7 +185,7 @@ void test_unsuspendable_basic(void)
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
-        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        ok(tracker, "Created an fd tracker with a limit of %d simulateously opened file descriptors",
                        TRACKER_FD_LIMIT);
        if (!tracker) {
@@ -229,7 +229,7 @@ void test_unsuspendable_cb_return(void)
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
-        tracker = fd_tracker_create(test_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(test_directory, TRACKER_FD_LIMIT);
        assert(tracker);
 
        /* The error_open callback should fail and return 'expected_error'. */
@@ -274,7 +274,7 @@ void test_unsuspendable_duplicate(void)
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
-        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        assert(tracker);
 
        ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
@@ -344,7 +344,7 @@ void test_unsuspendable_limit(void)
        /* This test assumes TRACKER_FD_LIMIT is a multiple of 2. */
        assert((TRACKER_FD_LIMIT % 2 == 0) && TRACKER_FD_LIMIT);
 
-        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        assert(tracker);
 
        ret = fd_tracker_open_unsuspendable_fd(tracker, fds,
@@ -380,7 +380,7 @@ void test_unsuspendable_close_untracked(void)
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
-        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        if (!tracker) {
                goto end;;
        }
@@ -421,13 +421,13 @@ static int open_files(struct fd_tracker *tracker,
 
        for (i = 0; i < count; i++) {
                int p_ret;
-               char *file_path;
+               char *file_path;
                struct fs_handle *handle;
                mode_t mode = S_IWUSR | S_IRUSR;
 
                p_ret = asprintf(&file_path, "file-%u", i);
                assert(p_ret >= 0);
-               file_paths[i] = file_path;
+               file_paths[i] = file_path;
 
                handle = fd_tracker_open_fs_handle(tracker, directory, file_path,
                                O_RDWR | O_CREAT, &mode);
@@ -482,7 +482,7 @@ int cleanup_files(struct fd_tracker *tracker, const char *dir,
                        diag("Failed to unlink fs_handle to file %s", file_path);
                        ret = -1;
                }
-               if (fs_handle_close(handles[i])) {
+               if (fs_handle_close(handles[i])) {
                        diag("Failed to close fs_handle to file %s", file_path);
                        ret = -1;
                }
@@ -508,7 +508,7 @@ void test_suspendable_limit(void)
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
-        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        if (!tracker) {
                goto end;
        }
@@ -626,7 +626,7 @@ void test_suspendable_restore(void)
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
-        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
+       tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        if (!tracker) {
                goto end;
        }
@@ -652,8 +652,8 @@ void test_suspendable_restore(void)
                        fd = fs_handle_get_fd(handle);
                        if (fd < 0) {
                                write_success = false;
-                               diag("Failed to restore fs_handle to %s",
-                                               path);
+                               diag("Failed to restore fs_handle to %s",
+                                               path);
                                goto skip_write;
                        }
 
@@ -663,7 +663,7 @@ void test_suspendable_restore(void)
 
                        if (ret != 1) {
                                write_success = false;
-                               PERROR("write() to %s failed", path);
+                               PERROR("write() to %s failed", path);
                                goto skip_write;
                        }
 
This page took 0.029206 seconds and 4 git commands to generate.