Commit 683ea2b095cd9be3b8b229894f083cd94e967988

Patrick Steinhardt 2019-06-29T09:10:57

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.

diff --git a/tests/core/posix.c b/tests/core/posix.c
index a459b26..795be31 100644
--- a/tests/core/posix.c
+++ b/tests/core/posix.c
@@ -122,7 +122,7 @@ void test_core_posix__utimes(void)
 	cl_git_mkfile("foo", "Dummy file.");
 	cl_must_pass(p_utimes("foo", times));
 
-	p_stat("foo", &st);
+	cl_must_pass(p_stat("foo", &st));
 	cl_assert_equal_i(1234567890, st.st_atime);
 	cl_assert_equal_i(1234567890, st.st_mtime);
 
@@ -135,9 +135,9 @@ void test_core_posix__utimes(void)
 
 	cl_must_pass(fd = p_open("foo", O_RDWR));
 	cl_must_pass(p_futimes(fd, times));
-	p_close(fd);
+	cl_must_pass(p_close(fd));
 
-	p_stat("foo", &st);
+	cl_must_pass(p_stat("foo", &st));
 	cl_assert_equal_i(1414141414, st.st_atime);
 	cl_assert_equal_i(1414141414, st.st_mtime);
 
@@ -148,11 +148,11 @@ void test_core_posix__utimes(void)
 	cl_must_pass(p_utimes("foo", NULL));
 
 	curtime = time(NULL);
-	p_stat("foo", &st);
+	cl_must_pass(p_stat("foo", &st));
 	cl_assert((st.st_atime - curtime) < 5);
 	cl_assert((st.st_mtime - curtime) < 5);
 
-	p_unlink("foo");
+	cl_must_pass(p_unlink("foo"));
 }
 
 static void try_set_locale(int category)