Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCORE-1985 Run core tests on ios Simulator in evergreen #7758

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
68 changes: 68 additions & 0 deletions evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,42 @@ tasks:
script: |-
${cmake_build_type|Debug}/realm-libfuzz -rss_limit_mb=0 -max_total_time=3600

- name: combined-tests-ios-simulator
tags: [ "for_pull_requests" ]
exec_timeout_secs: 1800
commands:
- command: shell.exec
params:
working_dir: realm-core
shell: bash
script: |-
set -o errexit
set -o verbose

if [ -n "${xcode_developer_dir}" ]; then
export DEVELOPER_DIR="${xcode_developer_dir}"
export SIMCTL_CHILD_DEVELOPER_DIR="${xcode_developer_dir}"
fi

if [[ -n "${verbose_test_output}" ]]; then
TEST_FLAGS="$TEST_FLAGS -VV"
export SIMCTL_CHILD_UNITTEST_THREADS=1
export SIMCTL_CHILD_UNITTEST_LOG_LEVEL="${test_logging_level|debug}"
fi

TEST_RESULTS_FILE="$(./evergreen/abspath.sh ${task_name}_results.json)"
export SIMCTL_CHILD_UNITTEST_EVERGREEN_TEST_RESULTS="$TEST_RESULTS_FILE"
if [[ -f "$TEST_RESULTS_FILE" ]]; then
rm "$TEST_RESULTS_FILE"
fi
export SIMCTL_CHILD_UNITTEST_PROGRESS=1
export SIMCTL_CHILD_UNITTEST_ENCRYPT_ALL="${run_with_encryption|0}"

./tools/run-in-simulator.sh \
./build/test/${cmake_build_type|Debug}-iphonesimulator/realm-combined-tests.app \
'io.realm.CombinedTests' \
$TEST_RESULTS_FILE

- name: generate-sync-corpus
tags: [ "for_nightly_tests" ]
exec_timeout_secs: 1800
Expand Down Expand Up @@ -1317,6 +1353,20 @@ task_groups:
tasks:
- fuzzer

- name: ios-simulator-tests
max_hosts: 1
setup_group_can_fail_task: true
setup_group:
- func: "fetch source"
- func: "fetch binaries"
teardown_task:
- func: "upload test results"
timeout:
- func: "run hang analyzer"
tasks:
- compile
- combined-tests-ios-simulator

buildvariants:
- name: ubuntu
display_name: "Ubuntu"
Expand Down Expand Up @@ -1605,6 +1655,24 @@ buildvariants:
tasks:
- name: compile_test_and_package

- name: ios-simulator
display_name: "iOS Simulator (combined tests w/Xcode 15)"
run_on: macos-14-arm64
expansions:
cmake_bindir: "/opt/homebrew/bin"
cmake_toolchain_file: "./tools/cmake/xcode.toolchain.cmake"
extra_flags: "-DCMAKE_XCODE_ATTRIBUTE_SDKROOT=iphoneos"
cmake_build_tool_options: "-sdk iphonesimulator -arch arm64"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
build_command_line_tools: Off
disable_tests_against_baas: On
disable_sync: On
target_to_build: CombinedTests
tasks:
- name: ios-simulator-tests

- name: macos-encrypted
display_name: "MacOS 14.0 arm64 (Encryption enabled)"
run_on: macos-14-arm64
Expand Down
6 changes: 5 additions & 1 deletion src/external/bson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ CHECK_STRUCT_HAS_MEMBER ("struct timespec" tv_sec time.h BSON_HAVE_TIMESPEC)
check_symbol_exists (gmtime_r time.h BSON_HAVE_GMTIME_R)
check_function_exists (rand_r BSON_HAVE_RAND_R)
check_include_file (strings.h BSON_HAVE_STRINGS_H)
check_symbol_exists (strlcpy string.h BSON_HAVE_STRLCPY)
if (NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just check NOT APPLE to ensure it works for multiplatform builds?

check_symbol_exists (strlcpy string.h BSON_HAVE_STRLCPY)
else()
set(BSON_HAVE_STRLCPY Off)
endif()
check_include_file (stdbool.h BSON_HAVE_STDBOOL_H)
check_symbol_exists (clock_gettime time.h BSON_HAVE_CLOCK_GETTIME)
check_symbol_exists (strnlen string.h BSON_HAVE_STRNLEN)
Expand Down
1 change: 1 addition & 0 deletions tools/run-in-simulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ appPath="$1"
bundleId="$2"
outputFile="$3"

xcrun simctl list runtimes
id="$(echo $RANDOM | shasum | cut -f 1 -d ' ')"
# Sample output: "iOS 15.5 (15.5 - 19F70) - com.apple.CoreSimulator.SimRuntime.iOS-15-5"
# We're extracting the part starting with com.apple, looking for a runtime that's iOS 13 or newer
Expand Down
Loading