From: Vsevolod Stakhov Date: Sun, 1 May 2022 18:47:18 +0000 (+0100) Subject: [Minor] Improve test stability X-Git-Tag: 3.3~285 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=25f1bddc7278b2537e5c2a04b1a59609f0e411ec;p=rspamd.git [Minor] Improve test stability --- 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