Skip to content

Commit add20ca

Browse files
authored
fix: Enable macOS tests and fix concurrent cache race
- Remove Debug-only restriction for macOS C++ tests (aligns with Linux) - Fix CachingFileProvider race: use emplace to avoid double-counting cache entries on concurrent misses - Add setuptools build-system config to pyproject.toml - Replace hardcoded absolute paths in test_mcp_instructions.py with PROJECT_ROOT - Add checks: write permission to build.yaml Closes #16
1 parent 0a68514 commit add20ca

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,11 @@ endif()
327327
include(CTest)
328328
include(Catch)
329329
if(BUILD_TESTING)
330-
if(APPLE)
331-
# On macOS, only build tests for debug builds
332-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
333-
add_subdirectory(test/cpp)
334-
endif()
335-
elseif(CMAKE_CROSSCOMPILING)
330+
if(CMAKE_CROSSCOMPILING)
336331
# Skip running tests when cross-compiling
337332
message(STATUS "Skipping tests during cross-compilation")
338333
else()
339-
# On other platforms (Linux), build tests for all configurations
334+
# Build tests for all platforms and configurations
340335
add_subdirectory(test/cpp)
341336
endif()
342337
endif()

‎src/caching_file_provider.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,18 @@ std::string CachingFileProvider::ReadFile(const std::string& path) {
111111
evictLRU(content_size);
112112
}
113113

114-
// Add to cache
114+
// Add to cache only if not already inserted by a concurrent thread
115115
CacheEntry entry;
116116
entry.content = content;
117117
entry.expires_at = std::chrono::steady_clock::now() + _config.ttl;
118118
entry.last_access = std::chrono::steady_clock::now();
119119
entry.size_bytes = content_size;
120120

121-
_cache[path] = std::move(entry);
122-
_stats.current_entries.fetch_add(1);
123-
_stats.current_size_bytes.fetch_add(content_size);
121+
auto [it, inserted] = _cache.emplace(path, std::move(entry));
122+
if (inserted) {
123+
_stats.current_entries.fetch_add(1);
124+
_stats.current_size_bytes.fetch_add(content_size);
125+
}
124126
}
125127

126128
return content;

‎test/integration/pyproject.toml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools]
6+
packages = []
7+
18
[project]
29
name = "flapi-integration-tests"
310
version = "0.1.0"
@@ -20,9 +27,6 @@ dependencies = [
2027
"psutil>=5.9.0",
2128
]
2229

23-
[tool.setuptools]
24-
packages = []
25-
2630
[tool.pytest.ini_options]
2731
addopts = "-v"
2832
testpaths = ["."]

0 commit comments

Comments
 (0)