Skip to content

Commit

Permalink
TODO: (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
improbable-til authored Jan 19, 2022
1 parent a22703d commit 9a4a57c
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 54 deletions.
6 changes: 1 addition & 5 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ build:windows --action_env TMP=C:/Windows/Temp
build:windows --action_env TEMP=C:/Windows/Temp
build:windows --cxxopt="/DWIN32_LEAN_AND_MEAN"

# Config for when tests are running in a "slow" environment such as Valgrind or TSan
build:slow-tests --copt="-DIMPROBABLE_SLOW_TEST"

# Valgrind config.
build:valgrind-memcheck --config=linux
build:valgrind-memcheck --config=slow-tests
build:valgrind-memcheck --define valgrind-memcheck=true
test:valgrind-memcheck --run_under=//tools/runners/sanitizers/valgrind-memcheck
run:valgrind-memcheck --run_under=//tools/runners/sanitizers/valgrind-memcheck

Expand All @@ -85,7 +82,6 @@ test:asan --test_env="ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-9/bin/llvm-symbolizer"
test:asan --run_under=//tools/runners/sanitizers/asan

build:tsan --config=base-sanitizer
build:tsan --config=slow-tests
build:tsan --copt="-O1"
build:tsan --copt="-fno-optimize-sibling-calls"
build:tsan --copt="-fsanitize=thread"
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
4.2.2
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- FilterSphere for filtering by sphere constraint (by ctbur)
### Changed
- Fixed imports `<climits>` -> `<limits>` (by ctbur)
- Cleaned up build scripts
- Fixed warnings:
- "unused" function argument warnings
- "unused function argument" warnings
- gcc/clang warnings
- MSVC warnings
- reserved identifier warnings (identifiers starting with `_`)
Expand Down
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ http_archive(
load("@bazel_skylib//lib:versions.bzl", "versions")

versions.check(
minimum_bazel_version = "3.4.1",
maximum_bazel_version = "3.4.1",
minimum_bazel_version = "4.2.2",
maximum_bazel_version = "4.2.2",
)

# NOTE: We make third_party/ its own bazel workspace because it allows to run `bazel build ...` without
Expand All @@ -34,9 +34,9 @@ http_archive(

http_archive(
name = "gbenchmark",
sha256 = "3c6a165b6ecc948967a1ead710d4a181d7b0fbcaa183ef7ea84604994966221a",
strip_prefix = "benchmark-1.5.0",
url = "https://github.com/google/benchmark/archive/v1.5.0.tar.gz",
sha256 = "dccbdab796baa1043f04982147e67bb6e118fe610da2c65f88912d73987e700c",
strip_prefix = "benchmark-1.5.2",
url = "https://github.com/google/benchmark/archive/v1.5.2.tar.gz",
)

http_archive(
Expand Down
2 changes: 1 addition & 1 deletion ci/includes/bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ function runBazel() {
}

function getBazelVersion() {
echo "3.4.1"
echo "4.2.2"
}
2 changes: 1 addition & 1 deletion ci/linting/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export MSYS2_ARG_CONV_EXCL="//..."
function joinBy { perl -e '$s = shift @ARGV; print join($s, @ARGV);' "$@"; }

function clangFormatLocation() {
local CLANG_FORMAT_VERSION=9.0.0
local CLANG_FORMAT_VERSION=10.0.0
# Use find to get the path for either clang-format (macOS / Linux) or clang-format.exe (Windows)
local CLANG_FORMAT_EXE=clang-format
local CLANG_FORMAT_SHIM=clang-format
Expand Down
42 changes: 3 additions & 39 deletions tools/bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,19 @@ source "${TOOLS_DIR}"/../ci/includes/bazel.sh
REQUIRED_BAZEL_VERSION="$(getBazelVersion)"
BAZEL_INSTALLATION_DIR="${HOME}/.bazel_installations/${REQUIRED_BAZEL_VERSION}"
if isLinux; then
REQUIRED_BAZEL_SHA256="1a64c807716e10c872f1618852d95f4893d81667fe6e691ef696489103c9b460"
REQUIRED_BAZEL_SHA256CMD="sha256sum"
DOWNLOAD_CMD="wget -q --no-clobber -O bazel"
BAZEL_EXE="bazel-${REQUIRED_BAZEL_VERSION}-linux-x86_64"

if [[ !("$(lsb_release -cs)" =~ ^(bionic|focal)$) ]]; then
echo -e "\033[0;33mWarning: You don't seem to be running Ubuntu 18.04 or 20.04, which is the supported Linux distribution. Continuing anyway, but your mileage might vary.\033[0m"
fi

if which clang-9 1>/dev/null; then
# We follow the symlink of clang-9 here to avoid a bug with the LLVM package when combined with -no-canonical-prefixes.
export CC="$(readlink -f "$(which clang-9)")"
if which clang-10 1>/dev/null; then
# We follow the symlink of clang-10 here to avoid a bug with the LLVM package when combined with -no-canonical-prefixes.
export CC="$(readlink -f "$(which clang-10)")"
else
echo -e "\033[0;33mWarning: You don't seem to have clang-9 correctly installed. Please check README.md to ensure your compiler is set up correctly. Continuing with whatever compiler bazel detects, your mileage might vary.\033[0m"
fi
elif isMacOS; then
REQUIRED_BAZEL_SHA256="23ea93e5ef9f381babd7f658bbbf12d366510f0a719e816fea90bcbe9737aef2"
REQUIRED_BAZEL_SHA256CMD="shasum -a 256"
DOWNLOAD_CMD="wget -q --no-clobber -O bazel"
BAZEL_EXE="bazel-${REQUIRED_BAZEL_VERSION}-darwin-x86_64"
else
REQUIRED_BAZEL_SHA256="d526f04197a1362d95f1d214d2aa51cde527fae01c5752ccea1167475c6f1c60"
REQUIRED_BAZEL_SHA256CMD="sha256sum"
DOWNLOAD_CMD="curl -L -s -o bazel.exe"
# Windows does not have an installer but retrieves the executable directly.
BAZEL_EXE="bazel-${REQUIRED_BAZEL_VERSION}-windows-x86_64.exe"
Expand Down Expand Up @@ -77,22 +67,6 @@ if [[ ! -d "${BAZEL_INSTALLATION_DIR}" ]]; then
mkdir -p "${BAZEL_INSTALLATION_DIR}"
fi

function _are_checksums_equal() {
CHECKSUM_A=$1
CHECKSUM_B=$2
# Split apart the checksum from the file name by splitting the returned string by the contained
# space; the checksum has the format:
# xxxxxx...xxxxx <filename>
CHECKSUM_A_PARTS=(${CHECKSUM_A})
CHECKSUM_B_PARTS=(${CHECKSUM_B})

if [[ "${CHECKSUM_A_PARTS[0]}" == "${CHECKSUM_B_PARTS[0]}" ]]; then
return 0 # True
else
return 1 # False
fi
}

# Install correct bazel version.
# If we don't have a local Bazel install at this point we need to retrieve the right version from GitHub.
mkdir -p "${BAZEL_INSTALLATION_DIR}/bin/tmp"
Expand All @@ -101,16 +75,6 @@ rm bazel 2>/dev/null || true # Remove bazel binary if already present in tmp dir
echo "Starting download of bazel ${REQUIRED_BAZEL_VERSION}..."
${DOWNLOAD_CMD} "https://github.com/bazelbuild/bazel/releases/download/${REQUIRED_BAZEL_VERSION}/${BAZEL_EXE}"
echo "Download finished."
echo "Testing download file integrity..."
CALCULATED_CHECKSUM="$(${REQUIRED_BAZEL_SHA256CMD} bazel)"
if ! _are_checksums_equal "${CALCULATED_CHECKSUM}" "${REQUIRED_BAZEL_SHA256}"; then
cat <<EOM
ABORT - Downloaded Bazel failed the SHA-256 hash check.
ABORT - Expected: ${REQUIRED_BAZEL_SHA256} bazel
ABORT - Found: ${CALCULATED_CHECKSUM}
EOM
exit 1
fi
# Mark downloaded file executable and move out of tmp directory.
chmod a+x "bazel"
mv bazel ..
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
valgrind --leak-check=full --error-exitcode=1 --suppressions=tools/runners/sanitizers/valgrind-memcheck/valgrind-suppressions.txt "${@}"
valgrind --leak-check=full --error-exitcode=1 --num-callers=30 --suppressions=tools/runners/sanitizers/valgrind-memcheck/valgrind-suppressions.txt "${@}"
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,38 @@
fun:CRYPTO_THREAD_run_once
fun:OPENSSL_init_crypto
}
{
pthread_stack_allocation
Memcheck:Leak
match-leak-kinds: possible
...
fun:allocate_stack
fun:pthread_create*
}
{
gtest_use_of_uninitialised_value
Memcheck:Value8
fun:_itoa_word
fun:vfprintf
fun:vsnprintf
fun:snprintf
fun:_ZN7testing*
}
{
gtest_conditional_jump_or_move
Memcheck:Cond
fun:_itoa_word
fun:vfprintf
fun:vsnprintf
fun:snprintf
fun:_ZN7testing*
}
{
gtest_conditional_jump_or_move_2
Memcheck:Cond
fun:vfprintf
fun:vsnprintf
fun:snprintf
fun:_ZN7testing*
}

0 comments on commit 9a4a57c

Please sign in to comment.