mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 04:40:00 -04:00
testcrypto.sh: run in TMPDIR if possible
Avoid creating any temporary files in the current workdir. Additional/changing files in the bin/tests/system directory are problematic for pytest/xdist collection phase, which assumes the list of files doesn't change between the collection phase of the main pytest thread and the subsequent collection phase of the xdist worker threads. Since the testcrypto.sh is also called during pytest initialization through conf.sh.common (to detect feature support), this could occasionally cause a race condition when the list of files would be different for the main pytest thread and the xdist worker.
This commit is contained in:
parent
6f0c821c48
commit
61330a7863
2 changed files with 15 additions and 2 deletions
|
|
@ -111,7 +111,10 @@ def is_supported(alg: Algorithm) -> bool:
|
|||
f"{TESTCRYPTO} -q {alg.name}",
|
||||
shell=True,
|
||||
check=True,
|
||||
env={"KEYGEN": KEYGEN},
|
||||
env={
|
||||
"KEYGEN": KEYGEN,
|
||||
"TMPDIR": os.getenv("TMPDIR", "/tmp"),
|
||||
},
|
||||
stdout=subprocess.DEVNULL,
|
||||
)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
prog=$0
|
||||
args=""
|
||||
quiet=0
|
||||
dir=""
|
||||
msg="cryptography"
|
||||
|
||||
if test -z "$KEYGEN"; then
|
||||
|
|
@ -74,9 +75,18 @@ if test -z "$alg"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if test -n "$TMPDIR"; then
|
||||
dir=$(mktemp -d "$TMPDIR/XXXXXX")
|
||||
args="$args -K $dir"
|
||||
fi
|
||||
|
||||
if $KEYGEN $args $alg foo > /dev/null 2>&1
|
||||
then
|
||||
rm -f Kfoo*
|
||||
if test -z "$dir"; then
|
||||
rm -f Kfoo*
|
||||
else
|
||||
rm -rf "$dir"
|
||||
fi
|
||||
else
|
||||
if test $quiet -eq 0; then
|
||||
echo_i "This test requires support for $msg" >&2
|
||||
|
|
|
|||
Loading…
Reference in a new issue