Skip to content

Commit 7db7e65

Browse files
committed
Only run LevelDbHasSnappySupportCompiledIn in cmake builds
1 parent b4c1d07 commit 7db7e65

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Firestore/core/test/unit/local/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ firebase_ios_glob(
4242
)
4343
firebase_ios_add_test(firestore_local_test ${sources})
4444

45+
# Set a preprocessor define so that tests can distinguish between having been
46+
# built by Xcode vs. cmake.
47+
target_compile_definitions(
48+
firestore_local_test
49+
PRIVATE
50+
FIRESTORE_TESTS_CMAKE_BUILD
51+
)
52+
4553
target_link_libraries(
4654
firestore_local_test PRIVATE
4755
GMock::GMock

Firestore/core/test/unit/local/leveldb_snappy_test.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ Path CreateLevelDbDatabaseThatUsesSnappyCompression();
4343
// This test ensures that we don't accidentally regress having added in Snappy
4444
// compression support (https://github.com/firebase/firebase-ios-sdk/pull/9596).
4545
TEST(LevelDbSnappy, LevelDbHasSnappySupportCompiledIn) {
46+
// Only run this test in cmake builds, since Snappy support is not included
47+
// when pulling in LevelDb via CocoaPods or Swift Package Manager.
48+
#if FIRESTORE_TESTS_CMAKE_BUILD
49+
GTEST_SKIP() << "Snappy support is only present in cmake builds";
50+
#endif
51+
4652
Path leveldb_path = CreateLevelDbDatabaseThatUsesSnappyCompression();
4753
if (HasFatalFailure()) return;
4854

0 commit comments

Comments
 (0)