1
hermetic_cc_toolchain/ci/test

30 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -xeuo pipefail
BAZEL_ZIG_CC_CACHE_PREFIX=${BAZEL_ZIG_CC_CACHE_PREFIX:-/tmp/bazel-zig-cc}
mkdir -p "${BAZEL_ZIG_CC_CACHE_PREFIX}"
# check a very hermetic setup with a single target. Re-building all of
# them takes a long time, so using only one. If we ever decide to build all
# targets, we will need to exclude Go, since go dynamically links to glibc on
# linux.
bazel build "$@" \
--experimental_use_hermetic_linux_sandbox \
--sandbox_add_mount_pair=/proc \
//test/c:which_libc_linux_amd64_gnu.2.19
# then test everything else with the standard sandbox
bazel test "$@" ...
2023-02-24 11:43:00 +02:00
# TODO: Go 1.20 regressed this. Find a way to re-enable. See README.
# $BAZEL_ZIG_CC_CACHE_PREFIX should be empty for the test below to be valid.
# Ensure that github.com/ziglang/zig/issues/13050 does not regress
2023-02-24 11:43:00 +02:00
#find "$BAZEL_ZIG_CC_CACHE_PREFIX" -name mutex_destructor.o -execdir file '{}' \; | \
# sort | uniq -c | sort -rn > /tmp/got_cache
#
#diff -u ci/testdata/want_cache /tmp/got_cache || {
# >&2 echo "ERROR: unexpected artifacts."
# >&2 echo "Was $BAZEL_ZIG_CC_CACHE_PREFIX empty before the test?"
# exit 1
#}