Merged in 427 fixes ENGINE-451
authorKrista Bennett <krista@pep-project.org>
Tue, 14 Aug 2018 10:01:15 +0200
branchENGINE-451
changeset 282434863e77a260
parent 2822 a33bdd73952a
parent 2823 f56e57460c61
child 2825 aa81abad2215
Merged in 427 fixes
test/include/EngineTestSuite.h
test/src/EngineTestSuite.cc
     1.1 --- a/test/src/EngineTestSuite.cc	Tue Aug 14 09:05:36 2018 +0200
     1.2 +++ b/test/src/EngineTestSuite.cc	Tue Aug 14 10:01:15 2018 +0200
     1.3 @@ -10,6 +10,10 @@
     1.4  #include <sys/types.h>
     1.5  #include <sys/stat.h>
     1.6  
     1.7 +#import <string>
     1.8 +#import <vector>
     1.9 +#include <utility>
    1.10 +
    1.11  #include "platform_unix.h"
    1.12  
    1.13  #include "test_util.h"
    1.14 @@ -60,6 +64,27 @@
    1.15      dst.close();
    1.16  }
    1.17  
    1.18 +void EngineTestSuite::add_file_to_gpg_dir_queue(string copy_from, string dst_fname) {    
    1.19 +    gpgdir_fileadd_queue.push_back(make_pair(copy_from, dst_fname));
    1.20 +}
    1.21 +
    1.22 +void EngineTestSuite::add_file_to_home_dir_queue(string copy_from, string dst_fname) {
    1.23 +    homedir_fileadd_queue.push_back(make_pair(copy_from, dst_fname));
    1.24 +}
    1.25 +
    1.26 +void EngineTestSuite::process_file_queue(string dirname, vector<pair<string, string>> file_queue) {
    1.27 +    if (file_queue.empty())
    1.28 +        return;
    1.29 +        
    1.30 +    vector<pair<string, string>>::iterator it;
    1.31 +    
    1.32 +    for (it = file_queue.begin(); it != file_queue.end(); it++) {
    1.33 +        copy_conf_file_to_test_dir(dirname.c_str(), it->first.c_str(), it->second.c_str());
    1.34 +    }
    1.35 +    
    1.36 +    file_queue.clear();
    1.37 +}
    1.38 +
    1.39  void EngineTestSuite::set_full_env() {
    1.40      set_full_env(NULL, NULL, NULL);
    1.41  }
    1.42 @@ -151,6 +176,11 @@
    1.43      if (success != 0)
    1.44          throw std::runtime_error("SETUP: Cannot set test_home for init.");
    1.45  
    1.46 +    string tmp_gpg_dir = temp_test_home + "/.gnupg";
    1.47 +
    1.48 +    process_file_queue(tmp_gpg_dir, gpgdir_fileadd_queue);
    1.49 +    process_file_queue(temp_test_home, homedir_fileadd_queue);
    1.50 +
    1.51      if (gpg_conf_copy_path)
    1.52          copy_conf_file_to_test_dir((temp_test_home + "/gnupg").c_str(), gpg_conf_copy_path, "gpg.conf");
    1.53      if (gpg_agent_conf_file_copy_path)