Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
48cda4f
Set up integration test project with source files and build settings.
jonsimantov Mar 21, 2021
7720dbf
Add bundle ID to old integration test (was omitted).
jonsimantov Mar 21, 2021
5cf61e0
Add additional macros for skipping tests on certain platforms.
jonsimantov Mar 21, 2021
0c97858
Fix build errors on Mac/iOS, and add some skipped tests that fail
jonsimantov Mar 21, 2021
3c0a09e
Remove test files from old location.
jonsimantov Mar 21, 2021
2adcad3
Initial attempt at adding source files for android tests.
jonsimantov Mar 21, 2021
f4ebc6a
Modify tests to make Android build.
jonsimantov Mar 21, 2021
b1c779a
Fix Firestore tests to work properly on Android.
jonsimantov Mar 21, 2021
38a389e
Restore global JNI refs back to local since the test is broken anyway.
jonsimantov Mar 21, 2021
1a0cb7a
Rename conflicting test class.
jonsimantov Mar 21, 2021
85de1a1
support for internal integration tests
vimanyu Mar 19, 2021
6d2a43b
temporarily testing internal tests
vimanyu Mar 19, 2021
bd566aa
run internal and public integration tests
vimanyu Mar 19, 2021
de14037
run only normal tests
vimanyu Mar 19, 2021
253e401
run internal tests whenever we test against source
vimanyu Mar 21, 2021
90eab17
Add missing absl file.
jonsimantov Mar 22, 2021
103042c
Merge branch 'feature/firestore-testing-android' into feature/merge-f…
jonsimantov Mar 22, 2021
930d9fa
Fix path to wrapper_assertions.
jonsimantov Mar 22, 2021
50cf40b
Add support for internal tests to testapp building tools.
jonsimantov Mar 22, 2021
e8af49f
Add a "append to build setting" function to Xcode tool, to add the he…
jonsimantov Mar 23, 2021
216c69d
Add the standard integration test source file back in.
jonsimantov Mar 23, 2021
ff70f83
using home dir instead of workspace as output dir
vimanyu Mar 22, 2021
2dc92e7
using env variable for home
vimanyu Mar 22, 2021
8efc413
going back to using workspace dir
vimanyu Mar 22, 2021
ba574f9
option to shorten output paths
vimanyu Mar 22, 2021
221bee1
fixing output testapp dir path
vimanyu Mar 22, 2021
58f675d
using short dirname everywhere
vimanyu Mar 22, 2021
01c8ee1
debug output dir
vimanyu Mar 23, 2021
c05c59e
change print to logging
vimanyu Mar 23, 2021
9a922fb
more debug prints
vimanyu Mar 23, 2021
bb91754
path
vimanyu Mar 23, 2021
9c32529
quotes around dir path
vimanyu Mar 23, 2021
c791151
reverting to older version
vimanyu Mar 23, 2021
6bd18d8
__PRETTY_FUNCTION__ does not work on non-gcc compilers (eg: VS)
vimanyu Mar 23, 2021
9fb2808
Fix path to integration_test.cc in xcode project.
jonsimantov Mar 23, 2021
eed47db
adding nominmax option for windows
vimanyu Mar 23, 2021
9a14958
Change includes_test to not actually do anything, just test compiling.
jonsimantov Mar 23, 2021
06731c1
Increase Test Lab timeout to 15 minutes.
jonsimantov Mar 23, 2021
9879d02
Increase desktop timeout to 15 minutes as well.
jonsimantov Mar 23, 2021
13f656d
move NOMINMAX after project call
vimanyu Mar 23, 2021
4592e8d
Just check for directory, not file, for absl.
jonsimantov Mar 24, 2021
26aec8b
Change help text to be clearer.
jonsimantov Mar 24, 2021
2015cd6
Fix comment grammar.
jonsimantov Mar 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ jobs:
additional_flags+=(--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON)
fi
fi
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --noadd_timestamp ${additional_flags[*]}
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

- name: Run desktop integration tests
if: matrix.target_platform == 'Desktop' && !cancelled()
run: |
python scripts/gha/desktop_tester.py --testapp_dir testapps
python scripts/gha/desktop_tester.py --testapp_dir ta
# Workaround for https://github.com/GoogleCloudPlatform/github-actions/issues/100
# Must be run after the Python setup action
- name: Set CLOUDSDK_PYTHON (Windows)
Expand All @@ -354,11 +354,11 @@ jobs:
- name: Upload Desktop Artifacts to GCS
if: matrix.target_platform == 'Desktop' && !cancelled()
run: |
python scripts/gha/gcs_uploader.py --testapp_dir testapps --key_file scripts/gha-encrypted/gcs_key_file.json
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Run mobile integration tests
if: matrix.target_platform != 'Desktop' && !cancelled()
run: |
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
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

