Skip to content

Commit a4bf4d0

Browse files
committed
Merge branch 'main' into dconeybe/PortChangelist364325997
2 parents 2223122 + 9ec22a9 commit a4bf4d0

File tree

81 files changed

+1644
-8989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1644
-8989
lines changed

.github/workflows/integration_tests.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,12 @@ jobs:
336336
additional_flags+=(--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON)
337337
fi
338338
fi
339-
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --noadd_timestamp ${additional_flags[*]}
339+
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --noadd_timestamp ${additional_flags[*]} --short_output_paths
340340
341341
- name: Run desktop integration tests
342342
if: matrix.target_platform == 'Desktop' && !cancelled()
343343
run: |
344-
python scripts/gha/desktop_tester.py --testapp_dir testapps
344+
python scripts/gha/desktop_tester.py --testapp_dir ta
345345
# Workaround for https://github.com/GoogleCloudPlatform/github-actions/issues/100
346346
# Must be run after the Python setup action
347347
- name: Set CLOUDSDK_PYTHON (Windows)
@@ -354,11 +354,11 @@ jobs:
354354
- name: Upload Desktop Artifacts to GCS
355355
if: matrix.target_platform == 'Desktop' && !cancelled()
356356
run: |
357-
python scripts/gha/gcs_uploader.py --testapp_dir testapps --key_file scripts/gha-encrypted/gcs_key_file.json
357+
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
358358
- name: Run mobile integration tests
359359
if: matrix.target_platform != 'Desktop' && !cancelled()
360360
run: |
361-
python scripts/gha/test_lab.py --android_model ${{ needs.prepare_matrix.outputs.android_device }} --android_api ${{ needs.prepare_matrix.outputs.android_api }} --ios_model ${{ needs.prepare_matrix.outputs.ios_device }} --ios_version ${{ needs.prepare_matrix.outputs.ios_version }} --testapp_dir testapps --code_platform cpp --key_file scripts/gha-encrypted/gcs_key_file.json
361+
python scripts/gha/test_lab.py --android_model ${{ needs.prepare_matrix.outputs.android_device }} --android_api ${{ needs.prepare_matrix.outputs.android_api }} --ios_model ${{ needs.prepare_matrix.outputs.ios_device }} --ios_version ${{ needs.prepare_matrix.outputs.ios_version }} --testapp_dir ta --code_platform cpp --key_file scripts/gha-encrypted/gcs_key_file.json
362362
363363
### The below allow us to set the failure label and comment early, when the first failure
364364
### in the matrix occurs. It'll be cleaned up in a subsequent job.
@@ -393,7 +393,7 @@ jobs:
393393
if: ${{ !cancelled() }}
394394
shell: bash
395395
run: |
396-
cat testapps/summary.log
396+
cat ta/summary.log
397397
if [[ "${{ job.status }}" != "success" ]]; then
398398
exit 1
399399
fi

firestore/integration_test/integration_test.xcodeproj/project.pbxproj

+2
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
"\"$(SRCROOT)/external/googletest/src/googlemock\"",
312312
);
313313
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
314+
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.cpp.firestore.testapp;
314315
PRODUCT_NAME = "$(TARGET_NAME)";
315316
PROVISIONING_PROFILE_SPECIFIER = "";
316317
WRAPPER_EXTENSION = app;
@@ -339,6 +340,7 @@
339340
"\"$(SRCROOT)/external/googletest/src/googlemock\"",
340341
);
341342
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
343+
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.cpp.firestore.testapp;
342344
PRODUCT_NAME = "$(TARGET_NAME)";
343345
PROVISIONING_PROFILE_SPECIFIER = "";
344346
WRAPPER_EXTENSION = app;

firestore/integration_test/src/integration_test.cc

+14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
/*
16+
IMPORTANT: This file is used by both the regular and the internal Firestore
17+
integration tests, and needs to be present and identical in both.
18+
19+
Please ensure that any changes to this file are reflected in both of its
20+
locations:
21+
22+
- firestore/integration_test/src/integration_test.cc
23+
- firestore/integration_test_internal/src/integration_test.cc
24+
25+
If you make any modifications to this file in one of the two locations, please
26+
copy the modified file into the other location before committing the change.
27+
*/
28+
1529
#include <inttypes.h>
1630

1731
#include <algorithm>

firestore/integration_test_internal/CMakeLists.txt

+140-30
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ set(MSVC_RUNTIME_MODE MD)
5050

5151
project(firebase_testapp)
5252

