Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 660854341
  • Loading branch information
xinhaoyuan authored and copybara-github committed Aug 8, 2024
1 parent ec01ce6 commit 24639e7
Show file tree
Hide file tree
Showing 39 changed files with 650 additions and 452 deletions.
72 changes: 0 additions & 72 deletions .github/workflows/bazel_test.yml

This file was deleted.

64 changes: 21 additions & 43 deletions .github/workflows/bazel_test_centipede.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,66 +25,44 @@ on:
workflow_dispatch:

jobs:
run_tests:
name: Run Centipede tests
runs-on: ubuntu-latest
run_tests_mac:
name: Run Centipede tests (MacOS)
runs-on: macos-13
timeout-minutes: 60
strategy:
matrix:
config: ['default', 'noriegeli', 'asan']
config: ['noriegeli']
steps:
# TODO(lszekeres): Remove once the following is fixed:
# https://github.com/actions/runner-images/issues/9491
- name: Reduce ASLR entropy as a temporary workaround
run: |
sudo sysctl -w vm.mmap_rnd_bits=28
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
clang llvm libssl-dev
- name: Restore latest cache
uses: actions/cache/restore@v4
with:
path: "~/.cache/bazel"
key: bazel-centipede-cache-${{ matrix.config }}
restore-keys: bazel-centipede-cache-${{ matrix.config }}-
- name: Run unit tests
if: matrix.config == 'default'
run: |
bazel test --local_test_jobs=1 --test_output=streamed centipede:all
- name: Run e2e tests
if: matrix.config == 'default'
run: |
bazel test --test_output=errors centipede/testing:instrumentation_test centipede/testing:runner_test
- name: Run puzzles
if: matrix.config == 'default'
key: bazel-centipede-cache-mac-${{ matrix.config }}
restore-keys: bazel-centipede-cache-mac-${{ matrix.config }}-
- name: Add LLVM symbolizer to path
run: |
bazel test --test_output=errors centipede/puzzles:all
- name: Run puzzles with ASAN
if: matrix.config == 'asan'
run: |
bazel test --test_output=errors --linkopt=-fsanitize=address --copt=-fsanitize=address centipede/puzzles:all
- name: Run unit tests without Riegeli
if: matrix.config == 'noriegeli'
run: |
bazel test --no//fuzztest:use_riegeli --local_test_jobs=1 --test_output=streamed centipede:all
ln -s $(brew --prefix llvm@15)/bin/llvm-symbolizer /usr/local/bin
# - name: Run unit tests
# if: ${{ !cancelled() && matrix.config == 'noriegeli' }}
# run: |
# bazel test --local_test_jobs=1 --test_output=errors --no//fuzztest:use_riegeli --linkopt=-Wl,-undefined,dynamic_lookup centipede:all
- name: Run e2e tests without Riegeli
if: matrix.config == 'noriegeli'
if: ${{ !cancelled() && matrix.config == 'noriegeli' }}
run: |
bazel test --no//fuzztest:use_riegeli --test_output=errors centipede/testing:instrumentation_test centipede/testing:runner_test
bazel test --test_output=streamed --no//fuzztest:use_riegeli --linkopt=-Wl,-undefined,dynamic_lookup centipede/testing:instrumentation_test centipede/testing:runner_test
- name: Run puzzles without Riegeli
if: matrix.config == 'noriegeli'
run: |
bazel test --no//fuzztest:use_riegeli --test_output=errors centipede/puzzles:all
- name: Run puzzles without Riegeli with ASAN
if: matrix.config == 'noriegeli'
if: ${{ !cancelled() && matrix.config == 'noriegeli' }}
run: |
bazel test --no//fuzztest:use_riegeli --test_output=errors --linkopt=-fsanitize=address --copt=-fsanitize=address centipede/puzzles:all
bazel test --test_output=streamed --no//fuzztest:use_riegeli --linkopt=-Wl,-undefined,dynamic_lookup centipede/puzzles:run_1_per_input_timeout
# - name: Run puzzles without Riegeli with ASAN
# if: ${{ !cancelled() && matrix.config == 'noriegeli' }}
# run: |
# bazel test --no//fuzztest:use_riegeli --test_output=errors --linkopt=-Wl,-undefined,dynamic_lookup --linkopt=-fsanitize=address --copt=-fsanitize=address centipede/puzzles:all
- name: Save new cache based on main
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: "~/.cache/bazel"
key: bazel-centipede-cache-${{ matrix.config }}-${{ github.run_id }}
key: bazel-centipede-cache-mac-${{ matrix.config }}-${{ github.run_id }}
100 changes: 0 additions & 100 deletions .github/workflows/cmake_test.yml

This file was deleted.

9 changes: 9 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand Down
36 changes: 29 additions & 7 deletions centipede/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -420,7 +425,12 @@ cc_library(
name = "shared_memory_blob_sequence",
srcs = ["shared_memory_blob_sequence.cc"],
hdrs = ["shared_memory_blob_sequence.h"],
linkopts = ["-lrt"], # for shm_open.
linkopts = select({
"@platforms//os:macos": [],
"//conditions:default": [
"-lrt", # for shm_open
],
}),
visibility = PUBLIC_API_VISIBILITY,
deps = ["@com_google_absl//absl/base:nullability"],
# don't add any dependencies.
Expand Down Expand Up @@ -702,7 +712,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,
)

Expand Down Expand Up @@ -1015,9 +1030,13 @@ RUNNER_SANITIZED_COPTS = [

RUNNER_LINKOPTS = [
"-ldl", # for dlsym
"-lrt", # for shm_open
"-lpthread", # for pthread_once
]
] + select({
"@platforms//os:macos": [],
"//conditions:default": [
"-lrt", # for shm_open
],
})

# WARNING: be careful with more deps here. Use only the most trivial ones.
RUNNER_DEPS = [
Expand Down Expand Up @@ -1162,8 +1181,11 @@ sh_library(
sh_library(
name = "test_util_sh",
srcs = ["test_util.sh"],
data = [
],
data = select({
"@platforms//os:macos": [],
"//conditions:default": [
],
}),
)

################################################################################
Expand Down
4 changes: 2 additions & 2 deletions centipede/centipede_callbacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ Command &CentipedeCallbacks::GetOrCreateCommandForBinary(
Command &cmd = commands_.emplace_back(Command(
/*path=*/binary, /*args=*/{},
/*env=*/env,
/*out=*/execute_log_path_,
/*err=*/execute_log_path_,
/*out=*/"",
/*err=*/"",
/*timeout=*/amortized_timeout,
/*temp_file_path=*/temp_input_file_path_));
if (env_.fork_server) cmd.StartForkServer(temp_dir_, Hash(binary));
Expand Down
4 changes: 2 additions & 2 deletions centipede/centipede_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ class CentipedeCallbacks {
std::filesystem::path(temp_dir_).append("log");
std::string failure_description_path_ =
std::filesystem::path(temp_dir_).append("failure_description");
const std::string shmem_name1_ = ProcessAndThreadUniqueID("/centipede-shm1-");
const std::string shmem_name2_ = ProcessAndThreadUniqueID("/centipede-shm2-");
const std::string shmem_name1_ = ProcessAndThreadUniqueID("/ctpd-shm1-");
const std::string shmem_name2_ = ProcessAndThreadUniqueID("/ctpd-shm2-");

SharedMemoryBlobSequence inputs_blobseq_;
SharedMemoryBlobSequence outputs_blobseq_;
Expand Down
Loading

0 comments on commit 24639e7

Please sign in to comment.