Skip to content

Commit d89931d

Browse files
committed
fix: guard POSIX headers and flock test in test_bmi_cache.cpp for Windows
sys/file.h and unistd.h don't exist on Windows. Guard with #if !_WIN32. Also guard the PopulateSkipsWhenLockHeld test which uses flock().
1 parent 5173269 commit d89931d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/unit/test_bmi_cache.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include <gtest/gtest.h>
22
#include <fcntl.h>
3+
#if !defined(_WIN32)
34
#include <sys/file.h>
45
#include <unistd.h>
6+
#endif
57

68
import std;
79
import mcpp.bmi_cache;
@@ -200,8 +202,10 @@ TEST(BmiCache, PopulateFailsIfBuildOutputMissing) {
200202
EXPECT_NE(pop.error().find("expected build output missing"), std::string::npos);
201203
}
202204

205+
#if !defined(_WIN32)
203206
// M4 #9: when an external holder takes the .lock, populate_from must skip
204207
// (returns success but does NOT clobber the directory).
208+
// Uses flock() which is POSIX-only.
205209
TEST(BmiCache, PopulateSkipsWhenLockHeld) {
206210
Tmp t;
207211
auto home = t.path / "home";
@@ -233,3 +237,4 @@ TEST(BmiCache, PopulateSkipsWhenLockHeld) {
233237
ASSERT_TRUE(pop2) << pop2.error();
234238
EXPECT_TRUE(std::filesystem::exists(k.manifestFile()));
235239
}
240+
#endif // !defined(_WIN32)

0 commit comments

Comments
 (0)