Merged in default sync
authorKrista Bennett <krista@pep-project.org>
Thu, 29 Nov 2018 09:24:21 +0100
branchsync
changeset 3166fe040af3f305
parent 3162 a48667287682
parent 3165 0d3e23fbdaec
child 3167 e7a7a92570b0
Merged in default
test/Makefile
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/clean_sync_leftovers.sh	Thu Nov 29 09:24:21 2018 +0100
     1.3 @@ -0,0 +1,6 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +cd src; hg status . | sed '/?\ /!d' | sed 's/?\ //' | xargs rm
     1.7 +cd ../asn.1; hg status . | sed '/?\ /!d' | sed 's/?\ //' |  xargs rm
     1.8 +cd ../sync; hg status . | sed '/?\ /!d' | sed 's/?\ //' |  xargs rm
     1.9 +cd ..
     2.1 --- a/test/Makefile	Wed Nov 28 15:18:49 2018 +0100
     2.2 +++ b/test/Makefile	Thu Nov 29 09:24:21 2018 +0100
     2.3 @@ -34,6 +34,9 @@
     2.4  
     2.5  ifeq ($(OPENPGP),NETPGP)
     2.6  	LDLIBS+= -lnetpgp
     2.7 +ifeq ($(BUILD_FOR),Linux)
     2.8 +	LDLIBS+= -ltre
     2.9 +endif
    2.10  endif
    2.11  
    2.12  ifdef SQLITE3_FROM_OS
     3.1 --- a/test/include/pEpTestOutput.h	Wed Nov 28 15:18:49 2018 +0100
     3.2 +++ b/test/include/pEpTestOutput.h	Thu Nov 29 09:24:21 2018 +0100
     3.3 @@ -5,6 +5,7 @@
     3.4  #include <cpptest.h>
     3.5  #include <vector>
     3.6  #include <string>
     3.7 +#include <utility>
     3.8  
     3.9  namespace Test {
    3.10      class pEpTestOutput : public Output {
    3.11 @@ -37,7 +38,7 @@
    3.12              std::string _suite_name;
    3.13              std::string _test_name;
    3.14              std::vector<Source> _test_errors;
    3.15 -            
    3.16 +            std::vector<std::pair<std::string,Source>> _all_errors;            
    3.17      };
    3.18  }
    3.19  #endif
    3.20 \ No newline at end of file
     4.1 --- a/test/src/engine_tests/ReencryptPlusExtraKeysTests.cc	Wed Nov 28 15:18:49 2018 +0100
     4.2 +++ b/test/src/engine_tests/ReencryptPlusExtraKeysTests.cc	Thu Nov 29 09:24:21 2018 +0100
     4.3 @@ -109,11 +109,10 @@
     4.4      cout << decrypted_text << endl;
     4.5  
     4.6      cout << "Status is " << tl_status_string(status) << endl;
     4.7 -    TEST_ASSERT_MSG(decrypted_text, "No decrypted test");
     4.8 -    TEST_ASSERT_MSG(rating, "No rating. FIXME: what???");
     4.9 +    TEST_ASSERT_MSG(decrypted_text != NULL, "No decrypted test");
    4.10      TEST_ASSERT_MSG((flags & PEP_decrypt_flag_src_modified) == 0, "Source was modified, but shouldn't have been.");
    4.11      
    4.12 -    TEST_ASSERT_MSG(!modified_src, "Modified source was returned, but should not have been generated");
    4.13 +    TEST_ASSERT_MSG(modified_src == NULL, "Modified source was returned, but should not have been generated");
    4.14      //cout << modified_src << endl;
    4.15      
    4.16      free(decrypted_text);
    4.17 @@ -143,8 +142,7 @@
    4.18      cout << "Status is " << tl_status_string(status) << endl;
    4.19  
    4.20  
    4.21 -    TEST_ASSERT_MSG(decrypted_text, "No decrypted text");
    4.22 -    TEST_ASSERT_MSG(rating, "No rating. FIXME: what???");
    4.23 +    TEST_ASSERT_MSG(decrypted_text != NULL, "No decrypted text");
    4.24      TEST_ASSERT_MSG(modified_src != NULL, "No reeencrypted text!");
    4.25      
    4.26      free(decrypted_text);
    4.27 @@ -228,15 +226,9 @@
    4.28      cout << (decrypted_text ? decrypted_text : "No decrypted text") << endl;
    4.29      cout << "Status is " << tl_status_string(status) << endl;
    4.30  
    4.31 -    cout << "1";
    4.32      TEST_ASSERT_MSG(decrypted_text != NULL, "No decrypted test");
    4.33 -    cout << "2";
    4.34 -    TEST_ASSERT_MSG(rating, "No rating. FIXME: what???");
    4.35 -    cout << "3";
    4.36      TEST_ASSERT_MSG((flags & PEP_decrypt_flag_src_modified) == 0, "Source was modified, but shouldn't have been.");
    4.37 -    cout << "4";    
    4.38 -    TEST_ASSERT_MSG(!modified_src, "Modified source was returned, but should not have been generated");
    4.39 -    cout << "5";
    4.40 +    TEST_ASSERT_MSG(modified_src == NULL, "Modified source was returned, but should not have been generated");
    4.41  
    4.42      free(decrypted_text);
    4.43      decrypted_text = nullptr;
    4.44 @@ -265,7 +257,7 @@
    4.45      cout << "Status is " << tl_status_string(status) << endl;
    4.46  
    4.47      TEST_ASSERT_MSG(decrypted_text != NULL, "No decrypted test");
    4.48 -    TEST_ASSERT_MSG(rating, "No rating. FIXME: what???");
    4.49 +    TEST_ASSERT_MSG(modified_src != NULL, "No reeencrypted text!");
    4.50  
    4.51      free(decrypted_text);
    4.52      decrypted_text = nullptr;
    4.53 @@ -351,10 +343,9 @@
    4.54      cout << decrypted_text << endl;
    4.55      cout << "Status is " << tl_status_string(status) << endl;
    4.56  
    4.57 -    TEST_ASSERT_MSG(decrypted_text, "No decrypted test");
    4.58 -    TEST_ASSERT_MSG(rating, "No rating. FIXME: what???");
    4.59 +    TEST_ASSERT_MSG(decrypted_text != NULL, "No decrypted test");
    4.60      TEST_ASSERT_MSG((flags & PEP_decrypt_flag_src_modified) == 0, "Source was modified, but shouldn't have been.");    
    4.61 -    TEST_ASSERT_MSG(!modified_src, "Modified source was returned, but should not have been generated");
    4.62 +    TEST_ASSERT_MSG(modified_src == NULL, "Modified source was returned, but should not have been generated");
    4.63  
    4.64      free(decrypted_text);
    4.65      decrypted_text = nullptr;
    4.66 @@ -382,8 +373,7 @@
    4.67      cout << decrypted_text << endl;
    4.68      cout << "Status is " << tl_status_string(status) << endl;
    4.69  
    4.70 -    TEST_ASSERT_MSG(decrypted_text, "No decrypted test");
    4.71 -    TEST_ASSERT_MSG(rating, "No rating. FIXME: what???");
    4.72 +    TEST_ASSERT_MSG(decrypted_text != NULL, "No decrypted test");
    4.73  
    4.74      free(decrypted_text);
    4.75      decrypted_text = nullptr;
     5.1 --- a/test/src/pEpTestOutput.cc	Wed Nov 28 15:18:49 2018 +0100
     5.2 +++ b/test/src/pEpTestOutput.cc	Thu Nov 29 09:24:21 2018 +0100
     5.3 @@ -4,6 +4,7 @@
     5.4  #include <vector>
     5.5  #include <string>
     5.6  #include <cstring>
     5.7 +#include <utility>
     5.8  
     5.9  #include "pEpTestOutput.h"
    5.10  using namespace std;
    5.11 @@ -36,6 +37,18 @@
    5.12          int remlen = 56 - finalstr.size();
    5.13          cout << left << setw(finalstr.size()) << finalstr << right << setw(remlen) << "+" << endl;
    5.14          cout << alt_sepline << endl;
    5.15 +        cout << med_sepline;        
    5.16 +        cout << "Error recap:" << endl;
    5.17 +        vector<std::pair<string,Source>>::iterator it;
    5.18 +        for (it = _all_errors.begin(); it != _all_errors.end(); it++) {
    5.19 +            std::pair<string,Source> err = *it;
    5.20 +            cout << lil_sepline;
    5.21 +            cout << left << setw(10) << "Test name: " << err.first << endl;
    5.22 +            Source src = err.second;
    5.23 +            cout << left << setw(25) << "*** Assert location: " << src.file() << ":" << src.line() << endl;
    5.24 +            cout << left << setw(25) << "*** Message: " << src.message() << endl;
    5.25 +        }
    5.26 +        cout << med_sepline << endl << endl;        
    5.27  	}
    5.28  	
    5.29  	void pEpTestOutput::suite_start(int tests, const string& name) {
    5.30 @@ -72,6 +85,7 @@
    5.31      }
    5.32      void pEpTestOutput::test_end(const string& name, bool ok, const Test::Time&) {
    5.33  	    if (!ok) {
    5.34 +            std::pair<string,Source> test_error_set;
    5.35              _suite_failed++;
    5.36              _total_failed++;
    5.37              cout << endl << endl << alt_sepline;
    5.38 @@ -81,7 +95,10 @@
    5.39                  Source src = *it;
    5.40                  cout << lil_sepline;
    5.41                  cout << left << setw(25) << "*** Assert location: " << src.file() << ":" << src.line() << endl;
    5.42 -                cout << left << setw(25) << "*** Message: " << src.message() << endl;                
    5.43 +                cout << left << setw(25) << "*** Message: " << src.message() << endl;
    5.44 +                test_error_set.first = name;
    5.45 +                test_error_set.second = src;
    5.46 +                _all_errors.push_back(test_error_set);                
    5.47              }
    5.48              cout << alt_sepline << endl;
    5.49          }