From ed3e10408e37bd9fe6fbcdd727f5a960f77591f7 Mon Sep 17 00:00:00 2001 From: Xinhao Yuan Date: Thu, 12 Sep 2024 17:05:32 -0700 Subject: [PATCH] #Centipede MacOS support 2/X: fix the build flags for early_exit and stats. PiperOrigin-RevId: 674065155 --- .github/workflows/bazel_test_centipede.yml | 5 ++++- MODULE.bazel | 6 ++++++ WORKSPACE | 9 +++++++++ centipede/BUILD | 14 ++++++++++++-- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bazel_test_centipede.yml b/.github/workflows/bazel_test_centipede.yml index 35db2770..a9b08a50 100644 --- a/.github/workflows/bazel_test_centipede.yml +++ b/.github/workflows/bazel_test_centipede.yml @@ -108,14 +108,17 @@ jobs: if: ${{ !cancelled() }} run: | bazel test --local_test_jobs=1 --test_output=errors --no//fuzztest:use_riegeli \ + centipede:binary_info_test centipede:call_graph_test \ centipede:callstack_test centipede:concurrent_bitset_test \ centipede:concurrent_byteset_test centipede:config_file_test \ centipede:config_util_test centipede:environment_test \ - centipede:feature_test centipede:foreach_nonzero_test \ + centipede:feature_set_test centipede:feature_test \ + centipede:foreach_nonzero_test \ centipede:hashed_ring_buffer_test centipede:int_utils_test \ centipede:knobs_test centipede:pc_info_test \ centipede:reverse_pc_table_test centipede:rolling_hash_test \ centipede:runner_cmp_trace_test centipede:runner_flags_test \ + centipede:stats_test centipede:symbol_table_test \ centipede:util_test centipede:workdir_test - name: Save new cache based on main if: github.ref == 'refs/heads/main' diff --git a/MODULE.bazel b/MODULE.bazel index e74dc1cf..56fcd4bf 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -35,6 +35,12 @@ bazel_dep( version = "1.7.1", ) +bazel_dep( + name = "platforms", + version = "0.0.10", + repo_name = "platforms", +) + # Dev dependencies. bazel_dep( name = "googletest", diff --git a/WORKSPACE b/WORKSPACE index 12385053..46b8292f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -27,6 +27,15 @@ http_archive( url = "https://github.com/abseil/abseil-cpp/releases/download/20240116.0/abseil-cpp-20240116.0.tar.gz" ) +http_archive( + name = "platforms", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", + "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", + ], + sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", +) + ################################################################################ # Transitive dependencies for core FuzzTest ################################################################################ diff --git a/centipede/BUILD b/centipede/BUILD index 3a89b0da..be39ea23 100644 --- a/centipede/BUILD +++ b/centipede/BUILD @@ -351,7 +351,12 @@ cc_library( name = "stats", srcs = ["stats.cc"], hdrs = ["stats.h"], - linkopts = ["-latomic"], # for std::atomic::load()/store(). + linkopts = select({ + "@platforms//os:macos": [], + "//conditions:default": [ + "-latomic", # for std::atomic::load()/store(). + ], + }), deps = [ ":environment", ":workdir", @@ -704,7 +709,12 @@ cc_library( name = "early_exit", srcs = ["early_exit.cc"], hdrs = ["early_exit.h"], - linkopts = ["-latomic"], # for std::atomic::load()/store(). + linkopts = select({ + "@platforms//os:macos": [], + "//conditions:default": [ + "-latomic", # for std::atomic::load()/store(). + ], + }), visibility = PUBLIC_API_VISIBILITY, )