diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-12-14 13:50:14 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-12-14 16:50:21 +0100 |
commit | 2816ac4ad01874203efdbf9961ca2c22cbd94a3c (patch) | |
tree | c6176bcc625ad28323f398ac570b47ebeb4276b5 /xmlsecurity | |
parent | f894386a8fe58639c295048fe7894f68613a0df1 (diff) |
xmlsecurity: move GNUPGHOME to $workdir for unit test
Since some GnuPG versions tend to litter the source tree with random
files otherwise.
Change-Id: I0302f73b216f2de4dafcb6adca81097ec9d87e8c
Reviewed-on: https://gerrit.libreoffice.org/46447
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 7e737f8f3bd4..18dd99644f35 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -163,26 +163,27 @@ void SigningTest::setUp() mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); mxSecurityContext = mxSEInitializer->createSecurityContext(OUString()); -#ifndef _WIN32 - // Set up cert8.db in workdir/CppunitTest/ OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY); OUString aTargetDir = m_directories.getURLFromWorkdir( "/CppunitTest/xmlsecurity_signing.test.user/"); + + // Set up cert8.db in workdir/CppunitTest/ osl::File::copy(aSourceDir + "cert8.db", aTargetDir + "cert8.db"); osl::File::copy(aSourceDir + "key3.db", aTargetDir + "key3.db"); + + // Make gpg use our own defined setup & keys + osl::File::copy(aSourceDir + "pubring.gpg", aTargetDir + "pubring.gpg"); + osl::File::copy(aSourceDir + "random_seed", aTargetDir + "random_seed"); + osl::File::copy(aSourceDir + "secring.gpg", aTargetDir + "secring.gpg"); + osl::File::copy(aSourceDir + "trustdb.gpg", aTargetDir + "trustdb.gpg"); + OUString aTargetPath; osl::FileBase::getSystemPathFromFileURL(aTargetDir, aTargetPath); - setenv("MOZILLA_CERTIFICATE_FOLDER", aTargetPath.toUtf8().getStr(), 1); -#endif -#if HAVE_FEATURE_GPGVERIFY - // Make gpg use our own defined setup below data dir - OUString aHomePath; - osl::FileBase::getSystemPathFromFileURL( - m_directories.getURLFromSrc(DATA_DIRECTORY), - aHomePath); - OUString envVar("GNUPGHOME"); - osl_setEnvironment(envVar.pData, aHomePath.pData); -#endif + + OUString mozCertVar("MOZILLA_CERTIFICATE_FOLDER"); + osl_setEnvironment(mozCertVar.pData, aTargetPath.pData); + OUString gpgHomeVar("GNUPGHOME"); + osl_setEnvironment(gpgHomeVar.pData, aTargetPath.pData); } void SigningTest::tearDown() |