Skip to content

Commit e05fe72

Browse files
committed
Scripts to run the tests on desktop platforms with Kokoro
Adds the scripts to run CMake tests for all of the desktop platforms. Adds the logic needed to the initial Mac script to set up the environment as needed to run the tests. Fixes the CMake definitions of tests to build on Linux and Mac. Adds explicit casting of longs to int64_t in variant tests, as apparently on Mac that is required. Note that Windows will still fail during the CMake step, as the dependencies are not yet set up. PiperOrigin-RevId: 262447157
1 parent 13e895a commit e05fe72

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

cmake/test_rules.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ function(cc_test name)
3333

3434
list(APPEND cc_test_DEPENDS gmock gtest gtest_main)
3535

36+
# Include Foundation and Security frameworks, as multiple tests require them
37+
# when running on Mac.
38+
if (APPLE)
39+
list(APPEND cc_test_DEPENDS
40+
"-framework Foundation"
41+
"-framework Security")
42+
endif()
43+
3644
add_executable(${name} ${cc_test_SOURCES})
3745
add_test(${name} ${name})
3846
target_include_directories(${name}

test_linux.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2019 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Builds and runs the tests, meant to be used on a Linux environment.
18+
19+
# Fail on any error.
20+
set -e
21+
# Display commands being run.
22+
set -x
23+
24+
# Make a directory to work in
25+
mkdir linux_build
26+
cd linux_build
27+
28+
# Configure cmake with tests enabled
29+
cmake .. -DFIREBASE_CPP_BUILD_TESTS=ON
30+
31+
# Build the SDK and the tests
32+
cmake --build .
33+
34+
# Run the tests
35+
ctest

test_macos.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2019 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Builds and runs the tests, meant to be used on a Linux environment.
18+
19+
# Fail on any error.
20+
set -e
21+
# Display commands being run.
22+
set -x
23+
24+
# Make a directory to work in
25+
mkdir macos_build
26+
cd macos_build
27+
28+
# Configure cmake with tests enabled
29+
cmake .. -DFIREBASE_CPP_BUILD_TESTS=ON
30+
31+
# Build the SDK and the tests
32+
cmake --build .
33+
34+
# Run the tests
35+
ctest

test_windows.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:: Make a directory to work in
2+
mkdir windows_build
3+
cd windows_build
4+
5+
:: Configure cmake with tests enabled
6+
cmake .. -DFIREBASE_CPP_BUILD_TESTS=ON
7+
8+
:: Build the SDK and the tests
9+
cmake --build .
10+
11+
:: Run the tests
12+
ctest
13+
14+
exit /b %ERRORLEVEL%

0 commit comments

Comments
 (0)