Skip to content

Commit 770735e

Browse files
Michael Wilkerson-Barkerfealebenpae
andauthored
Fix object-store-benchmarks build and always build this target (#6999)
* Fix object-store-benchmarks build and always build this target * Needed to update the target name * Don't build ObjectStore benchmarks on UWP or Emscripten - We don't have a default scheduler implementation for those platforms * Update CMakeLists.txt * Make Object Store benchmarks use the explicit libuv scheduler * try fix build * Fix warn_unused_result warning for Android builds * Fixed some 'duplicate library' warnings * Updated baas version to latest release * Updated construction of std::string_view * Reverted baas commit version due to failures --------- Co-authored-by: Yavor Georgiev <[email protected]>
1 parent c0e7f64 commit 770735e

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

src/realm/sync/noinst/client_impl_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,7 @@ Status Session::receive_query_error_message(int error_code, std::string_view mes
25232523
// because in that case, the associated Realm and SessionWrapper must
25242524
// not be accessed any longer.
25252525
if (m_state == Active) {
2526-
on_flx_sync_error(query_version, std::string_view(message.data(), message.size())); // throws
2526+
on_flx_sync_error(query_version, message); // throws
25272527
}
25282528
return Status::OK();
25292529
}

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ if(REALM_ENABLE_SYNC)
244244
set_target_properties(SyncTests PROPERTIES OUTPUT_NAME "realm-sync-tests")
245245
set_target_resources(SyncTests "${TEST_RESOURCES}")
246246
enable_stdfilesystem(SyncTests)
247-
target_link_libraries(SyncTests Sync SyncServer TestUtil)
247+
# Sync lib is included with SyncServer
248+
target_link_libraries(SyncTests TestUtil SyncServer)
248249
add_bundled_test(SyncTests)
249250

250251
if(UNIX AND NOT APPLE)

test/benchmark-sync/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
if(REALM_ENABLE_SYNC)
22
add_executable(realm-benchmark-sync bench_transform.cpp ../test_all.cpp)
33
add_dependencies(benchmarks realm-benchmark-sync)
4-
target_link_libraries(realm-benchmark-sync TestUtil Sync SyncServer)
4+
# Sync lib is included with SyncServer
5+
target_link_libraries(realm-benchmark-sync TestUtil SyncServer)
56
endif()

test/object-store/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,7 @@ if(NOT APPLE AND NOT EMSCRIPTEN AND NOT WINDOWS_STORE)
199199
endif()
200200

201201
add_subdirectory(notifications-fuzzer)
202-
add_subdirectory(benchmarks)
202+
203+
if(NOT EMSCRIPTEN AND NOT WINDOWS_STORE)
204+
add_subdirectory(benchmarks)
205+
endif()

test/object-store/benchmarks/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ if(REALM_ENABLE_SYNC)
3939
endif()
4040

4141
target_link_libraries(object-store-benchmarks ObjectStore TestUtil Catch2::Catch2)
42-
set_target_properties(object-store-benchmarks PROPERTIES
43-
EXCLUDE_FROM_ALL 1
44-
EXCLUDE_FROM_DEFAULT_BUILD 1)
4542

4643
add_dependencies(benchmarks object-store-benchmarks)
4744

4845
# on Apple platforms we use the built-in CFRunLoop
4946
# everywhere else it's libuv, except UWP where it doesn't build
50-
if(NOT APPLE AND NOT WINDOWS_STORE)
51-
target_include_directories(object-store-benchmarks PRIVATE ${libuv_include_dir})
47+
if(NOT APPLE AND NOT WINDOWS_STORE AND NOT EMSCRIPTEN)
48+
# libuv_target is defined in the parent CMakeLists.txt file
5249
target_link_libraries(object-store-benchmarks ${libuv_target})
50+
target_compile_definitions(object-store-benchmarks PRIVATE TEST_SCHEDULER_UV=1)
5351
endif()

test/object-store/benchmarks/main.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
//
1717
////////////////////////////////////////////////////////////////////////////
1818

19-
#define CATCH_CONFIG_ENABLE_BENCHMARKING
19+
#if TEST_SCHEDULER_UV
20+
#include <realm/object-store/util/uv/scheduler.hpp>
21+
#endif
2022

23+
#define CATCH_CONFIG_ENABLE_BENCHMARKING
2124
#include <catch2/catch_all.hpp>
2225

2326
#include <limits.h>
@@ -42,11 +45,17 @@ int main(int argc, char** argv)
4245
SetCurrentDirectoryA(path);
4346
#else
4447
char executable[PATH_MAX];
45-
realpath(argv[0], executable);
48+
(void)realpath(argv[0], executable);
4649
const char* directory = dirname(executable);
4750
chdir(directory);
4851
#endif
4952

53+
#if TEST_SCHEDULER_UV
54+
realm::util::Scheduler::set_default_factory([]() {
55+
return std::make_shared<realm::util::UvMainLoopScheduler>();
56+
});
57+
#endif
58+
5059
int result = Catch::Session().run(argc, argv);
5160
return result < 0xff ? result : 0xff;
5261
}

0 commit comments

Comments
 (0)