tests: Harmonize temporary and socket directory handling.
authorJustus Winter <justus@g10code.com>
Mon, 6 Mar 2017 16:16:41 +0000 (17:16 +0100)
committerJustus Winter <justus@g10code.com>
Mon, 6 Mar 2017 17:10:10 +0000 (18:10 +0100)
commit7e19786a5ddef637d1d9d21593fecf5a36b6f372
tree99a84f29f96786d50228cf260f2c5d4ed929be97
parent171e4314ebd3ff74af3dcdc8bd68e1100e8910ea
tests: Harmonize temporary and socket directory handling.

* tests/gpgscm/tests.scm (mkdtemp): Do not magically obey the
environment variable 'TMP', make sure to always return an absolute
path.
* tests/gpgme/Makefile.am (TMP): Drop variable.
(TESTS_ENVIRONMENT): Drop 'TMP'.
* tests/gpgme/gpgme-defs.scm (create-gpgmehome): Start the agent.  Do
not create private key store, the agent does that for us.
* tests/gpgsm/Makefile.am (TMP): Drop variable.
(TESTS_ENVIRONMENT): Drop 'TMP'.
* tests/gpgme/gpgme-defs.scm (create-gpgsmhome): Start the agent.  Do
not create private key store, the agent does that for us.
* tests/migrations/Makefile.am (TMP): Drop variable.
(TESTS_ENVIRONMENT): Drop 'TMP'.
* tests/migrations/common.scm (gpgconf): New variable.
(run-test): Create and remove socket directory.
* tests/migrations/extended-pkf.scm (src-tarball): Remove variable.
(setup): Remove function.
(trigger-migration): Likewise.
Use 'run-test' to execute the test.
* tests/migrations/from-classic.scm (src-tarball): Remove variable.
(setup): Remove function.
Use 'run-test' to execute the tests.
* tests/openpgp/Makefile.am (TMP): Drop variable.
(TESTS_ENVIRONMENT): Drop 'TMP'.
* tests/openpgp/README: Do not mention 'TMP'.
* tests/openpgp/defs.scm (with-home-directory): New macro.
(create-legacy-gpghome): Do not create private key store, the agent
does that for us.
(start-agent): Make sure to terminate the right agent with 'atexit'.
--

Previously, the test suite relied upon creating home directories in
'/tmp'.  This has been problematic in some build environments,
although POSIX mandates that '/tmp' must be available.

We now rely on 'gpgconf --create-socketdir' to create a suitable
socket directory for us.  This allows us to get rid of some cruft.  It
also aligns the environment the tests are run in closer with the
environment that we intend that GnuPG runs in.

Signed-off-by: Justus Winter <justus@g10code.com>
13 files changed:
tests/gpgme/Makefile.am
tests/gpgme/gpgme-defs.scm
tests/gpgscm/tests.scm
tests/gpgsm/Makefile.am
tests/gpgsm/gpgsm-defs.scm
tests/migrations/Makefile.am
tests/migrations/common.scm
tests/migrations/extended-pkf.scm
tests/migrations/from-classic.scm
tests/openpgp/Makefile.am
tests/openpgp/README
tests/openpgp/defs.scm
tests/openpgp/setup.scm