### The below allow us to set the failure label and comment early, when the first failure
### in the matrix occurs. It'll be cleaned up in a subsequent job.
Expand Down Expand Up @@ -393,7 +393,7 @@ jobs:
if: ${{ !cancelled() }}
shell: bash
run: |
cat testapps/summary.log
cat ta/summary.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"\"$(SRCROOT)/external/googletest/src/googlemock\"",
);
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.cpp.firestore.testapp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
WRAPPER_EXTENSION = app;
Expand Down Expand Up @@ -339,6 +340,7 @@
"\"$(SRCROOT)/external/googletest/src/googlemock\"",
);
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.cpp.firestore.testapp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
WRAPPER_EXTENSION = app;
Expand Down
14 changes: 14 additions & 0 deletions firestore/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*
IMPORTANT: This file is used by both the regular and the internal Firestore
integration tests, and needs to be present and identical in both.

Please ensure that any changes to this file are reflected in both of its
locations:

- firestore/integration_test/src/integration_test.cc
- firestore/integration_test_internal/src/integration_test.cc

If you make any modifications to this file in one of the two locations, please
copy the modified file into the other location before committing the change.
*/

#include <inttypes.h>

#include <algorithm>
Expand Down
170 changes: 140 additions & 30 deletions firestore/integration_test_internal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ set(MSVC_RUNTIME_MODE MD)

project(firebase_testapp)

# Ensure min/max macros don't get declared on Windows
# (so we can use std::min/max), before including the Firebase subdirectories.
if(MSVC)
add_definitions(-DNOMINMAX)
endif()

