summaryrefslogtreecommitdiffstats
path: root/src/test/test-fd-util.c
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2023-09-19 02:19:10 +0200
committerLuca Boccassi <bluca@debian.org>2023-10-12 14:37:22 +0200
commit81b913f076348be53bf4292793896790265b48dd (patch)
tree4ee359b6869d4b2b9d0b883e75da8c7ba347a02d /src/test/test-fd-util.c
parentserialize: add serialize_string_set() (diff)
downloadsystemd-81b913f076348be53bf4292793896790265b48dd.tar.xz
systemd-81b913f076348be53bf4292793896790265b48dd.zip
serialize: add open_serialization_file()
Diffstat (limited to 'src/test/test-fd-util.c')
-rw-r--r--src/test/test-fd-util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c
index 20d412f5c6..67ec3e59f1 100644
--- a/src/test/test-fd-util.c
+++ b/src/test/test-fd-util.c
@@ -100,6 +100,17 @@ TEST(open_serialization_fd) {
assert_se(write(fd, "test\n", 5) == 5);
}
+TEST(open_serialization_file) {
+ _cleanup_fclose_ FILE *f = NULL;
+ int r;
+
+ r = open_serialization_file("test", &f);
+ assert_se(r >= 0);
+ assert_se(f);
+
+ assert_se(fwrite("test\n", 1, 5, f) == 5);
+}
+
TEST(fd_move_above_stdio) {
int original_stdin, new_fd;