tests: Put tmp dirs in objdir, not /tmp 64/14864/3
authorAndrew Deason <adeason@sinenomine.net>
Tue, 23 Nov 2021 21:31:33 +0000 (15:31 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 7 Apr 2022 03:45:48 +0000 (23:45 -0400)
commita73712603588e9819127c5ec99e5a381bb4c69f5
treedc1acfa4e6b776582df8df4d64d74d8828799056
parent6aa129e743e882cf30c35afd67eabf82274c5fca
tests: Put tmp dirs in objdir, not /tmp

Currently, all tests that use afstest_mkdtemp() generate a temporary
dir in /tmp, which is removed when the test is done (unless MAKECHECK
isn't set, or the test prematurely exits/crashes). The /tmp dir on a
system may not be the best choice; it may be limited in size, and it's
visible to other users, which is annoying if we are littering the dir
with afs_XXXXXX dirs if broken tests are running during development.

Instead, use a tmp dir in the objdir of the current build
(specifically, tests/tmp/). Since this is the same dir we're building
the tree in, we must be able to write to it and it should have plenty
of space. And it will almost certainly get cleaned up eventually, even
with broken tests, since it will get removed when the build tree is
inevitably removed.

While we're doing this, run the paths from afstest_src_path and
afstest_obj_path through realpath(), so our tmp paths (and other
paths) look a little cleaner, and don't look like
/home/user/openafs/tests/../tests/tmp/foo.

Change-Id: I6633f58ac1f6ef34e33b51cc19d3bff7a4f3fdb0
Reviewed-on: https://gerrit.openafs.org/14864
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
tests/common/files.c