mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Use /tmp more in shell tests
Anything that invokes 'use_test_subdirectory' should go to /tmp, not just a few scripts that overrode TEST_BASEDIR. After this there are approximately 6 files that will fail if pwd isn't writable. Most involve run-compiler.sh and also filesys tests. Plus there's a hack in run-sbcl.sh without which it would already fail when writing into /tmp.
This commit is contained in:
parent
451235467e
commit
ea0e1f96e1
|
|
@ -13,7 +13,6 @@
|
|||
# absolutely no warranty. See the COPYING and CREDITS files for
|
||||
# more information.
|
||||
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
run_sbcl <<EOF
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@
|
|||
# absolutely no warranty. See the COPYING and CREDITS files for
|
||||
# more information.
|
||||
|
||||
# Most of our shell tests write a few files into the source tree which is bad,
|
||||
# but this script is especially bad because it spews out dozens of files.
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
# more information.
|
||||
|
||||
run_compiler=`pwd`/run-compiler.sh
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./expect.sh
|
||||
. ./subr.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
create_test_subdirectory
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ fi
|
|||
run_sbcl_path="$test_file_directory_path/../run-sbcl.sh"
|
||||
|
||||
# Now we're going to frob the file system, so let's do it properly.
|
||||
use_test_subdirectory
|
||||
# (for some definition of "properly?")
|
||||
use_test_subdirectory_in_source_tree
|
||||
|
||||
# 9d5be5e953 (lp#1242643) addressed the possibility that run-sbcl.sh
|
||||
# was a symlink into the repo. Let's exercise it, 8 years later.
|
||||
|
|
@ -67,6 +68,7 @@ rm ./run-sbcl-absolute-symlink.sh
|
|||
# Test whether we can run-sbcl.sh through a symlink to a relative
|
||||
# path.
|
||||
echo "testing run-sbcl.sh when it's a symlink to a relative path"
|
||||
# good god, what does this sed command even do?
|
||||
ln -s $(pwd | sed 's|^/||; s|[^/][^/]*|..|g')/"$run_sbcl_path" ./run-sbcl-relative-symlink.sh
|
||||
test_run_sbcl ./run-sbcl-relative-symlink.sh
|
||||
rm ./run-sbcl-relative-symlink.sh
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
# Don't try to run sbcl from /tmp on openbsd as it's unlikely to be
|
||||
# mounted with wxallowed
|
||||
if [ "$SBCL_SOFTWARE_TYPE" != OpenBSD ]; then
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
fi
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
# Don't try to run sbcl from /tmp on openbsd as it's unlikely to be
|
||||
# mounted with wxallowed
|
||||
if [ "$SBCL_SOFTWARE_TYPE" != OpenBSD ]; then
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
fi
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
# Don't try to run sbcl from /tmp on openbsd as it's unlikely to be
|
||||
# mounted with wxallowed
|
||||
if [ "$SBCL_SOFTWARE_TYPE" != OpenBSD ]; then
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
fi
|
||||
. ./subr.sh
|
||||
|
||||
use_test_subdirectory
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
# Don't try to run sbcl from /tmp on openbsd as it's unlikely to be
|
||||
# mounted with wxallowed
|
||||
if [ "$SBCL_SOFTWARE_TYPE" != OpenBSD ]; then
|
||||
export TEST_BASEDIR=${TMPDIR:-/tmp}
|
||||
fi
|
||||
. ./subr.sh
|
||||
|
||||
this_file=`pwd`/save9.test.sh
|
||||
|
|
|
|||
|
|
@ -31,11 +31,13 @@ SBCL_CORE="${TEST_SBCL_CORE:-$SBCL_PWD/../output/sbcl.core}"
|
|||
SBCL_RUNTIME="${TEST_SBCL_RUNTIME:-$SBCL_PWD/../src/runtime/sbcl}"
|
||||
SBCL_ARGS="${TEST_SBCL_ARGS:---disable-ldb --noinform --no-sysinit --no-userinit --noprint --disable-debugger}"
|
||||
|
||||
# Scripts that use these variables should quote them.
|
||||
TEST_BASENAME=`basename $0`
|
||||
TEST_FILESTEM=`basename "${TEST_BASENAME}" | sed -e 's/\.sh$//' -e 's/\./-/g'`
|
||||
: ${TEST_BASEDIR:="$SBCL_PWD"}
|
||||
TEST_DIRECTORY="${TEST_BASEDIR}/${TEST_FILESTEM}-$$"
|
||||
|
||||
# Tests should probably not care about their own name.
|
||||
script_basename=`basename $0`
|
||||
# Scripts that use this variable should quote it.
|
||||
TEST_FILESTEM=`basename "${script_basename}" | sed -e 's/\.sh$//' -e 's/\./-/g'`
|
||||
|
||||
TEST_DIRECTORY="${SBCL_PWD}/${TEST_FILESTEM}-$$"
|
||||
export TEST_DIRECTORY
|
||||
|
||||
# "Ten four" is the closest numerical slang I can find to "OK", so
|
||||
|
|
@ -121,10 +123,41 @@ check_status_maybe_lose () {
|
|||
unset testname
|
||||
}
|
||||
|
||||
# Picking an output dir is delayed until actually needed.
|
||||
# In particular we can't read "$SBCL_SOFTWARE_TYPE" until after test-util
|
||||
# assigns it into the environment, but this script is also sourced
|
||||
# by run-tests.sh itself, which means that test-util hasn't done its thing.
|
||||
#
|
||||
pick_random_output_dir() {
|
||||
# Avoid writing into the source tree as much as possible.
|
||||
if [ "$SBCL_SOFTWARE_TYPE" != OpenBSD ]; then
|
||||
# Don't try to run sbcl from /tmp on openbsd as it's unlikely to be
|
||||
# mounted with wxallowed
|
||||
# If a test doesn't create an executable core, it would work to use /tmp,
|
||||
# but this utility is unaware of the intent of each test.
|
||||
# This means that some tests might flake our, and/or leave junk in your tree.
|
||||
base_dir=${TMPDIR:-/tmp}
|
||||
else
|
||||
base_dir="$SBCL_PWD"
|
||||
fi
|
||||
TEST_DIRECTORY="${base_dir}/${TEST_FILESTEM}-$$"
|
||||
}
|
||||
|
||||
# Not every test needs to touch the file system, but enough do to have
|
||||
# them consistently do so in subdirectories. Note that such tests
|
||||
# should not change their exit action, or do so only very carefully.
|
||||
use_test_subdirectory () {
|
||||
use_test_subdirectory () { # not a "subdirectory" now, but don't feel like renaming
|
||||
if test -d "$TEST_DIRECTORY"
|
||||
then
|
||||
cleanup_test_subdirectory
|
||||
fi
|
||||
pick_random_output_dir
|
||||
mkdir "$TEST_DIRECTORY"
|
||||
cd "$TEST_DIRECTORY"
|
||||
trap "cleanup_test_subdirectory" EXIT
|
||||
}
|
||||
|
||||
use_test_subdirectory_in_source_tree () { # DON'T USE THIS!
|
||||
if test -d "$TEST_DIRECTORY"
|
||||
then
|
||||
cleanup_test_subdirectory
|
||||
|
|
@ -140,6 +173,7 @@ create_test_subdirectory () {
|
|||
then
|
||||
cleanup_test_subdirectory
|
||||
fi
|
||||
pick_random_output_dir
|
||||
mkdir "$TEST_DIRECTORY"
|
||||
trap "cleanup_test_subdirectory" EXIT
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue