summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-19 18:23:38 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:59:00 +0200
commit71b2b9d7412a0f916f5be02c73f8b12e531babf8 (patch)
tree7f1555223e8a335ad2c6646b25e9cebdff34f265 /src/test
parenta9f82387ce656c98cad320372002eee70369fdb4 (diff)
fs-util: move fsync_directory_of_file() into generic code
This function used by the journal code is pretty useful generically, let's move it to fs-util.c to make it useful for other code too.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-fs-util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c
index 49883eeaa..507e24bdc 100644
--- a/src/test/test-fs-util.c
+++ b/src/test/test-fs-util.c
@@ -556,6 +556,15 @@ static void test_unlinkat_deallocate(void) {
assert_se(st.st_nlink == 0);
}
+static void test_fsync_directory_of_file(void) {
+ _cleanup_close_ int fd = -1;
+
+ fd = open_tmpfile_unlinkable(NULL, O_RDWR);
+ assert_se(fd >= 0);
+
+ assert_se(fsync_directory_of_file(fd) >= 0);
+}
+
int main(int argc, char *argv[]) {
test_unlink_noerrno();
test_get_files_in_directory();
@@ -570,6 +579,7 @@ int main(int argc, char *argv[]) {
#endif // 0
test_touch_file();
test_unlinkat_deallocate();
+ test_fsync_directory_of_file();
return 0;
}