load("@rules_cc//cc:cc_test.bzl", "cc_test") _TESTS = { "test_10340": [], # Fails and is unclear why. Needs further investigation. "test_10963": [], "test_10964": [], "test_11053": [], "test_11256": [], "test_11266": [], "test_11499": [], "test_11611": [], "test_11796": [], # Misses iostream "test_11818": [], "test_12293": [], "test_12949": [], "test_13480b": ["@boost.variant"], "test_2309": [], "test_2501": [], "test_2741": [], "test_3628": [], "test_366_1": [], "test_366_2": [], "test_366_3": [], "test_366_4": [], # Uses a function that is undefined "test_3837": [], "test_4521": [], "test_4648": [], "test_4882": [], "test_5351": [], # Fails and it is unclear why. Needs further investigation. "test_5502": [], "test_5542_1": [], "test_5542_2": [], "test_5542_3": [], "test_5891": [], "test_6170": [], "test_6174": [], "test_7160": [], "test_7328": [], "test_7571": [], "test_7665": [], "test_7666": [], "test_7720": [], "test_7755": [], "test_8508": [], # Misses malloc.h which is deprecated "test_8557": [], "test_8586": [], "test_8596": [], "test_8600": [], "test_8674": [], "test_8943": [], "test_8960": [], "test_9079_a": [], # Misses iostream "test_9079_b": [], # Misses iostream "test_9192": ["@boost.interprocess"], # Uses boost::future which cannot compile "test_9303": ["@boost.asio"], "test_9319": [], "test_9711": [], "test_9856": [], "test_barrier": [], # Misses a nonexistent file from @boost.system "test_13561": [], "test_barrier_size_fct": [], "test_barrier_void_fct": [], "test_completion_latch": [], "test_condition": [], "test_condition_notify_all": [], "test_condition_notify_one": [], "test_condition_timed_wait_times_out": [], "test_futures": [], "test_generic_locks": [], "test_hardware_concurrency": [], "test_latch": [], "test_lock_concept": [], "test_ml": [], "test_ml2": [], "test_move_function": [], "test_mutex": [], "test_once": [], "test_physical_concurrency": [], "test_scheduled_tp": [], "test_scheduling_adaptor": [], "test_shared_mutex": [], "test_shared_mutex_part_2": [], "test_shared_mutex_timed_locks_chrono": [], "test_thread": [], "test_thread_exit": [], "test_thread_id": [], "test_thread_launching": [], "test_thread_mf": [], "test_thread_move": [], "test_thread_move_return": [], "test_thread_return_local": [], # Uses boost::future which cannot compile "test_time_jumps": [], "test_tss": [], "test_xtime": [], } _POSIX_ONLY_TESTS = { } _MAC_ONLY_TESTS = { "test_6130": [], "test_8455": [], } _WINDOWS_ONLY_TESTS = { "test_6130": [], } [cc_test( name = test, srcs = [ "{}.cpp".format(test), "util.inl", ] + glob(["*.hpp"]), defines = select({ "@platforms//os:macos": [], "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"], "//conditions:default": [], }), linkstatic = select({ "@platforms//os:macos": False, # Windows needs to link statically to get rid of undefined symbols "@platforms//os:windows": True, # Posix needs to link statically to get rid of undefined symbols "//conditions:default": True, }), deps = [ "@boost.test", "@boost.test//:unit_test_main", "@boost.thread", ] + _TESTS[test], ) for test in _TESTS] [cc_test( name = "posix_{}".format(test), srcs = [ "{}.cpp".format(test), "util.inl", ] + glob(["*.hpp"]), defines = select({ "@platforms//os:macos": [], "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"], "//conditions:default": [], }), # Posix needs to link statically to get rid of undefined symbols linkstatic = True, target_compatible_with = select({ "@platforms//os:macos": ["@platforms//:incompatible"], "@platforms//os:windows": ["@platforms//:incompatible"], "//conditions:default": [], }), deps = [ "@boost.test", "@boost.test//:unit_test_main", "@boost.thread", ] + _POSIX_ONLY_TESTS[test], ) for test in _POSIX_ONLY_TESTS] [cc_test( name = "mac_{}".format(test), srcs = [ "{}.cpp".format(test), "util.inl", ] + glob(["*.hpp"]), defines = select({ "@platforms//os:macos": [], "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"], "//conditions:default": [], }), target_compatible_with = select({ "@platforms//os:macos": [], "@platforms//os:windows": ["@platforms//:incompatible"], "//conditions:default": ["@platforms//:incompatible"], }), deps = [ "@boost.test", "@boost.test//:unit_test_main", "@boost.thread", ] + _MAC_ONLY_TESTS[test], ) for test in _MAC_ONLY_TESTS] [cc_test( name = "windows_{}".format(test), srcs = [ "{}.cpp".format(test), "util.inl", ] + glob(["*.hpp"]), defines = select({ "@platforms//os:macos": [], "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"], "//conditions:default": [], }), # Windows needs to link statically to get rid of undefined symbols linkstatic = True, target_compatible_with = select({ "@platforms//os:macos": ["@platforms//:incompatible"], "@platforms//os:windows": [], "//conditions:default": ["@platforms//:incompatible"], }), deps = [ "@boost.test", "@boost.test//:unit_test_main", "@boost.thread", ] + _WINDOWS_ONLY_TESTS[test], ) for test in _WINDOWS_ONLY_TESTS]