fixed some of the dir setup issues. Will cleanup - first test suite runs, so should be smooth sailing from here afterwards. local_cpptest
authorKrista Bennett <krista@pep-project.org>
Wed, 02 May 2018 10:06:34 +0200
branchlocal_cpptest
changeset 26401bf5b0421bd8
parent 2639 60be0da624a6
child 2641 f249c4bcc819
fixed some of the dir setup issues. Will cleanup - first test suite runs, so should be smooth sailing from here afterwards.
test/src/EngineTestSuite.cc
     1.1 --- a/test/src/EngineTestSuite.cc	Tue May 01 14:40:18 2018 +0200
     1.2 +++ b/test/src/EngineTestSuite.cc	Wed May 02 10:06:34 2018 +0200
     1.3 @@ -15,6 +15,13 @@
     1.4      char* tmp = getenv("GNUPGHOME");
     1.5      if (tmp)
     1.6          prev_gpg_home = getenv("GNUPGHOME");
     1.7 +    
     1.8 +    struct stat buf;
     1.9 +    
    1.10 +    if (stat(test_home.c_str(), &buf) == 0) {
    1.11 +        cout << test_home << " exists. We'll recursively delete. We hope we're not horking your whole system..." << endl;
    1.12 +        int success = nftw((test_home + "/.").c_str(), util_delete_filepath, 100, FTW_DEPTH);
    1.13 +    }
    1.14  }
    1.15  
    1.16  void EngineTestSuite::set_full_env() {
    1.17 @@ -36,12 +43,6 @@
    1.18      cout << "Ok - checked if new test home will be safe. We'll try and make the directory, deleting it if it has already exists." << endl;
    1.19      
    1.20      struct stat buf;
    1.21 -    if (stat(test_home.c_str(), &buf) == 0) {
    1.22 -        cout << test_home << " exists. We'll recursively delete. We hope we're not horking your whole system..." << endl;
    1.23 -        success = nftw((test_home + "/.").c_str(), util_delete_filepath, 100, FTW_DEPTH);
    1.24 -        if (success != 0)
    1.25 -            throw std::runtime_error("SETUP: can't delete the whole directory.");
    1.26 -    }
    1.27      
    1.28      success = setenv("GNUPGHOME", (test_home + "/.gnupg").c_str(), 1);
    1.29      if (success != 0)