Fixed pathlength problems for MacOS tests:
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Mon, 14 Jan 2019 13:00:09 +0100
changeset 321779720a7b9c49
parent 3216 f7a5d25e60d5
child 3221 47b815c5ba76
child 3223 eace10725457
Fixed pathlength problems for MacOS tests:
test/include/EngineTestSuite.h
test/include/pEpTestStatic.h
test/src/EngineTestSuite.cc
test/src/SuiteMaker.cc
test/src/TestDriver.cc
test/src/engine_tests/EncryptAttachPrivateKeyTests.cc
test/src/engine_tests/LeastCommonDenomColorTests.cc
test/src/pEpTestStatic.cc
     1.1 --- a/test/include/EngineTestSuite.h	Thu Jan 10 18:57:53 2019 +0100
     1.2 +++ b/test/include/EngineTestSuite.h	Mon Jan 14 13:00:09 2019 +0100
     1.3 @@ -27,7 +27,7 @@
     1.4          string name;
     1.5          
     1.6          string current_test_name;
     1.7 -
     1.8 +        
     1.9  #define TEST_FAILED_MESSAGE_BUFSIZE 1000        
    1.10          char failed_msg_buf[TEST_FAILED_MESSAGE_BUFSIZE];
    1.11          
    1.12 @@ -56,6 +56,5 @@
    1.13          void add_file_to_gpg_dir_queue(std::string copy_from, std::string dst_fname);    
    1.14          void add_file_to_home_dir_queue(std::string copy_from, std::string dst_fname);
    1.15          void process_file_queue(std::string dirname, std::vector<std::pair<std::string, std::string>> file_queue);
    1.16 -
    1.17  };
    1.18  #endif
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/include/pEpTestStatic.h	Mon Jan 14 13:00:09 2019 +0100
     2.3 @@ -0,0 +1,25 @@
     2.4 +// This file is under GNU General Public License 3.0
     2.5 +// see LICENSE.txt
     2.6 +
     2.7 +#ifndef PEP_TEST_STATIC_H
     2.8 +#define PEP_TEST_STATIC_H
     2.9 +
    2.10 +#include <string>
    2.11 +
    2.12 +using namespace std;
    2.13 +
    2.14 +class pEpTestStatic {
    2.15 +    public:
    2.16 +        static size_t getMaxPathSize();
    2.17 +        static size_t sun_path_size;
    2.18 +        static size_t getAvailablePathChars(string keypath_str);
    2.19 +        static size_t available_path_chars;
    2.20 +        static const size_t classname_chars;
    2.21 +        static const size_t testnum_path_chars;
    2.22 +        static const size_t max_test_num;
    2.23 +
    2.24 +    private:
    2.25 +        pEpTestStatic() {};
    2.26 +};
    2.27 +
    2.28 +#endif
     3.1 --- a/test/src/EngineTestSuite.cc	Thu Jan 10 18:57:53 2019 +0100
     3.2 +++ b/test/src/EngineTestSuite.cc	Mon Jan 14 13:00:09 2019 +0100
     3.3 @@ -18,6 +18,8 @@
     3.4  
     3.5  #include "test_util.h"
     3.6  #include "EngineTestSuite.h"
     3.7 +#include "pEpTestStatic.h"
     3.8 +#include <algorithm>
     3.9  
    3.10  using namespace std;
    3.11  
    3.12 @@ -96,11 +98,11 @@
    3.13      
    3.14      set_my_name();
    3.15  
    3.16 +// FIXME
    3.17  #ifndef USE_NETPGP
    3.18      success = system("gpgconf --kill all");
    3.19      if (success != 0)
    3.20          throw std::runtime_error("SETUP: Error when executing 'gpgconf --kill all'.");
    3.21 - //   sleep(1); // hopefully enough time for the system to recognise that it is dead. *sigh*    
    3.22  #endif
    3.23  
    3.24      if (stat(test_home.c_str(), &dirchk) == 0) {
    3.25 @@ -120,6 +122,16 @@
    3.26              throw std::runtime_error("Error creating a test directory.");
    3.27      }
    3.28  
    3.29 +    if (my_name.size() > pEpTestStatic::classname_chars)
    3.30 +        my_name.resize(pEpTestStatic::classname_chars);
    3.31 +
    3.32 +    if (on_test_number > pEpTestStatic::max_test_num) {
    3.33 +        cerr << "Warning - there are at least " << pEpTestStatic::max_test_num << " tests in this suite. While this probably won't cause "
    3.34 +             << endl << "problems, there is an obscure possibility that if your test path is REALLY REALLY LONG, tests will fail because gpg-agent "
    3.35 +             << endl << "won't start with huge paths. In general, however, we stop well before these limits, and pEpTestStatic::testnum_path_chars "
    3.36 +             << endl << "is overly conservative, so you probably don't need to worry." << endl;
    3.37 +    }    
    3.38 +
    3.39      temp_test_home = test_home + "/" + my_name;
    3.40      
    3.41      int errchk = mkdir(temp_test_home.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
    3.42 @@ -132,7 +144,6 @@
    3.43      if (errchk != 0)
    3.44          throw std::runtime_error("Error creating a test directory.");
    3.45  
    3.46 -
    3.47      // TODO: This is *nix specific, which the current testing env is anyway,
    3.48      // but it needn't remain so forever and always
    3.49  
    3.50 @@ -203,6 +214,8 @@
    3.51      
    3.52  //    cout << "calling init()\n";
    3.53      PEP_STATUS status = init(&session);
    3.54 +    system("gpg-connect-agent /bye");   // Just in case - otherwise, we die on MacOS sometimes. Is this enough??
    3.55 +
    3.56      assert(status == PEP_STATUS_OK);
    3.57      assert(session);
    3.58  //    cout << "init() completed.\n";
     4.1 --- a/test/src/SuiteMaker.cc	Thu Jan 10 18:57:53 2019 +0100
     4.2 +++ b/test/src/SuiteMaker.cc	Mon Jan 14 13:00:09 2019 +0100
     4.3 @@ -12,187 +12,187 @@
     4.4  #include "SuiteMaker.h"
     4.5  
     4.6  // Begin where we generate stuff
     4.7 +#include "MimeTests.h"
     4.8 +#include "ExpiredSubkeyTests.h"
     4.9 +#include "UserIdCollisionTests.h"
    4.10 +#include "Engine463Tests.h"
    4.11 +#include "BloblistTests.h"
    4.12 +#include "NewUpdateIdAndMyselfTests.h"
    4.13 +#include "I18nTests.h"
    4.14 +#include "IdentityListTests.h"
    4.15 +#include "PgpBinaryTests.h"
    4.16 +#include "MistrustUndoTests.h"
    4.17 +#include "MessageNullFromTests.h"
    4.18 +#include "LeastCommonDenomColorTests.h"
    4.19 +#include "StringlistTests.h"
    4.20 +#include "PgpListKeysTests.h"
    4.21 +#include "MessageApiTests.h"
    4.22 +#include "EncryptMissingPrivateKeyTests.h"
    4.23 +#include "CaseAndDotAddressTests.h"
    4.24 +#include "UserIDAliasTests.h"
    4.25 +#include "BCCTests.h"
    4.26 +#include "Engine358Tests.h"
    4.27 +#include "BlacklistAcceptNewKeyTests.h"
    4.28 +#include "DecryptAttachPrivateKeyUntrustedTests.h"
    4.29 +#include "BlacklistTests.h"
    4.30 +#include "RevokeRegenAttachTests.h"
    4.31 +#include "PepSubjectReceivedTests.h"
    4.32 +#include "SequenceTests.h"
    4.33 +#include "HeaderKeyImportTests.h"
    4.34 +#include "EncryptAttachPrivateKeyTests.h"
    4.35 +#include "ExternalRevokeTests.h"
    4.36 +#include "KeyeditTests.h"
    4.37 +#include "LeastColorGroupTests.h"
    4.38 +#include "DecryptAttachPrivateKeyTrustedTests.h"
    4.39 +#include "CheckRenewedExpiredKeyTrustStatusTests.h"
    4.40 +#include "TrustwordsTests.h"
    4.41 +#include "ReencryptPlusExtraKeysTests.h"
    4.42 +#include "MapAsn1Tests.h"
    4.43  #include "DecorateTests.h"
    4.44 -#include "UserIdCollisionTests.h"
    4.45 -#include "ReencryptPlusExtraKeysTests.h"
    4.46 -#include "BlacklistTests.h"
    4.47 +#include "MessageTwoPointOhTests.h"
    4.48 +#include "CrashdumpTests.h"
    4.49 +#include "StringpairListTests.h"
    4.50 +#include "EncryptForIdentityTests.h"
    4.51 +#include "TrustManipulationTests.h"
    4.52  #include "AppleMailTests.h"
    4.53 -#include "MessageTwoPointOhTests.h"
    4.54 -#include "IdentityListTests.h"
    4.55 -#include "I18nTests.h"
    4.56 -#include "Engine463Tests.h"
    4.57 -#include "DecryptAttachPrivateKeyUntrustedTests.h"
    4.58 -#include "BCCTests.h"
    4.59 -#include "LeastColorGroupTests.h"
    4.60 -#include "Engine358Tests.h"
    4.61 -#include "MistrustUndoTests.h"
    4.62 -#include "BlacklistAcceptNewKeyTests.h"
    4.63 -#include "MessageApiTests.h"
    4.64 -#include "StringlistTests.h"
    4.65 -#include "HeaderKeyImportTests.h"
    4.66 -#include "StringpairListTests.h"
    4.67 -#include "TrustManipulationTests.h"
    4.68 -#include "EncryptAttachPrivateKeyTests.h"
    4.69 -#include "BloblistTests.h"
    4.70 -#include "SequenceTests.h"
    4.71 -#include "TrustwordsTests.h"
    4.72 -#include "RevokeRegenAttachTests.h"
    4.73 -#include "CheckRenewedExpiredKeyTrustStatusTests.h"
    4.74 -#include "EncryptMissingPrivateKeyTests.h"
    4.75 -#include "PepSubjectReceivedTests.h"
    4.76 -#include "KeyeditTests.h"
    4.77 -#include "MapAsn1Tests.h"
    4.78 -#include "PgpBinaryTests.h"
    4.79 -#include "DecryptAttachPrivateKeyTrustedTests.h"
    4.80 -#include "MessageNullFromTests.h"
    4.81 -#include "MimeTests.h"
    4.82 -#include "PgpListKeysTests.h"
    4.83 -#include "NewUpdateIdAndMyselfTests.h"
    4.84 -#include "EncryptForIdentityTests.h"
    4.85 -#include "CrashdumpTests.h"
    4.86 -#include "CaseAndDotAddressTests.h"
    4.87 -#include "ExpiredSubkeyTests.h"
    4.88 -#include "LeastCommonDenomColorTests.h"
    4.89 -#include "ExternalRevokeTests.h"
    4.90 -#include "UserIDAliasTests.h"
    4.91  
    4.92  
    4.93  const char* SuiteMaker::all_suites[] = {
    4.94 +    "MimeTests",
    4.95 +    "ExpiredSubkeyTests",
    4.96 +    "UserIdCollisionTests",
    4.97 +    "Engine463Tests",
    4.98 +    "BloblistTests",
    4.99 +    "NewUpdateIdAndMyselfTests",
   4.100 +    "I18nTests",
   4.101 +    "IdentityListTests",
   4.102 +    "PgpBinaryTests",
   4.103 +    "MistrustUndoTests",
   4.104 +    "MessageNullFromTests",
   4.105 +    "LeastCommonDenomColorTests",
   4.106 +    "StringlistTests",
   4.107 +    "PgpListKeysTests",
   4.108 +    "MessageApiTests",
   4.109 +    "EncryptMissingPrivateKeyTests",
   4.110 +    "CaseAndDotAddressTests",
   4.111 +    "UserIDAliasTests",
   4.112 +    "BCCTests",
   4.113 +    "Engine358Tests",
   4.114 +    "BlacklistAcceptNewKeyTests",
   4.115 +    "DecryptAttachPrivateKeyUntrustedTests",
   4.116 +    "BlacklistTests",
   4.117 +    "RevokeRegenAttachTests",
   4.118 +    "PepSubjectReceivedTests",
   4.119 +    "SequenceTests",
   4.120 +    "HeaderKeyImportTests",
   4.121 +    "EncryptAttachPrivateKeyTests",
   4.122 +    "ExternalRevokeTests",
   4.123 +    "KeyeditTests",
   4.124 +    "LeastColorGroupTests",
   4.125 +    "DecryptAttachPrivateKeyTrustedTests",
   4.126 +    "CheckRenewedExpiredKeyTrustStatusTests",
   4.127 +    "TrustwordsTests",
   4.128 +    "ReencryptPlusExtraKeysTests",
   4.129 +    "MapAsn1Tests",
   4.130      "DecorateTests",
   4.131 -    "UserIdCollisionTests",
   4.132 -    "ReencryptPlusExtraKeysTests",
   4.133 -    "BlacklistTests",
   4.134 +    "MessageTwoPointOhTests",
   4.135 +    "CrashdumpTests",
   4.136 +    "StringpairListTests",
   4.137 +    "EncryptForIdentityTests",
   4.138 +    "TrustManipulationTests",
   4.139      "AppleMailTests",
   4.140 -    "MessageTwoPointOhTests",
   4.141 -    "IdentityListTests",
   4.142 -    "I18nTests",
   4.143 -    "Engine463Tests",
   4.144 -    "DecryptAttachPrivateKeyUntrustedTests",
   4.145 -    "BCCTests",
   4.146 -    "LeastColorGroupTests",
   4.147 -    "Engine358Tests",
   4.148 -    "MistrustUndoTests",
   4.149 -    "BlacklistAcceptNewKeyTests",
   4.150 -    "MessageApiTests",
   4.151 -    "StringlistTests",
   4.152 -    "HeaderKeyImportTests",
   4.153 -    "StringpairListTests",
   4.154 -    "TrustManipulationTests",
   4.155 -    "EncryptAttachPrivateKeyTests",
   4.156 -    "BloblistTests",
   4.157 -    "SequenceTests",
   4.158 -    "TrustwordsTests",
   4.159 -    "RevokeRegenAttachTests",
   4.160 -    "CheckRenewedExpiredKeyTrustStatusTests",
   4.161 -    "EncryptMissingPrivateKeyTests",
   4.162 -    "PepSubjectReceivedTests",
   4.163 -    "KeyeditTests",
   4.164 -    "MapAsn1Tests",
   4.165 -    "PgpBinaryTests",
   4.166 -    "DecryptAttachPrivateKeyTrustedTests",
   4.167 -    "MessageNullFromTests",
   4.168 -    "MimeTests",
   4.169 -    "PgpListKeysTests",
   4.170 -    "NewUpdateIdAndMyselfTests",
   4.171 -    "EncryptForIdentityTests",
   4.172 -    "CrashdumpTests",
   4.173 -    "CaseAndDotAddressTests",
   4.174 -    "ExpiredSubkeyTests",
   4.175 -    "LeastCommonDenomColorTests",
   4.176 -    "ExternalRevokeTests",
   4.177 -    "UserIDAliasTests",
   4.178  };
   4.179  
   4.180  // This file is generated, so magic constants are ok.
   4.181  int SuiteMaker::num_suites = 43;
   4.182  
   4.183  void SuiteMaker::suitemaker_build(const char* test_class_name, const char* test_home, Test::Suite** test_suite) {
   4.184 -    if (strcmp(test_class_name, "DecorateTests") == 0)
   4.185 -        *test_suite = new DecorateTests(test_class_name, test_home);
   4.186 +    if (strcmp(test_class_name, "MimeTests") == 0)
   4.187 +        *test_suite = new MimeTests(test_class_name, test_home);
   4.188 +    else if (strcmp(test_class_name, "ExpiredSubkeyTests") == 0)
   4.189 +        *test_suite = new ExpiredSubkeyTests(test_class_name, test_home);
   4.190      else if (strcmp(test_class_name, "UserIdCollisionTests") == 0)
   4.191          *test_suite = new UserIdCollisionTests(test_class_name, test_home);
   4.192 +    else if (strcmp(test_class_name, "Engine463Tests") == 0)
   4.193 +        *test_suite = new Engine463Tests(test_class_name, test_home);
   4.194 +    else if (strcmp(test_class_name, "BloblistTests") == 0)
   4.195 +        *test_suite = new BloblistTests(test_class_name, test_home);
   4.196 +    else if (strcmp(test_class_name, "NewUpdateIdAndMyselfTests") == 0)
   4.197 +        *test_suite = new NewUpdateIdAndMyselfTests(test_class_name, test_home);
   4.198 +    else if (strcmp(test_class_name, "I18nTests") == 0)
   4.199 +        *test_suite = new I18nTests(test_class_name, test_home);
   4.200 +    else if (strcmp(test_class_name, "IdentityListTests") == 0)
   4.201 +        *test_suite = new IdentityListTests(test_class_name, test_home);
   4.202 +    else if (strcmp(test_class_name, "PgpBinaryTests") == 0)
   4.203 +        *test_suite = new PgpBinaryTests(test_class_name, test_home);
   4.204 +    else if (strcmp(test_class_name, "MistrustUndoTests") == 0)
   4.205 +        *test_suite = new MistrustUndoTests(test_class_name, test_home);
   4.206 +    else if (strcmp(test_class_name, "MessageNullFromTests") == 0)
   4.207 +        *test_suite = new MessageNullFromTests(test_class_name, test_home);
   4.208 +    else if (strcmp(test_class_name, "LeastCommonDenomColorTests") == 0)
   4.209 +        *test_suite = new LeastCommonDenomColorTests(test_class_name, test_home);
   4.210 +    else if (strcmp(test_class_name, "StringlistTests") == 0)
   4.211 +        *test_suite = new StringlistTests(test_class_name, test_home);
   4.212 +    else if (strcmp(test_class_name, "PgpListKeysTests") == 0)
   4.213 +        *test_suite = new PgpListKeysTests(test_class_name, test_home);
   4.214 +    else if (strcmp(test_class_name, "MessageApiTests") == 0)
   4.215 +        *test_suite = new MessageApiTests(test_class_name, test_home);
   4.216 +    else if (strcmp(test_class_name, "EncryptMissingPrivateKeyTests") == 0)
   4.217 +        *test_suite = new EncryptMissingPrivateKeyTests(test_class_name, test_home);
   4.218 +    else if (strcmp(test_class_name, "CaseAndDotAddressTests") == 0)
   4.219 +        *test_suite = new CaseAndDotAddressTests(test_class_name, test_home);
   4.220 +    else if (strcmp(test_class_name, "UserIDAliasTests") == 0)
   4.221 +        *test_suite = new UserIDAliasTests(test_class_name, test_home);
   4.222 +    else if (strcmp(test_class_name, "BCCTests") == 0)
   4.223 +        *test_suite = new BCCTests(test_class_name, test_home);
   4.224 +    else if (strcmp(test_class_name, "Engine358Tests") == 0)
   4.225 +        *test_suite = new Engine358Tests(test_class_name, test_home);
   4.226 +    else if (strcmp(test_class_name, "BlacklistAcceptNewKeyTests") == 0)
   4.227 +        *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
   4.228 +    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
   4.229 +        *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
   4.230 +    else if (strcmp(test_class_name, "BlacklistTests") == 0)
   4.231 +        *test_suite = new BlacklistTests(test_class_name, test_home);
   4.232 +    else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)
   4.233 +        *test_suite = new RevokeRegenAttachTests(test_class_name, test_home);
   4.234 +    else if (strcmp(test_class_name, "PepSubjectReceivedTests") == 0)
   4.235 +        *test_suite = new PepSubjectReceivedTests(test_class_name, test_home);
   4.236 +    else if (strcmp(test_class_name, "SequenceTests") == 0)
   4.237 +        *test_suite = new SequenceTests(test_class_name, test_home);
   4.238 +    else if (strcmp(test_class_name, "HeaderKeyImportTests") == 0)
   4.239 +        *test_suite = new HeaderKeyImportTests(test_class_name, test_home);
   4.240 +    else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
   4.241 +        *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
   4.242 +    else if (strcmp(test_class_name, "ExternalRevokeTests") == 0)
   4.243 +        *test_suite = new ExternalRevokeTests(test_class_name, test_home);
   4.244 +    else if (strcmp(test_class_name, "KeyeditTests") == 0)
   4.245 +        *test_suite = new KeyeditTests(test_class_name, test_home);
   4.246 +    else if (strcmp(test_class_name, "LeastColorGroupTests") == 0)
   4.247 +        *test_suite = new LeastColorGroupTests(test_class_name, test_home);
   4.248 +    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyTrustedTests") == 0)
   4.249 +        *test_suite = new DecryptAttachPrivateKeyTrustedTests(test_class_name, test_home);
   4.250 +    else if (strcmp(test_class_name, "CheckRenewedExpiredKeyTrustStatusTests") == 0)
   4.251 +        *test_suite = new CheckRenewedExpiredKeyTrustStatusTests(test_class_name, test_home);
   4.252 +    else if (strcmp(test_class_name, "TrustwordsTests") == 0)
   4.253 +        *test_suite = new TrustwordsTests(test_class_name, test_home);
   4.254      else if (strcmp(test_class_name, "ReencryptPlusExtraKeysTests") == 0)
   4.255          *test_suite = new ReencryptPlusExtraKeysTests(test_class_name, test_home);
   4.256 -    else if (strcmp(test_class_name, "BlacklistTests") == 0)
   4.257 -        *test_suite = new BlacklistTests(test_class_name, test_home);
   4.258 +    else if (strcmp(test_class_name, "MapAsn1Tests") == 0)
   4.259 +        *test_suite = new MapAsn1Tests(test_class_name, test_home);
   4.260 +    else if (strcmp(test_class_name, "DecorateTests") == 0)
   4.261 +        *test_suite = new DecorateTests(test_class_name, test_home);
   4.262 +    else if (strcmp(test_class_name, "MessageTwoPointOhTests") == 0)
   4.263 +        *test_suite = new MessageTwoPointOhTests(test_class_name, test_home);
   4.264 +    else if (strcmp(test_class_name, "CrashdumpTests") == 0)
   4.265 +        *test_suite = new CrashdumpTests(test_class_name, test_home);
   4.266 +    else if (strcmp(test_class_name, "StringpairListTests") == 0)
   4.267 +        *test_suite = new StringpairListTests(test_class_name, test_home);
   4.268 +    else if (strcmp(test_class_name, "EncryptForIdentityTests") == 0)
   4.269 +        *test_suite = new EncryptForIdentityTests(test_class_name, test_home);
   4.270 +    else if (strcmp(test_class_name, "TrustManipulationTests") == 0)
   4.271 +        *test_suite = new TrustManipulationTests(test_class_name, test_home);
   4.272      else if (strcmp(test_class_name, "AppleMailTests") == 0)
   4.273          *test_suite = new AppleMailTests(test_class_name, test_home);
   4.274 -    else if (strcmp(test_class_name, "MessageTwoPointOhTests") == 0)
   4.275 -        *test_suite = new MessageTwoPointOhTests(test_class_name, test_home);
   4.276 -    else if (strcmp(test_class_name, "IdentityListTests") == 0)
   4.277 -        *test_suite = new IdentityListTests(test_class_name, test_home);
   4.278 -    else if (strcmp(test_class_name, "I18nTests") == 0)
   4.279 -        *test_suite = new I18nTests(test_class_name, test_home);
   4.280 -    else if (strcmp(test_class_name, "Engine463Tests") == 0)
   4.281 -        *test_suite = new Engine463Tests(test_class_name, test_home);
   4.282 -    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
   4.283 -        *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
   4.284 -    else if (strcmp(test_class_name, "BCCTests") == 0)
   4.285 -        *test_suite = new BCCTests(test_class_name, test_home);
   4.286 -    else if (strcmp(test_class_name, "LeastColorGroupTests") == 0)
   4.287 -        *test_suite = new LeastColorGroupTests(test_class_name, test_home);
   4.288 -    else if (strcmp(test_class_name, "Engine358Tests") == 0)
   4.289 -        *test_suite = new Engine358Tests(test_class_name, test_home);
   4.290 -    else if (strcmp(test_class_name, "MistrustUndoTests") == 0)
   4.291 -        *test_suite = new MistrustUndoTests(test_class_name, test_home);
   4.292 -    else if (strcmp(test_class_name, "BlacklistAcceptNewKeyTests") == 0)
   4.293 -        *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
   4.294 -    else if (strcmp(test_class_name, "MessageApiTests") == 0)
   4.295 -        *test_suite = new MessageApiTests(test_class_name, test_home);
   4.296 -    else if (strcmp(test_class_name, "StringlistTests") == 0)
   4.297 -        *test_suite = new StringlistTests(test_class_name, test_home);
   4.298 -    else if (strcmp(test_class_name, "HeaderKeyImportTests") == 0)
   4.299 -        *test_suite = new HeaderKeyImportTests(test_class_name, test_home);
   4.300 -    else if (strcmp(test_class_name, "StringpairListTests") == 0)
   4.301 -        *test_suite = new StringpairListTests(test_class_name, test_home);
   4.302 -    else if (strcmp(test_class_name, "TrustManipulationTests") == 0)
   4.303 -        *test_suite = new TrustManipulationTests(test_class_name, test_home);
   4.304 -    else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
   4.305 -        *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
   4.306 -    else if (strcmp(test_class_name, "BloblistTests") == 0)
   4.307 -        *test_suite = new BloblistTests(test_class_name, test_home);
   4.308 -    else if (strcmp(test_class_name, "SequenceTests") == 0)
   4.309 -        *test_suite = new SequenceTests(test_class_name, test_home);
   4.310 -    else if (strcmp(test_class_name, "TrustwordsTests") == 0)
   4.311 -        *test_suite = new TrustwordsTests(test_class_name, test_home);
   4.312 -    else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)
   4.313 -        *test_suite = new RevokeRegenAttachTests(test_class_name, test_home);
   4.314 -    else if (strcmp(test_class_name, "CheckRenewedExpiredKeyTrustStatusTests") == 0)
   4.315 -        *test_suite = new CheckRenewedExpiredKeyTrustStatusTests(test_class_name, test_home);
   4.316 -    else if (strcmp(test_class_name, "EncryptMissingPrivateKeyTests") == 0)
   4.317 -        *test_suite = new EncryptMissingPrivateKeyTests(test_class_name, test_home);
   4.318 -    else if (strcmp(test_class_name, "PepSubjectReceivedTests") == 0)
   4.319 -        *test_suite = new PepSubjectReceivedTests(test_class_name, test_home);
   4.320 -    else if (strcmp(test_class_name, "KeyeditTests") == 0)
   4.321 -        *test_suite = new KeyeditTests(test_class_name, test_home);
   4.322 -    else if (strcmp(test_class_name, "MapAsn1Tests") == 0)
   4.323 -        *test_suite = new MapAsn1Tests(test_class_name, test_home);
   4.324 -    else if (strcmp(test_class_name, "PgpBinaryTests") == 0)
   4.325 -        *test_suite = new PgpBinaryTests(test_class_name, test_home);
   4.326 -    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyTrustedTests") == 0)
   4.327 -        *test_suite = new DecryptAttachPrivateKeyTrustedTests(test_class_name, test_home);
   4.328 -    else if (strcmp(test_class_name, "MessageNullFromTests") == 0)
   4.329 -        *test_suite = new MessageNullFromTests(test_class_name, test_home);
   4.330 -    else if (strcmp(test_class_name, "MimeTests") == 0)
   4.331 -        *test_suite = new MimeTests(test_class_name, test_home);
   4.332 -    else if (strcmp(test_class_name, "PgpListKeysTests") == 0)
   4.333 -        *test_suite = new PgpListKeysTests(test_class_name, test_home);
   4.334 -    else if (strcmp(test_class_name, "NewUpdateIdAndMyselfTests") == 0)
   4.335 -        *test_suite = new NewUpdateIdAndMyselfTests(test_class_name, test_home);
   4.336 -    else if (strcmp(test_class_name, "EncryptForIdentityTests") == 0)
   4.337 -        *test_suite = new EncryptForIdentityTests(test_class_name, test_home);
   4.338 -    else if (strcmp(test_class_name, "CrashdumpTests") == 0)
   4.339 -        *test_suite = new CrashdumpTests(test_class_name, test_home);
   4.340 -    else if (strcmp(test_class_name, "CaseAndDotAddressTests") == 0)
   4.341 -        *test_suite = new CaseAndDotAddressTests(test_class_name, test_home);
   4.342 -    else if (strcmp(test_class_name, "ExpiredSubkeyTests") == 0)
   4.343 -        *test_suite = new ExpiredSubkeyTests(test_class_name, test_home);
   4.344 -    else if (strcmp(test_class_name, "LeastCommonDenomColorTests") == 0)
   4.345 -        *test_suite = new LeastCommonDenomColorTests(test_class_name, test_home);
   4.346 -    else if (strcmp(test_class_name, "ExternalRevokeTests") == 0)
   4.347 -        *test_suite = new ExternalRevokeTests(test_class_name, test_home);
   4.348 -    else if (strcmp(test_class_name, "UserIDAliasTests") == 0)
   4.349 -        *test_suite = new UserIDAliasTests(test_class_name, test_home);
   4.350  }
   4.351  
   4.352  void SuiteMaker::suitemaker_buildlist(const char** test_class_names, int num_to_run, const char* test_home, std::vector<Test::Suite*>& test_suites) {
     5.1 --- a/test/src/TestDriver.cc	Thu Jan 10 18:57:53 2019 +0100
     5.2 +++ b/test/src/TestDriver.cc	Mon Jan 14 13:00:09 2019 +0100
     5.3 @@ -15,6 +15,7 @@
     5.4  #include "EngineTestIndividualSuite.h"
     5.5  #include "EngineTestSessionSuite.h"
     5.6  #include "SuiteMaker.h"
     5.7 +#include "pEpTestStatic.h"
     5.8  
     5.9  using namespace std;
    5.10  
    5.11 @@ -38,7 +39,21 @@
    5.12          throw std::runtime_error("Error grabbing current working directory"); 
    5.13  
    5.14      common_test_home = curr_wd + "/pEp_test_home";    
    5.15 +
    5.16 +    // Note: THIS IS BRITTLE. If you're trying on a new platform and it fails, it's because C++ names may be mangled differently
    5.17 +    // and other platforms may have other requirements. Start by checking maximum socket path lengths...
    5.18 +    // We need at least size for 3 chars of unique class dir, 3 chars of test number, 5 chars for "gnupg", for "S.gpg-agent", plus
    5.19 +    // slashes. This is really just because gpg-agent fails on MacOS because of a shorter sun_path max.
    5.20      
    5.21 +    // fixme = "gnupg" needs to be made central
    5.22 +    string keypath_str = "gnupg";
    5.23 +
    5.24 +    if (common_test_home.size() > pEpTestStatic::getAvailablePathChars(keypath_str)) {
    5.25 +        cerr << "Test home path size too long. Please notify the devs that this finally broke." 
    5.26 +             << " In the meantime, try modifying common_test_home here in TestDriver.cc and hope nothing breaks" << endl;
    5.27 +        throw -127;
    5.28 +    }     
    5.29 +
    5.30      EngineTestSuite* test_runner = new EngineTestSuite("MainTestDriver", common_test_home);
    5.31  
    5.32      std::vector<Test::Suite*> suites_to_run;
     6.1 --- a/test/src/engine_tests/EncryptAttachPrivateKeyTests.cc	Thu Jan 10 18:57:53 2019 +0100
     6.2 +++ b/test/src/engine_tests/EncryptAttachPrivateKeyTests.cc	Mon Jan 14 13:00:09 2019 +0100
     6.3 @@ -56,42 +56,42 @@
     6.4      // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
     6.5      input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
     6.6      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
     6.7 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
     6.8 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
     6.9  
    6.10      input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc");
    6.11      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    6.12 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.13 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.14          
    6.15      // key with same address and user_id (initially untrusted, then trusted)
    6.16      // 359DD8AC87D1F5E4304D08338D7185F180C8CD87
    6.17      input_key = slurp("test_keys/pub/priv-key-import-test-main_1-0x80C8CD87_pub.asc");
    6.18      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    6.19 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.20 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.21  
    6.22      // key with same address and to have different (non-aliased) user_id (initially untrusted, then trusted)
    6.23      // B044B83639E292283A3F6E14C2E64B520B74809C
    6.24      input_key = slurp("test_keys/pub/priv-key-import-test-main_2-0x0B74809C_pub.asc");
    6.25      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    6.26 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.27 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.28  
    6.29      // key with different address to have same user_id (initially untrusted, then trusted)
    6.30      // C52911EBA0D34B0F549594A15A7A363BD11252C9
    6.31      input_key = slurp("test_keys/pub/priv-key-import-test-other_0-0xD11252C9_pub.asc");
    6.32      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    6.33 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.34 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.35          
    6.36      // key with different address to have different user_id (initially untrusted, then trusted)
    6.37      // 567212EFB8A3A76B1D32B9565F45BEA9C785F20A
    6.38      input_key = slurp("test_keys/pub/priv-key-import-test-other_1-0xC785F20A_pub.asc");
    6.39      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    6.40 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.41 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.42      cout << "Done!" << endl << endl;
    6.43      
    6.44      cout << "Setting up own identity with default key " << fpr_main_me << endl;
    6.45      // Own identity with default key etc
    6.46      main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
    6.47      status = set_own_key(session, main_me, fpr_main_me);
    6.48 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.49 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.50  
    6.51      TEST_ASSERT_MSG((strcmp(main_me->fpr, fpr_main_me) == 0), "strcmp(main_me->fpr, fpr_main_me) == 0");
    6.52      cout << "Done!" << endl << endl;
    6.53 @@ -163,7 +163,7 @@
    6.54      cout << "Case 2: Same address, same user_id, trusted" << endl;
    6.55      status = trust_personal_key(session, same_addr_same_uid);
    6.56      cout << "Trust personal key for " << same_addr_same_uid << " gives status " << tl_status_string(status) << " (" << status << ")" << endl;
    6.57 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.58 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.59      message* enc_same_addr_same_uid_trusted = NULL;
    6.60      status = encrypt_message_and_add_priv_key(session,
    6.61                                                msg_same_addr_same_uid,
    6.62 @@ -173,7 +173,7 @@
    6.63                                                0);
    6.64  
    6.65      cout << "Case 2 Status: " << tl_status_string(status) << endl;
    6.66 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.67 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.68      cout << "PASS!" << endl;
    6.69  
    6.70      // Case 3:
    6.71 @@ -198,7 +198,7 @@
    6.72      // Different address, same user_id, trusted
    6.73      cout << "Case 4: Different address, same user_id, trusted" << endl;
    6.74      status = trust_personal_key(session, diff_addr_same_uid);
    6.75 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.76 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.77      message* enc_diff_addr_same_uid_trusted = NULL;
    6.78      status = encrypt_message_and_add_priv_key(session,
    6.79                                                msg_diff_addr_same_uid,
    6.80 @@ -233,7 +233,7 @@
    6.81      // Same address, different user_id, trusted
    6.82      cout << "Case 6: Same address, different user_id, trusted" << endl;        
    6.83      status = trust_personal_key(session, same_addr_diff_uid);
    6.84 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.85 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.86      message* enc_same_addr_diff_uid_trusted = NULL;
    6.87      status = encrypt_message_and_add_priv_key(session,
    6.88                                                msg_same_addr_diff_uid,
    6.89 @@ -268,7 +268,7 @@
    6.90      // Different address, different user_id, trusted
    6.91      cout << "Case 8: Different address, different user_id, trusted" << endl;    
    6.92      status = trust_personal_key(session, diff_addr_diff_uid);
    6.93 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    6.94 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    6.95      message* enc_diff_addr_diff_uid_trusted = NULL;
    6.96      status = encrypt_message_and_add_priv_key(session,
    6.97                                                msg_diff_addr_diff_uid,
     7.1 --- a/test/src/engine_tests/LeastCommonDenomColorTests.cc	Thu Jan 10 18:57:53 2019 +0100
     7.2 +++ b/test/src/engine_tests/LeastCommonDenomColorTests.cc	Mon Jan 14 13:00:09 2019 +0100
     7.3 @@ -68,12 +68,12 @@
     7.4      PEP_decrypt_flags_t flags;
     7.5      
     7.6      status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
     7.7 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
     7.8 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
     7.9      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
    7.10  
    7.11      flags = 0;
    7.12      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
    7.13 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.14 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    7.15      TEST_ASSERT_MSG((dest_msg), "dest_msg");
    7.16      /* message is signed and no recip is mistrusted... */
    7.17      TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_yellow), "color_from_rating(rating) == PEP_color_yellow");
    7.18 @@ -86,12 +86,12 @@
    7.19      
    7.20      /* re-evaluate rating, counting on optional fields */
    7.21      status = re_evaluate_message_rating(session, dest_msg, NULL, PEP_rating_undefined, &rating);
    7.22 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.23 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    7.24      TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_yellow), "color_from_rating(rating) == PEP_color_yellow");
    7.25  
    7.26      /* re-evaluate rating, without optional fields */
    7.27      status = re_evaluate_message_rating(session, dest_msg, keylist, decrypt_rating, &rating);
    7.28 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.29 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    7.30      TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_yellow), "color_from_rating(rating) == PEP_color_yellow");
    7.31  
    7.32      /* Ok, now mistrust one recip */
    7.33 @@ -99,12 +99,12 @@
    7.34  
    7.35      /* re-evaluate rating, counting on optional fields */
    7.36      status = re_evaluate_message_rating(session, dest_msg, NULL, PEP_rating_undefined, &rating);
    7.37 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.38 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    7.39      TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_red), "color_from_rating(rating) == PEP_color_red");
    7.40  
    7.41      /* re-evaluate rating, without optional fields */
    7.42      status = re_evaluate_message_rating(session, dest_msg, keylist, decrypt_rating, &rating);
    7.43 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.44 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    7.45      TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_red), "color_from_rating(rating) == PEP_color_red");
    7.46  
    7.47      free_message(dest_msg);
    7.48 @@ -117,7 +117,7 @@
    7.49      rating = PEP_rating_unreliable;
    7.50  
    7.51      status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
    7.52 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.53 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    7.54      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
    7.55      flags = 0;
    7.56      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
    7.57 @@ -137,4 +137,6 @@
    7.58      dest_msg = nullptr;
    7.59      keylist = nullptr;
    7.60      rating = PEP_rating_unreliable;
    7.61 +
    7.62 +    TEST_ASSERT(true);
    7.63  }
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/src/pEpTestStatic.cc	Mon Jan 14 13:00:09 2019 +0100
     8.3 @@ -0,0 +1,30 @@
     8.4 +#include <stdlib.h>
     8.5 +#include <sys/un.h>
     8.6 +
     8.7 +#include "pEpTestStatic.h"
     8.8 +#include <math.h>
     8.9 +#include <string>
    8.10 +
    8.11 +using namespace std;
    8.12 +
    8.13 +size_t pEpTestStatic::sun_path_size = 0;
    8.14 +size_t pEpTestStatic::available_path_chars = 0;
    8.15 +
    8.16 +const size_t pEpTestStatic::classname_chars = 6;
    8.17 +const size_t pEpTestStatic::testnum_path_chars = 4;
    8.18 +const size_t pEpTestStatic::max_test_num = pow(10, pEpTestStatic::testnum_path_chars) - 1;
    8.19 +
    8.20 +size_t pEpTestStatic::getMaxPathSize() {
    8.21 +    if (pEpTestStatic::sun_path_size == 0) {
    8.22 +        struct sockaddr_un s;
    8.23 +        pEpTestStatic::sun_path_size = sizeof(s.sun_path);
    8.24 +    }
    8.25 +    return pEpTestStatic::sun_path_size;
    8.26 +}
    8.27 +
    8.28 +size_t pEpTestStatic::getAvailablePathChars(string keypath_str) {
    8.29 +    if (pEpTestStatic::available_path_chars == 0) {
    8.30 +        available_path_chars = pEpTestStatic::getMaxPathSize() - classname_chars - testnum_path_chars - keypath_str.size() - 4; // slashes
    8.31 +    }
    8.32 +    return pEpTestStatic::available_path_chars;
    8.33 +}