From 66873b596119fc691f1b1c05aa6d09f2ff1b5849 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 22 Feb 2012 12:30:38 +0100 Subject: [PATCH] tests: avoid spurious failures under "make distcheck" * tests/tap-setup.sh: Pass also '-f' option to 'cp' invocations, so that files that have already been copied in without write permissions will still be overwritten where needed, instead of causing a spurious testsuite failure. Issue seen when the testsuite is run under "distcheck". * tests/defs (get_shell_script): Remove target file before overwriting it, for the same reason. Rework code flow a bit since we are at it. --- tests/defs | 8 +++++--- tests/tap-setup.sh | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/defs b/tests/defs index 98bc8e1a5..fd0a8adbf 100644 --- a/tests/defs +++ b/tests/defs @@ -612,11 +612,13 @@ sed_unindent_prog="" # Avoid interferences from the environment. # of /bin/sh. get_shell_script () { + test ! -f "$1" || rm -f "$1" || return 99 if test x"$am_test_prefer_config_shell" = x"yes"; then - sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" - chmod a+x "$1" + sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \ + && chmod a+x "$1" \ + || return 99 else - cp "$am_scriptdir/$1" . + cp -f "$am_scriptdir/$1" . || return 99 fi sed 10q "$1" # For debugging. } diff --git a/tests/tap-setup.sh b/tests/tap-setup.sh index ee9d814ed..6b69a53da 100755 --- a/tests/tap-setup.sh +++ b/tests/tap-setup.sh @@ -28,7 +28,7 @@ test -f ../defs-static && test -f ../defs \ test ! -f Makefile.am || mv Makefile.am Makefile.am~ \ || fatal_ "failed to save Makefile.am" -test -d ../tap-common-setup.dir && cp -Rp ../tap-common-setup.dir/* . \ +test -d ../tap-common-setup.dir && cp -fpR ../tap-common-setup.dir/* . \ || fatal_ "couldn't get precomputed data files" fetch_tap_driver -- 2.47.2