HomeFreeBSD

ZTS: zfs-tests: set TMPDIR to FILEDIR

Description

ZTS: zfs-tests: set TMPDIR to FILEDIR

Many tests use mktemp to create temporary files and dirs, which will
usually put them in /tmp unless instructed otherwise. This had led to
many tests trying to give mktemp a useful temp path in ad-hoc ways, and
others just using it directly without knowing they're potentially
leaving stuff lying around.

So we set TMPDIR to FILEDIR, which makes the simplest uses of mktemp put
things in the wanted work dir.

Included here is a hack to get TMPDIR into the test. If a test has to be
run as a different user (most of them), it is run through sudo. ld.so
from glibc will not pass TMPDIR to a setuid program, so instead we
re-set TMPDIR after sudo before running the target command.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>

Details

Provenance
rob.norris_klarasystems.comAuthored on Feb 15 2025, 3:32 AM
Tony Hutter <hutter2@llnl.gov>Committed on Thu, Feb 27, 10:39 PM
Parents
rG2c897e06668b: ZTS: test-runner: always apply timestamp to outputdir before updating
Branches
Unknown
Tags
Unknown