Skip to content

Commit

Permalink
tests: fix for vpath builds
Browse files Browse the repository at this point in the history
Fix make check for cases where builddir != srcdir
  • Loading branch information
grondo committed Jun 21, 2017
1 parent 9e9155f commit e6fd07a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 3 additions & 5 deletions tests/t0001-basic.sh
Expand Up @@ -7,7 +7,7 @@ if ! test -x ../src/pdsh/pdsh; then
exit 1
fi

. ${srcdir:-.}/test-lib.sh
. $(dirname $0)/test-lib.sh

###########################################################################
#
Expand All @@ -30,8 +30,7 @@ metrics
'
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY=\"$TEST_DIRECTORY\"
. \"\$TEST_DIRECTORY\"/test-lib.sh
. \"$TEST_SRCDIR\"/test-lib.sh
test_expect_failure 'pretend we have fixed a known breakage' '
:
Expand Down Expand Up @@ -80,8 +79,7 @@ test_description='Failing tests with cleanup commands'
# Don't log these as failures by pretending we're running under TAP::Harness
HARNESS_ACTIVE=t
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY=\"$TEST_DIRECTORY\"
. \"\$TEST_DIRECTORY\"/test-lib.sh
. \"$TEST_SRCDIR\"/test-lib.sh
test_expect_success 'tests clean up even after a failure' '
touch clean-after-failure &&
Expand Down
5 changes: 4 additions & 1 deletion tests/test-lib.sh
Expand Up @@ -19,6 +19,7 @@
# additionally to the file test-results/$BASENAME.out, too.

test_name=$(basename "$0" .sh)
test_dir=$(cd $(dirname "$0") && pwd)

case "$GIT_TEST_TEE_STARTED, $* " in
done,*)
Expand Down Expand Up @@ -84,7 +85,7 @@ fi
#
if test -z "$PDSH_SRC_DIR"; then
if test -z "$srcdir"; then
PDSH_SRC_DIR=$(pwd)/..
PDSH_SRC_DIR=${test_dir}/..
else
PDSH_SRC_DIR=$(cd ${srcdir} && pwd)/..
fi
Expand Down Expand Up @@ -490,6 +491,7 @@ test_external () {
# Export TEST_DIRECTORY, TRASH_DIRECTORY and GIT_TEST_LONG
# to be able to use them in script
export TEST_DIRECTORY TRASH_DIRECTORY GIT_TEST_LONG
export TEST_SRCDIR="${test_dir}"
# Run command; redirect its stderr to &4 as in
# test_run_, but keep its stdout on our stdout even in
# non-verbose mode.
Expand Down Expand Up @@ -762,6 +764,7 @@ then
# itself.
TEST_DIRECTORY=$(pwd)
fi
TEST_SRCDIR=${test_dir}

if test -n "$valgrind"
then
Expand Down

0 comments on commit e6fd07a

Please sign in to comment.