From 02a2518efa224266db68a6bc5b5eaee1127c6ef9 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Wed, 22 Jun 2011 15:23:14 -0700 Subject: [PATCH] run-cli-tests: Pass through CCACHE_DIR and such env vars. Commit 7cd50f29d5cbf8deb64d00318b39c281119c0e03 makes the binaries use libtool's "executable wrappers", which will transparently relink the executables if they think that's needed. The test for that is somewhat flawed: if the mtimes match, the binary might or might not get relinked. In practise, this causes relinks on gitbuilder all the time. As of earlier commit 5a0bc6b78f2e40ec9255a1ea49f77ef9ea4690a6, we started sanitizing the environment passed to the clitests. This meant we also stripped away CCACHE_DIR and other settings, needed to properly relink the binaries. Re-add CCACHE_DIR, CC, CXX to clitests environment. To handle the case where CCACHE_DIR etc are not set in the first place, we need an extra wrapper script. Otherwise, ccache might see an empty string as the env value, and naturally couldn't access a directory by that name. Signed-off-by: Tommi Virtanen --- src/test/run-cli-tests | 4 ++++ src/test/run-cli-tests-maybe-unset-ccache | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 src/test/run-cli-tests-maybe-unset-ccache diff --git a/src/test/run-cli-tests b/src/test/run-cli-tests index 79a4e3372b50e..503e84793f0f5 100755 --- a/src/test/run-cli-tests +++ b/src/test/run-cli-tests @@ -41,6 +41,10 @@ for tool in "$SRCDIR"/cli/*; do if ! env --ignore-environment \ PATH="$BUILDDIR_ABS/..:$SRCDIR_ABS/..:$PATH" \ CEPH_CONF=/dev/null \ + CCACHE_DIR="$CCACHE_DIR" \ + CC="$CC" \ + CXX="$CXX" \ + "$SRCDIR/run-cli-tests-maybe-unset-ccache" \ "$CRAM_BIN" -v "$@" --error-dir="$BUILDDIR/cli/$toolname" -- "$tool"/*.t; then FAILED=1 fi diff --git a/src/test/run-cli-tests-maybe-unset-ccache b/src/test/run-cli-tests-maybe-unset-ccache new file mode 100755 index 0000000000000..ba72b06224c53 --- /dev/null +++ b/src/test/run-cli-tests-maybe-unset-ccache @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +# ccache breaks if it sees CCACHE_DIR="", yet due to clumsiness of +# /usr/bin/env, it's hard to avoid setting env vars for the parent; +# unset them if they're empty + +if [ -z "$CCACHE_DIR" ]; then + unset CCACHE_DIR +fi + +if [ -z "$CC" ]; then + unset CC +fi + +if [ -z "$CXX" ]; then + unset CXX +fi + +exec "$@" -- 2.39.5