# Integration test source files.
set(FIREBASE_APP_FRAMEWORK_SRCS
src/app_framework.cc
Expand All @@ -61,44 +67,135 @@ set(FIREBASE_TEST_FRAMEWORK_SRCS
src/firebase_test_framework.cc
)

set(FIREBASE_INTEGRATION_TEST_SRCS
src/array_transform_test.cc
src/cleanup_test.cc
src/collection_reference_test.cc
src/cursor_test.cc
src/document_change_test.cc
src/document_reference_test.cc
src/document_snapshot_test.cc
src/field_value_test.cc
src/fields_test.cc
src/includes_test.cc
src/listener_registration_test.cc
src/numeric_transforms_test.cc
src/query_network_test.cc
src/query_snapshot_test.cc
src/query_test.cc
src/sanity_test.cc
src/server_timestamp_test.cc
src/smoke_test.cc
src/transaction_extra_test.cc
src/transaction_test.cc
src/type_test.cc
src/validation_test.cc
src/write_batch_test.cc
src/firestore_test.cc
src/util/future_test_util.cc
src/util/integration_test_util.cc
src/firestore_integration_test.cc
# These sources contain the actual tests that run on all platforms, both Android
# and non-Android.
set(FIREBASE_INTEGRATION_TEST_PORTABLE_TEST_SRCS
# Copy of the standard integration test source file. This ensures that even
# if only the internal integration test is run, all of the tests on the
# public API are performed.
src/integration_test.cc
# Internal tests below.
src/collection_reference_test.cc
src/cursor_test.cc
src/document_change_test.cc
src/document_reference_test.cc
src/document_snapshot_test.cc
src/field_value_test.cc
src/fields_test.cc
src/firestore_test.cc
src/includes_test.cc
src/listener_registration_test.cc
src/numeric_transforms_test.cc
src/query_network_test.cc
src/query_snapshot_test.cc
src/query_test.cc
src/sanity_test.cc
src/server_timestamp_test.cc
src/smoke_test.cc
src/transaction_test.cc
src/type_test.cc
src/validation_test.cc
src/write_batch_test.cc
)

# These sources contain the actual tests that run on Android only.
set(FIREBASE_INTEGRATION_TEST_ANDROID_TEST_SRCS
src/android/field_path_portable_test.cc
src/android/firestore_integration_test_android_test.cc
src/android/geo_point_android_test.cc
src/android/jni_runnable_android_test.cc
src/android/promise_android_test.cc
src/android/settings_android_test.cc
src/android/snapshot_metadata_android_test.cc
src/android/timestamp_android_test.cc
src/jni/declaration_test.cc
src/jni/env_test.cc
src/jni/object_test.cc
src/jni/ownership_test.cc
src/jni/task_test.cc
src/jni/traits_test.cc
)

# These sources contain the actual tests that run on non-Android only.
set(FIREBASE_INTEGRATION_TEST_DESKTOP_AND_IOS_TEST_SRCS
src/array_transform_test.cc
src/cleanup_test.cc
src/collection_reference_test.cc
src/transaction_extra_test.cc
)

# These sources contain test plumbing and support, for all platforms.
set(FIREBASE_INTEGRATION_TEST_PORTABLE_SUPPORT_SRCS
src/firestore_integration_test.cc
src/util/future_test_util.cc
src/util/integration_test_util.cc
)

# These sources contain Android-specific test plumbing and utilities.
set(FIREBASE_INTEGRATION_TEST_ANDROID_SUPPORT_SRCS
src/android/cancellation_token_source.cc
src/android/task_completion_source.cc
src/android/firestore_integration_test_android.cc
src/android/util_autoid.cc
# wrapper_assertions.cc from the C++ SDK is included here because even
# though it's not included in the Android version of the SDK, it's still
# used for some tests.
${FIREBASE_CPP_SDK_DIR}/firestore/src/common/wrapper_assertions.cc
)

if(NOT ANDROID)
# Include portable source files and portable tests, plus tests that shouldn't
# be included on Android.
set(FIREBASE_INTEGRATION_TEST_SRCS
${FIREBASE_INTEGRATION_TEST_PORTABLE_SUPPORT_SRCS}
${FIREBASE_INTEGRATION_TEST_PORTABLE_TEST_SRCS}
${FIREBASE_INTEGRATION_TEST_DESKTOP_AND_IOS_TEST_SRCS}
)
else()
# Include portable source files and tests, plus Android-specific source files
# and tests.
set(FIREBASE_INTEGRATION_TEST_SRCS
${FIREBASE_INTEGRATION_TEST_PORTABLE_SUPPORT_SRCS}
${FIREBASE_INTEGRATION_TEST_ANDROID_SUPPORT_SRCS}
${FIREBASE_INTEGRATION_TEST_PORTABLE_TEST_SRCS}
${FIREBASE_INTEGRATION_TEST_ANDROID_TEST_SRCS}
)
endif()

if(ANDROID)
# Firestore's internal integration test requires absl on Android,
# so download it now.
set(ABSEIL_CPP_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/src/abseil-cpp)
if (NOT EXISTS ${ABSEIL_CPP_ROOT}/absl)
configure_file(abseil-cpp.cmake
${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/CMakeLists.txt COPYONLY)
execute_process(COMMAND ${CMAKE_COMMAND} .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp )
if(result)
message(FATAL_ERROR "CMake step for abseil-cpp failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp )
if(result)
message(FATAL_ERROR "Build step for abseil-cpp failed: ${result}")
endif()
endif()
add_subdirectory(external/abseil-cpp)
else()
set(ABSEIL_CPP_ROOT
${PROJECT_BINARY_DIR}/bin/external/src/firestore-build/external/src/abseil-cpp)
endif()

# The include directory for the testapp.
include_directories(src)
# The include directory for the C++ SDK root.
include_directories(${FIREBASE_CPP_SDK_DIR})
# Additional public headers from Firestore core SDK.
include_directories(${PROJECT_BINARY_DIR}/bin/external/src/firestore)
# Additional public headers for absl.
include_directories(${PROJECT_BINARY_DIR}/bin/external/src/firestore-build/external/src/abseil-cpp)
include_directories(${ABSEIL_CPP_ROOT})
# Allow testing internal Firebase APIs.
add_definitions(-DINTERNAL_EXPERIMENTAL)

Expand Down Expand Up @@ -177,6 +274,8 @@ if(ANDROID)

set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
set(ABSEIL_CPP_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/src/abseil-cpp)

# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

Expand Down Expand Up @@ -250,11 +349,22 @@ else()
endif()
endif()

if(NOT ANDROID)
set(${ADDITIONAL_LIBS} ${ADDITIONAL_LIBS} firestore_core absl_variant)
else()
set(${ADDITIONAL_LIBS} ${ADDITIONAL_LIBS}
absl_base
absl_memory
absl_meta
absl_optional
absl_strings)
endif()

# Add the Firebase libraries to the target using the function from the SDK.
add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)

# Note that firebase_app needs to be last in the list.
set(firebase_libs firebase_firestore firebase_auth firebase_app)
set(gtest_libs gtest gmock)
target_link_libraries(${integration_test_target_name} ${firebase_libs} firestore_core absl_variant
target_link_libraries(${integration_test_target_name} ${firebase_libs}
${gtest_libs} ${ADDITIONAL_LIBS})
33 changes: 33 additions & 0 deletions firestore/integration_test_internal/abseil-cpp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2019 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include(ExternalProject)

set(version 20200225)

ExternalProject_Add(
abseil-cpp

DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
DOWNLOAD_NAME abseil-cpp-${version}.tar.gz
URL https://github.com/abseil/abseil-cpp/archive/${version}.tar.gz
URL_HASH SHA256=728a813291bdec2aa46eab8356ace9f75ac2ed9dfe2df5ab603c4e6c09f1c353

PREFIX ${CMAKE_CURRENT_BINARY_DIR}

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
3 changes: 3 additions & 0 deletions firestore/integration_test_internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ android {
proguardFile file('proguard.pro')
}
}
lintOptions {
abortOnError false
}
}

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand Down
Loading