From 965f8ecbfd8b91bbd4f5ee4914c028660bb89029 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 9 Apr 2021 07:22:42 -0700 Subject: [PATCH] Googletest export Generalize root directory in CI scripts PiperOrigin-RevId: 367628939 --- ci/linux-presubmit.sh | 12 +++++++----- ci/macos-presubmit.sh | 8 +++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh index 5cbd7c41..d02130c3 100644 --- a/ci/linux-presubmit.sh +++ b/ci/linux-presubmit.sh @@ -34,7 +34,9 @@ set -euox pipefail readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20201008" readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20201015" -SRC=$(realpath git/googletest) +if [[ -z ${GTEST_ROOT:-} ]]; then + GTEST_ROOT="$(realpath $(dirname ${0})/..)" +fi if [[ -z ${STD:-} ]]; then STD="c++11 c++14 c++17 c++20" @@ -44,7 +46,7 @@ fi for cc in /usr/local/bin/gcc /opt/llvm/clang/bin/clang; do for cmake_off_on in OFF ON; do time docker run \ - --volume="${SRC}:/src:ro" \ + --volume="${GTEST_ROOT}:/src:ro" \ --tmpfs="/build:exec" \ --workdir="/build" \ --rm \ @@ -66,7 +68,7 @@ done # Do one test with an older version of GCC time docker run \ - --volume="${SRC}:/src:ro" \ + --volume="${GTEST_ROOT}:/src:ro" \ --workdir="/src" \ --rm \ --env="CC=/usr/local/bin/gcc" \ @@ -83,7 +85,7 @@ time docker run \ for std in ${STD}; do for absl in 0 1; do time docker run \ - --volume="${SRC}:/src:ro" \ + --volume="${GTEST_ROOT}:/src:ro" \ --workdir="/src" \ --rm \ --env="CC=/usr/local/bin/gcc" \ @@ -103,7 +105,7 @@ done for std in ${STD}; do for absl in 0 1; do time docker run \ - --volume="${SRC}:/src:ro" \ + --volume="${GTEST_ROOT}:/src:ro" \ --workdir="/src" \ --rm \ --env="CC=/opt/llvm/clang/bin/clang" \ diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh index 4a5dc3e9..d6423faa 100644 --- a/ci/macos-presubmit.sh +++ b/ci/macos-presubmit.sh @@ -31,13 +31,15 @@ set -euox pipefail -SRC=$(realpath git/googletest) +if [[ -z ${GTEST_ROOT:-} ]]; then + GTEST_ROOT="$(realpath $(dirname ${0})/..)" +fi # Test the CMake build for cmake_off_on in OFF ON; do BUILD_DIR=$(mktemp -d build_dir.XXXXXXXX) cd ${BUILD_DIR} - time cmake ${SRC} \ + time cmake ${GTEST_ROOT} \ -DCMAKE_CXX_STANDARD=11 \ -Dgtest_build_samples=ON \ -Dgtest_build_tests=ON \ @@ -59,7 +61,7 @@ else BAZEL_BIN="bazel" fi -cd ${SRC} +cd ${GTEST_ROOT} for absl in 0 1; do ${BAZEL_BIN} test ... \ --copt="-Wall" \