commit 25f1bdd: [Minor] Improve test stability
Vsevolod Stakhov
vsevolod at rspamd.com
Sun May 1 18:49:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-05-01 19:47:18 +0100
URL: https://github.com/rspamd/rspamd/commit/25f1bddc7278b2537e5c2a04b1a59609f0e411ec (HEAD -> master)
[Minor] Improve test stability
---
src/libutil/cxx/locked_file.cxx | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/libutil/cxx/locked_file.cxx b/src/libutil/cxx/locked_file.cxx
index ca5600c5f..f392d9b4a 100644
--- a/src/libutil/cxx/locked_file.cxx
+++ b/src/libutil/cxx/locked_file.cxx
@@ -249,16 +249,20 @@ TEST_CASE("create and delete file") {
CHECK(::access(fname.c_str(), R_OK) == 0);
}
// File must be deleted after this call
- CHECK(::access(fname.c_str(), R_OK) == -1);
- CHECK(errno == ENOENT);
+ auto ret = ::access(fname.c_str(), R_OK);
+ auto serrno = errno;
+ CHECK(ret == -1);
+ CHECK(serrno == ENOENT);
// Create one more time
{
auto raii_locked_file = raii_locked_file::create_temp(fname.c_str(), O_RDONLY, 00600);
CHECK(raii_locked_file.has_value());
CHECK(::access(fname.c_str(), R_OK) == 0);
}
- CHECK(::access(fname.c_str(), R_OK) == -1);
- CHECK(errno == ENOENT);
+ ret = ::access(fname.c_str(), R_OK);
+ serrno = errno;
+ CHECK(ret == -1);
+ CHECK(serrno == ENOENT);
}
TEST_CASE("check lock") {
@@ -272,8 +276,10 @@ TEST_CASE("check lock") {
CHECK(::access(fname.c_str(), R_OK) == 0);
}
// File must be deleted after this call
- CHECK(::access(fname.c_str(), R_OK) == -1);
- CHECK(errno == ENOENT);
+ auto ret = ::access(fname.c_str(), R_OK);
+ auto serrno = errno;
+ CHECK(ret == -1);
+ CHECK(serrno == ENOENT);
}
} // TEST_SUITE
More information about the Commits
mailing list