53+
# Ensure min/max macros don't get declared on Windows
54+
# (so we can use std::min/max), before including the Firebase subdirectories.
55+
if(MSVC)
56+
add_definitions(-DNOMINMAX)
57+
endif()
58+
5359
# Integration test source files.
5460
set(FIREBASE_APP_FRAMEWORK_SRCS
5561
src/app_framework.cc
@@ -61,44 +67,135 @@ set(FIREBASE_TEST_FRAMEWORK_SRCS
6167
src/firebase_test_framework.cc
6268
)
6369

64-
set(FIREBASE_INTEGRATION_TEST_SRCS
65-
src/array_transform_test.cc
66-
src/cleanup_test.cc
67-
src/collection_reference_test.cc
68-
src/cursor_test.cc
69-
src/document_change_test.cc
70-
src/document_reference_test.cc
71-
src/document_snapshot_test.cc
72-
src/field_value_test.cc
73-
src/fields_test.cc
74-
src/includes_test.cc
75-
src/listener_registration_test.cc
76-
src/numeric_transforms_test.cc
77-
src/query_network_test.cc
78-
src/query_snapshot_test.cc
79-
src/query_test.cc
80-
src/sanity_test.cc
81-
src/server_timestamp_test.cc
82-
src/smoke_test.cc
83-
src/transaction_extra_test.cc
84-
src/transaction_test.cc
85-
src/type_test.cc
86-
src/validation_test.cc
87-
src/write_batch_test.cc
88-
src/firestore_test.cc
89-
src/util/future_test_util.cc
90-
src/util/integration_test_util.cc
91-
src/firestore_integration_test.cc
70+
# These sources contain the actual tests that run on all platforms, both Android
71+
# and non-Android.
72+
set(FIREBASE_INTEGRATION_TEST_PORTABLE_TEST_SRCS
73+
# Copy of the standard integration test source file. This ensures that even
74+
# if only the internal integration test is run, all of the tests on the
75+
# public API are performed.
76+
src/integration_test.cc
77+
# Internal tests below.
78+
src/collection_reference_test.cc
79+
src/cursor_test.cc
80+
src/document_change_test.cc
81+
src/document_reference_test.cc
82+
src/document_snapshot_test.cc
83+
src/field_value_test.cc
84+
src/fields_test.cc
85+
src/firestore_test.cc
86+
src/includes_test.cc
87+
src/listener_registration_test.cc
88+
src/numeric_transforms_test.cc
89+
src/query_network_test.cc
90+
src/query_snapshot_test.cc
91+
src/query_test.cc
92+
src/sanity_test.cc
93+
src/server_timestamp_test.cc
94+
src/smoke_test.cc
95+
src/transaction_test.cc
96+
src/type_test.cc
97+
src/validation_test.cc
98+
src/write_batch_test.cc
99+
)
100+
101+
# These sources contain the actual tests that run on Android only.
102+
set(FIREBASE_INTEGRATION_TEST_ANDROID_TEST_SRCS
103+
src/android/field_path_portable_test.cc
104+
src/android/firestore_integration_test_android_test.cc
105+
src/android/geo_point_android_test.cc
106+
src/android/jni_runnable_android_test.cc
107+
src/android/promise_android_test.cc
108+
src/android/settings_android_test.cc
109+
src/android/snapshot_metadata_android_test.cc
110+
src/android/timestamp_android_test.cc
111+
src/jni/declaration_test.cc
112+
src/jni/env_test.cc
113+
src/jni/object_test.cc
114+
src/jni/ownership_test.cc
115+
src/jni/task_test.cc
116+
src/jni/traits_test.cc
117+
)
118+
119+
# These sources contain the actual tests that run on non-Android only.
120+
set(FIREBASE_INTEGRATION_TEST_DESKTOP_AND_IOS_TEST_SRCS
121+
src/array_transform_test.cc
122+
src/cleanup_test.cc
123+
src/collection_reference_test.cc
124+
src/transaction_extra_test.cc
125+
)
126+
127+
# These sources contain test plumbing and support, for all platforms.
128+
set(FIREBASE_INTEGRATION_TEST_PORTABLE_SUPPORT_SRCS
129+
src/firestore_integration_test.cc
130+
src/util/future_test_util.cc
131+
src/util/integration_test_util.cc
132+
)
133+
134+
# These sources contain Android-specific test plumbing and utilities.
135+
set(FIREBASE_INTEGRATION_TEST_ANDROID_SUPPORT_SRCS
136+
src/android/cancellation_token_source.cc
137+
src/android/task_completion_source.cc
138+
src/android/firestore_integration_test_android.cc
139+
src/android/util_autoid.cc
140+
# wrapper_assertions.cc from the C++ SDK is included here because even
141+
# though it's not included in the Android version of the SDK, it's still
142+
# used for some tests.
143+
${FIREBASE_CPP_SDK_DIR}/firestore/src/common/wrapper_assertions.cc
92144
)
93145

146+
if(NOT ANDROID)
147+
# Include portable source files and portable tests, plus tests that shouldn't
148+
# be included on Android.
149+
set(FIREBASE_INTEGRATION_TEST_SRCS
150+
${FIREBASE_INTEGRATION_TEST_PORTABLE_SUPPORT_SRCS}
151+
${FIREBASE_INTEGRATION_TEST_PORTABLE_TEST_SRCS}
152+
${FIREBASE_INTEGRATION_TEST_DESKTOP_AND_IOS_TEST_SRCS}
153+
)
154+
else()
155+
# Include portable source files and tests, plus Android-specific source files
156+
# and tests.
157+
set(FIREBASE_INTEGRATION_TEST_SRCS
158+
${FIREBASE_INTEGRATION_TEST_PORTABLE_SUPPORT_SRCS}
159+
${FIREBASE_INTEGRATION_TEST_ANDROID_SUPPORT_SRCS}
160+
${FIREBASE_INTEGRATION_TEST_PORTABLE_TEST_SRCS}
161+
${FIREBASE_INTEGRATION_TEST_ANDROID_TEST_SRCS}
162+
)
163+
endif()
164+
165+
if(ANDROID)
166+
# Firestore's internal integration test requires absl on Android,
167+
# so download it now.
168+
set(ABSEIL_CPP_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/src/abseil-cpp)
169+
if (NOT EXISTS ${ABSEIL_CPP_ROOT}/absl)
170+
configure_file(abseil-cpp.cmake
171+
${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/CMakeLists.txt COPYONLY)
172+
execute_process(COMMAND ${CMAKE_COMMAND} .
173+
RESULT_VARIABLE result
174+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp )
175+
if(result)
176+
message(FATAL_ERROR "CMake step for abseil-cpp failed: ${result}")
177+
endif()
178+
execute_process(COMMAND ${CMAKE_COMMAND} --build .
179+
RESULT_VARIABLE result
180+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp )
181+
if(result)
182+
message(FATAL_ERROR "Build step for abseil-cpp failed: ${result}")
183+
endif()
184+
endif()
185+
add_subdirectory(external/abseil-cpp)
186+
else()
187+
set(ABSEIL_CPP_ROOT
188+
${PROJECT_BINARY_DIR}/bin/external/src/firestore-build/external/src/abseil-cpp)
189+
endif()
190+
94191
# The include directory for the testapp.
95192
include_directories(src)
96193
# The include directory for the C++ SDK root.
97194
include_directories(${FIREBASE_CPP_SDK_DIR})
98195
# Additional public headers from Firestore core SDK.
99196
include_directories(${PROJECT_BINARY_DIR}/bin/external/src/firestore)
100197
# Additional public headers for absl.
101-
include_directories(${PROJECT_BINARY_DIR}/bin/external/src/firestore-build/external/src/abseil-cpp)
198+
include_directories(${ABSEIL_CPP_ROOT})
102199
# Allow testing internal Firebase APIs.
103200
add_definitions(-DINTERNAL_EXPERIMENTAL)
104201

@@ -177,6 +274,8 @@ if(ANDROID)
177274

178275
set(ADDITIONAL_LIBS log android atomic native_app_glue)
179276
else()
277+
set(ABSEIL_CPP_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/src/abseil-cpp)
278+
180279
# Build a desktop application.
181280
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
182281

@@ -250,11 +349,22 @@ else()
250349
endif()
251350
endif()
252351

352+
if(NOT ANDROID)
353+
set(${ADDITIONAL_LIBS} ${ADDITIONAL_LIBS} firestore_core absl_variant)
354+
else()
355+
set(${ADDITIONAL_LIBS} ${ADDITIONAL_LIBS}
356+
absl_base
357+
absl_memory
358+
absl_meta
359+
absl_optional
360+
absl_strings)
361+
endif()
362+
253363
# Add the Firebase libraries to the target using the function from the SDK.
254364
add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)
255365

256366
# Note that firebase_app needs to be last in the list.
257367
set(firebase_libs firebase_firestore firebase_auth firebase_app)
258368
set(gtest_libs gtest gmock)
259-
target_link_libraries(${integration_test_target_name} ${firebase_libs} firestore_core absl_variant
369+
target_link_libraries(${integration_test_target_name} ${firebase_libs}
260370
${gtest_libs} ${ADDITIONAL_LIBS})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2019 Google
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
include(ExternalProject)
16+
17+
set(version 20200225)
18+
19+
ExternalProject_Add(
20+
abseil-cpp
21+
22+
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
23+
DOWNLOAD_NAME abseil-cpp-${version}.tar.gz
24+
URL https://github.com/abseil/abseil-cpp/archive/${version}.tar.gz
25+
URL_HASH SHA256=728a813291bdec2aa46eab8356ace9f75ac2ed9dfe2df5ab603c4e6c09f1c353
26+
27+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
28+
29+
CONFIGURE_COMMAND ""
30+
BUILD_COMMAND ""
31+
INSTALL_COMMAND ""
32+
TEST_COMMAND ""
33+
)

firestore/integration_test_internal/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ android {
6969
proguardFile file('proguard.pro')
7070
}
7171
}
72+
lintOptions {
73+
abortOnError false
74+
}
7275
}
7376

7477
apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"

0 commit comments

Comments
 (0)