mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-27 01:44:20 +00:00
tests: import test infrastructure from coreutils
* tests/init.cfg: New file, for require_valgrind_ definition (from coreutils). * tests/Makefile.am (PATH): Don't set stderr_fileno_ here, since it is now initialized in init.cfg.
This commit is contained in:
parent
f878003953
commit
a28327bd77
68
init.cfg
Normal file
68
init.cfg
Normal file
@ -0,0 +1,68 @@
|
||||
# This file is sourced by init.sh, *before* its initialization.
|
||||
|
||||
# Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Skip the current test if valgrind doesn't work,
|
||||
# which could happen if not installed,
|
||||
# or hasn't support for the built architecture,
|
||||
# or hasn't appropriate error suppressions installed etc.
|
||||
|
||||
# This goes hand in hand with the "exec 9>&2;" in tests/Makefile.am's
|
||||
# TESTS_ENVIRONMENT definition.
|
||||
stderr_fileno_=9
|
||||
|
||||
# Having an unsearchable directory in PATH causes execve to fail with EACCES
|
||||
# when applied to an unresolvable program name, contrary to the desired ENOENT.
|
||||
# Avoid the problem by rewriting PATH to exclude unsearchable directories.
|
||||
# Also, if PATH lacks /sbin and/or /usr/sbin, append it/them.
|
||||
sanitize_path_()
|
||||
{
|
||||
# FIXME: remove double quotes around $IFS when all tests use init.sh.
|
||||
# They constitute a work-around for a bug in FreeBSD 8.1's /bin/sh.
|
||||
local saved_IFS="$IFS"
|
||||
IFS=:
|
||||
set -- $PATH
|
||||
IFS=$saved_IFS
|
||||
|
||||
local d d1
|
||||
local colon=
|
||||
local new_path=
|
||||
for d in "$@"; do
|
||||
test -z "$d" && d1=. || d1=$d
|
||||
if ls -d "$d1/." > /dev/null 2>&1; then
|
||||
new_path="$new_path$colon$d"
|
||||
colon=':'
|
||||
fi
|
||||
done
|
||||
|
||||
for d in /sbin /usr/sbin ; do
|
||||
case ":$new_path:" in
|
||||
*:$d:*) ;;
|
||||
*) new_path="$new_path:$d" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
PATH=$new_path
|
||||
export PATH
|
||||
}
|
||||
|
||||
require_valgrind_()
|
||||
{
|
||||
valgrind --error-exitcode=1 true 2>/dev/null ||
|
||||
skip_ "requires a working valgrind"
|
||||
}
|
||||
|
||||
sanitize_path_
|
||||
@ -80,7 +80,6 @@ TESTS_ENVIRONMENT = \
|
||||
PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
|
||||
REPLACE_GETCWD=$(REPLACE_GETCWD) \
|
||||
PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
|
||||
stderr_fileno_=9 \
|
||||
; 9>&2
|
||||
|
||||
LOG_COMPILER= $(SHELL)
|
||||
|
||||
68
tests/init.cfg
Normal file
68
tests/init.cfg
Normal file
@ -0,0 +1,68 @@
|
||||
# This file is sourced by init.sh, *before* its initialization.
|
||||
|
||||
# Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Skip the current test if valgrind doesn't work,
|
||||
# which could happen if not installed,
|
||||
# or hasn't support for the built architecture,
|
||||
# or hasn't appropriate error suppressions installed etc.
|
||||
|
||||
# This goes hand in hand with the "exec 9>&2;" in tests/Makefile.am's
|
||||
# TESTS_ENVIRONMENT definition.
|
||||
stderr_fileno_=9
|
||||
|
||||
# Having an unsearchable directory in PATH causes execve to fail with EACCES
|
||||
# when applied to an unresolvable program name, contrary to the desired ENOENT.
|
||||
# Avoid the problem by rewriting PATH to exclude unsearchable directories.
|
||||
# Also, if PATH lacks /sbin and/or /usr/sbin, append it/them.
|
||||
sanitize_path_()
|
||||
{
|
||||
# FIXME: remove double quotes around $IFS when all tests use init.sh.
|
||||
# They constitute a work-around for a bug in FreeBSD 8.1's /bin/sh.
|
||||
local saved_IFS="$IFS"
|
||||
IFS=:
|
||||
set -- $PATH
|
||||
IFS=$saved_IFS
|
||||
|
||||
local d d1
|
||||
local colon=
|
||||
local new_path=
|
||||
for d in "$@"; do
|
||||
test -z "$d" && d1=. || d1=$d
|
||||
if ls -d "$d1/." > /dev/null 2>&1; then
|
||||
new_path="$new_path$colon$d"
|
||||
colon=':'
|
||||
fi
|
||||
done
|
||||
|
||||
for d in /sbin /usr/sbin ; do
|
||||
case ":$new_path:" in
|
||||
*:$d:*) ;;
|
||||
*) new_path="$new_path:$d" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
PATH=$new_path
|
||||
export PATH
|
||||
}
|
||||
|
||||
require_valgrind_()
|
||||
{
|
||||
valgrind --error-exitcode=1 true 2>/dev/null ||
|
||||
skip_ "requires a working valgrind"
|
||||
}
|
||||
|
||||
sanitize_path_
|
||||
Loading…
x
Reference in New Issue
Block a user