Skip to content

Commit 683ea2b

Browse files
committed
tests: core: add missing asserts for several function calls
Several function calls to `p_stat` and `p_close` have no verification if they actually succeeded. As these functions _may_ fail and as we also want to make sure that we're not doing anything dumb, let's check them, too.
1 parent a00842c commit 683ea2b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/core/posix.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void test_core_posix__utimes(void)
122122
cl_git_mkfile("foo", "Dummy file.");
123123
cl_must_pass(p_utimes("foo", times));
124124

125-
p_stat("foo", &st);
125+
cl_must_pass(p_stat("foo", &st));
126126
cl_assert_equal_i(1234567890, st.st_atime);
127127
cl_assert_equal_i(1234567890, st.st_mtime);
128128

@@ -135,9 +135,9 @@ void test_core_posix__utimes(void)
135135

136136
cl_must_pass(fd = p_open("foo", O_RDWR));
137137
cl_must_pass(p_futimes(fd, times));
138-
p_close(fd);
138+
cl_must_pass(p_close(fd));
139139

140-
p_stat("foo", &st);
140+
cl_must_pass(p_stat("foo", &st));
141141
cl_assert_equal_i(1414141414, st.st_atime);
142142
cl_assert_equal_i(1414141414, st.st_mtime);
143143

@@ -148,11 +148,11 @@ void test_core_posix__utimes(void)
148148
cl_must_pass(p_utimes("foo", NULL));
149149

150150
curtime = time(NULL);
151-
p_stat("foo", &st);
151+
cl_must_pass(p_stat("foo", &st));
152152
cl_assert((st.st_atime - curtime) < 5);
153153
cl_assert((st.st_mtime - curtime) < 5);
154154

155-
p_unlink("foo");
155+
cl_must_pass(p_unlink("foo"));
156156
}
157157

158158
static void try_set_locale(int category)

0 commit comments

Comments
 (0)