Merged the one-too-many READMEs
authorKrista Bennett <krista@pep-project.org>
Fri, 11 May 2018 09:06:29 +0200
changeset 2676074bceee15b7
parent 2673 7e09a0b166c9
child 2677 a1ade141a1d1
child 2681 52835b311e85
Merged the one-too-many READMEs
test/README
test/README.txt
test/lars_test_do_not_run_outside_of_test_environment.cc
     1.1 --- a/test/README	Fri May 11 09:01:10 2018 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,6 +0,0 @@
     1.4 -DOCUMENTATION AND CLEANUP FORTHCOMING.
     1.5 -
     1.6 -Engine tests now require libcpptest - if you have compilation failures using your distribution's lib (I'm looking at you, Ubuntu), please download the source at http://cpptest.sourceforge.net/, compile, and run.
     1.7 -
     1.8 -New test creation requires python 3.x.
     1.9 -
     2.1 --- a/test/README.txt	Fri May 11 09:01:10 2018 +0200
     2.2 +++ b/test/README.txt	Fri May 11 09:06:29 2018 +0200
     2.3 @@ -1,3 +1,9 @@
     2.4 +DOCUMENTATION AND CLEANUP FORTHCOMING.
     2.5 +
     2.6 +Engine tests now require libcpptest - if you have compilation failures using your distribution's lib (I'm looking at you, Ubuntu), please download the source at http://cpptest.sourceforge.net/, compile, and run.
     2.7 +
     2.8 +New test creation requires python 3.x.
     2.9 +
    2.10  Notes:
    2.11  
    2.12  - TEST_ASSERT is a macro and does not always behave 100% the way you'd expect. Note the following:
     3.1 --- a/test/lars_test_do_not_run_outside_of_test_environment.cc	Fri May 11 09:01:10 2018 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,171 +0,0 @@
     3.4 -// This file is under GNU General Public License 3.0
     3.5 -// see LICENSE.txt
     3.6 -
     3.7 -#include <stdlib.h>
     3.8 -#include <string.h>
     3.9 -#include "platform.h"
    3.10 -#include <iostream>
    3.11 -#include <fstream>
    3.12 -#include <assert.h>
    3.13 -#include "mime.h"
    3.14 -#include "message_api.h"
    3.15 -
    3.16 -using namespace std;
    3.17 -
    3.18 -void test_MIME_decrypt_message()
    3.19 -{
    3.20 -	static const std::string private_key =
    3.21 -        "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
    3.22 -        "\n"
    3.23 -        "lQOmBFpCxkEBCCC8ugYsWOsv966JOl5Ahdw6YiobbU9peFLV8aMBOG+oNIPs3BQj\n"
    3.24 -        "u3FUugkVqA5In93oqVgNZ2LU6Y/RWldN+Pc4IMf6qSZnTBj/1ffBjuqAow1hPEYV\n"
    3.25 -        "354LNYoQtJXioY0X8FjRgt+NoBPphRbo+XJ0uIQckJey6uvvtukEZkMLM1ur1aID\n"
    3.26 -        "9biJZ7yXtJM7KxN5792Vo2gGp/1hlFW6SfM7E0g60L5DT8C/BsYeKtMmxKNZngo6\n"
    3.27 -        "ZBxLDAcxMcT5UpRW79B34pTINZAEsvLeT7TLajzqP/OggUrFkkwLr3KJk09aFF+6\n"
    3.28 -        "TN6CI2fDdSqdoPVEgNrZE9zFqAgVWOdhLOHRpXgt7wARAQABAAgZATpqsN4xRaIk\n"
    3.29 -        "giMdmujkGoMqB/ypoCOW0mqcp3ThESSqWR/Dh8n//k+poHj0Atf7fzie6JNsKruM\n"
    3.30 -        "Yo3mdIzyuuxHsONp6xEtNnkDgEB4WTb2btQQFrNaWXNTPzGVqiBoBShcw5xI7SiG\n"
    3.31 -        "CKaDlCePbaAHyBHO0uzBdVFo6czqkceXSJ+hNDY7xbURbkgIA5SGJ+8cssmcKKoc\n"
    3.32 -        "LDY34S3Pu0gG3+K6gSedYaHAqVVQn8dmEitvDFQ96sTNIpPiMp5Tc+/8UXziF91f\n"
    3.33 -        "XRrXYX9o3nkCvz01qtjR4LQVDztysm3/VmDcsjqhzALiiBLigyglpE5DEp0+wMUq\n"
    3.34 -        "gw5TpWZ63lf6XjEEEM+c+D3HHsEnh24+DNU2OyfFZGpp9olSaTDcXtEBuBTt/Uhy\n"
    3.35 -        "NnqF4MswQ2me4Lfr4D4sUS5jtsKkee+2IQuwtg/bBVYsL6MfV2llJco2vrOCb6y8\n"
    3.36 -        "u9CnQhRbVBd6kBMiJeE50Ijk3jP78GrkPm3rGWKCWRuXVr07+U2MsEnvSkkBfpEE\n"
    3.37 -        "EOi2NcXCCJux9xZv0xOyWogXDVLVrrhs8/PGjJO1IeaMtmrzleo3azUbWus/BYLA\n"
    3.38 -        "vJkO+PElg/MCc2ub5hFs7IqSbLmteWFiSOzTcdHNWeqETsixAc8dpbq0zhkPwdzA\n"
    3.39 -        "otLEBS3mpaB29Bpt9lzgewHoVI/o/OvUFFaP+b1Fd4wOJH8EELZPWw+85tSB1l63\n"
    3.40 -        "4B+77YoBc9wDBFg7Pt4Eo0eghFZ/159YTA1bcr3fZ8bYIgiHHNLC/Fsx+sUu00PC\n"
    3.41 -        "ctLrOxGRbuDyNy2rsezf8Bz8xpihBPuBmSbKoaZguSazgpuC1LPkVbQQVaN1h+Ir\n"
    3.42 -        "9/tJufw+hT9Eggvx5xtCo7GD1trnx0xLKbQhVGVzdCBUb25pIDxlbmdpbmUtMzIy\n"
    3.43 -        "QHBlcHRlc3QuY2g+iQE8BBMBCAAiBQJaQsZBAhsDBgsJCAcDAgYVCAIJCgsEFgID\n"
    3.44 -        "AQIeAQIXgAAKCRCvYy6fx5m31NWeCCCXgm1J7Pq4ECKaMZcp7WoWguXQW+Ellgrx\n"
    3.45 -        "B6EjZmvy1iB0RYaDz6F0HCXd0WtC2YDlkxJ47rKBHsnmcyHbFNlY0fgc5Uhs7apI\n"
    3.46 -        "bBMHHRGwl8pie05DqxQ0jBxO2esk/IPJDhLXw7gZvaY/9PUS669QWoq+L/Hhph8V\n"
    3.47 -        "5v65jnw2937bOaf6wvEUUj2cg6cUaPTZSXv26vxUrT8RD+DxbQiNjJIeGRfVj3QY\n"
    3.48 -        "9GCTcp45ZaB8kLQEVayFrC3Jougcklk5DS1zlFCHiYLa4cco/68XHL7/CFdIxxsK\n"
    3.49 -        "Rd/3FYWX6zfQZJs5U6KmGy18cXvk0OOtTru9aNHR0YiLj4Vs8K+mWA10vZ0DpgRa\n"
    3.50 -        "QsZBAQggwrnOsiJ3JNB+mTm9pZbX4mUkw7OXrar1CvOVDqrnI+H+Z9/DC1FDEupw\n"
    3.51 -        "8mD3fFV4veO6smjb9wWAXhmU88OxXziChM8WJlWz2GrZPoM2DIYu1gLycp7wo1Md\n"
    3.52 -        "mzhd/5tpBWMJ4gGS9AjvQc5ffk7JVBAnmhh4ZtdoEctHMJs7+1RhXE7KUM1QWjew\n"
    3.53 -        "2GAVAaw+KsuXvqsF8soXvlFaHe9sTHKXKUD/MN4WWPR3SIvC4yoadlUpCMfooXf8\n"
    3.54 -        "ZCFLbVirkqGy5AakF7thlaTq7bxEX5BQbP/DjVuTTd311jk4x7oT+1bT7D6iIoES\n"
    3.55 -        "DKfYijw+059CrCbjFUn3/RRg5sx/55FA2XEAEQEAAQAIHiu228SYwSeGGM2cLUt1\n"
    3.56 -        "vBxKeYDnmeb2aJFfUnia/E3NZ7f4/0fUo9qkv9th0l1asMLsU1bG/I6NcR5u3sYE\n"
    3.57 -        "iham0IIxHTdY6QluHzwN573TB8OqoLQDo2D/ATf95PhDcsWvUKIomU1ojhG3Wy+3\n"
    3.58 -        "TzIseD97O9hWhjnsaRxr1QDclghnNffz589T40wAQAkdQlfDuBABberGNR0DsCZq\n"
    3.59 -        "w1xx1+EaEt8o7sXfRMFKoBLJzya0toJNIBGdXCXVPFPtYx6RAiD1KoufgXwVCBaL\n"
    3.60 -        "CHc8QvurgyMBghc9pBcdGs60fNhWn1U4qeWzPOHO95ZWVFObBiuGqkX25revf1Dg\n"
    3.61 -        "RTY5OsBTBBDdnMElWA+l6ctlSX8vNUQBin7aPbHu1HrmUxH9EiKwUd6jdoFmssw7\n"
    3.62 -        "soohAfYJCsuTQLHPI+9W6okF4rjlvl0aS2cN4HSbLjTwdNiUgIHVKJPDq8WDgCsV\n"
    3.63 -        "bR09wsLkohmoX/qZFEQMKdr7A2ar64zQzpx6ZFB0kS71Fr6+rFUAIzePBBDg8QXr\n"
    3.64 -        "J/R6iZYnMNv/mzyNunbM3B7siwbILS1kLeS6lTYeaKORa7JFRc776rkWV//P1Soc\n"
    3.65 -        "nW2byeBxNxOmdNXlNsA6Gg8O4rn3rxEgBZlsOYUG1ZcPZZu8kNFkLTYP+mgFIP3I\n"
    3.66 -        "izn858IbnNFm0HjRMGiS+zip2r/rgbniIhLQ2l7/BBCL+2x0+Ww5I/el6A7k+y2X\n"
    3.67 -        "3xazBVOQfpPl9BgMdsuO0BBlN5RpbTfE8TVpWneeamAuRJh7ArApbAS508Thw7Sj\n"
    3.68 -        "8iLKXj5yScAEC2WO9ZsHqJ/RN3VyhCCI0u3Y75wB3qfcroZUlwvQb/WfH8/vHr2O\n"
    3.69 -        "E72YoprbNOmRFZ7LZkRX56URRn2JASMEGAEIAAkFAlpCxkECGwwACgkQr2Mun8eZ\n"
    3.70 -        "t9RozQggkb/Lb08g4w99CcXq6hV28D5bOHjiEx4XNdkeLVExhfk1zgQ9lf4rjyb2\n"
    3.71 -        "ox+e3Dc5S590NoYg/35vd/QWPsg1JiCvAu296lzOLtIiTAI1KGUJdbsLxRIduOU7\n"
    3.72 -        "6n/KVxRG4w4kJqpbu+UzBY7KtDbWzapJx8v0sdsTOVxg7kFxvYtra5TRaPfce4EX\n"
    3.73 -        "ox2V2HPhtFNSILH8Jqh/R0PV5RRbNFHZA4cKXkBJMw3BcpbpXeLCXiD6P3FNVSKh\n"
    3.74 -        "Rkd3JY0XJhwbvGPCRWkobtxkieZe0bCmKu8+gw0Zqm2QNA7J6iMT4rMZWH9k7lpp\n"
    3.75 -        "okyt7GheXlwKEtVQSAcH/NalK9Q+ckaQttA=\n"
    3.76 -        "=KACn\n"
    3.77 -        "-----END PGP PRIVATE KEY BLOCK-----\n"
    3.78 -        "\n";
    3.79 -
    3.80 -    static const std::string mimetext =
    3.81 -        "To: denden@peptest.ch\r\n"
    3.82 -        "From: Lars Rohwedder <roker@pep-project.org>\r\n"
    3.83 -        "Subject: Test for ENGINE-322\r\n"
    3.84 -        "Message-ID: <4b2d328c-b284-e359-1c2c-fe136358b8a6@pep-project.org>\r\n"
    3.85 -        "Date: Thu, 28 Dec 2017 22:00:47 +0100\r\n"
    3.86 -        "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0)\r\n"
    3.87 -        " Gecko/20100101 Thunderbird/52.5.0\r\n"
    3.88 -        "MIME-Version: 1.0\r\n"
    3.89 -        "Content-Type: text/plain; charset=utf-8\r\n"
    3.90 -        "Content-Language: en-US\r\n"
    3.91 -        "Content-Transfer-Encoding: 8bit\r\n"
    3.92 -        "\r\n"
    3.93 -        "-----BEGIN PGP MESSAGE-----\r\n"
    3.94 -        "Charset: utf-8\r\n"
    3.95 -        "\r\n"
    3.96 -        "hQEQA30SSxlFRbxRAQgggvPrko4vJ988ylqdGF7/Jtw/61VddHg7rjOTG7yZiq2J\r\n"
    3.97 -        "p0lXb0N9Bz8SON/m4NWWS5ij0Bj1wMdTgLowLxMz0PfCIyyiQIfqEBAXUcAOQh2f\r\n"
    3.98 -        "Pg2iZbynrQ1T4M/D0BlIn2bfXb790Cni+o1OmWTCx4wC6AKtGvlonLAIsH1hUfs+\r\n"
    3.99 -        "yKOyCCNaNSmyAPeF3F5v7iEO5Eez1R/UrtxcYj2QmCdVt5v0AuAlm5HVPJgj7wCd\r\n"
   3.100 -        "MeRmK4a1+sM51CcCf6Tk9uZbIVrr/XkyGVPmmHTK8E4QmvmL6PGeuIitwqKe80/L\r\n"
   3.101 -        "XH4ZYPXIxVU9o5HoSo3YJ3BSKLQzCoDRCD8JlCo08K6mrpuFAgwD42RJLbKIaR4B\r\n"
   3.102 -        "EADNgisKiIku4SrBmBkryyKMYmOTW0QKnY/wfNselpzuj5cMpKA4e60x/wEQRIvC\r\n"
   3.103 -        "m1ZO7LjhbVjNf6ws2FgytnTRf+8R/R8mp6/XIDeUvaBvUku5yoRjTeznFRwpj6yT\r\n"
   3.104 -        "WfQMlLojI2fe+y5fHKIIjTpW5HOQQv7sZ4UzE+jRpRErRVq4UI49l7yTBnG0j75w\r\n"
   3.105 -        "UZTt05OnJMQrCCiD7Fu9xDw5If3x884GehKpFGm6XqZ8V7NhwGk6mf62rZEouBQh\r\n"
   3.106 -        "AhTu/irkz30PpWY3gGj2YF0PIaQmweb9u2izox1kTfq2xRfPLg/4cOgBKy1/Xeea\r\n"
   3.107 -        "IVeaACAcoNdJaYuZCSe9CMbr5s7kusE22/6fB0L1itGr09EzhwGJS/+XSt0IwcJw\r\n"
   3.108 -        "7XDUGtmYXuTy08wUKU9McxXJ8nlUkXF9ZcswVxHKG36ZRfzx5eBPjzSnDo8EZHs2\r\n"
   3.109 -        "wr7wnS8s8J+AvB7kZYFChAct4KH9OwT3/2pSdhd8/sSCkj2zGtrB+8h2QkIE4csD\r\n"
   3.110 -        "rIHtBp4oWCJq1XOKYPvdGqWBxZ/7086kksB99Eyn+sy5C0iNTbEdUN4JkIYq1C0n\r\n"
   3.111 -        "DExbr+dqip65DEJRj7TPfwTJ5D28djPYutanSRfJS/niPqztWu0R1ISucw1TMdGU\r\n"
   3.112 -        "NcqsqQLPYzTV6xTq+bgBsi8DO4tXkcOpf7eDEP+5kDOncNLpAZGc9NUnVa/jpkYO\r\n"
   3.113 -        "XE+CNJ5SYQPdsGcir9JNXNTDgKAGSTI7OAU/ZxOcMCsmctJATcAZERFgvUy8YZN1\r\n"
   3.114 -        "3X4Ii6osc8u6shJrjL/detZs8LH8wSe6NYQdtipQo4ySAYQAO9tXdoRrfktXrYus\r\n"
   3.115 -        "eLh86toD19D5R9RxHnVEMQP5CdNWgvX7X4ngK94kJq18QCDa1bZXhHBKmWOnAtyL\r\n"
   3.116 -        "zpcUNnCWo2gml6GX2kyuL+5Ji6afwKHZg+iag8wBDLGQ+hoOMnzk1iP4DFeQ7iZN\r\n"
   3.117 -        "Qvd4mWWASd2BCnf9ulKiMw1wdzN2mpYRNo+nRHx0Zu50VUyj0xMm8VSyUZis5+YH\r\n"
   3.118 -        "I3Se7UEeS6ppLsiGcyaJDCMp/38xt5SU5NY4wAAubc6MJclECcvSkM1W/20wQ4di\r\n"
   3.119 -        "z5FhKHlqZaPTXN02h0P78wKDDwJr7fFvqtB8G2LgtwbXAkOUvn8vbomQLHBkQ+GH\r\n"
   3.120 -        "AuXqBGxKrIwyIEjLZf6hDz++0fDa/ACeFynpxNl1ehmvCl5CsEMcCiM+Ic2pZ/ML\r\n"
   3.121 -        "+Hle0GWEKej4WBzXi0j4pzR4WZFt9XCv5+yYAg+UHKc2Kn0Q+bC1AZYxhQDicTP9\r\n"
   3.122 -        "qNKTLBHRAeJoQ1y4vHXYGwRGH+penfJiKsQsyOOeoQlZar8tvRYR77K8FhxBtnYK\r\n"
   3.123 -        "Xrv+rb1BT/2Ey7P4jb8PiZpbic7ACu1MjFdmlPKrExe5+MY+Pr9ms+hxJrdBH736\r\n"
   3.124 -        "K6dojmWUQKpJRzue2lWsfESLxIVeB+vmbg2zU3PflCmMIsRNh2US7vZj2WdgqSqz\r\n"
   3.125 -        "wR2eTG4MgPVy4iiGOVT2JWS5t+KXm3kwUZTy9Twi6P1ebNm/B8KQwlutssdWip2q\r\n"
   3.126 -        "hON1aFYa4L601zrHgow592PdBkRPQZGiXNHffCvHgsxBHsj4G4JWZhmIkEK/cIWl\r\n"
   3.127 -        "RanlZdQG6UPHkoUomh7hauUUgcYe4FWt4NBKdiba36Y=\r\n"
   3.128 -        "=1lFj\r\n"
   3.129 -        "-----END PGP MESSAGE-----\r\n"
   3.130 -        "\r\n";
   3.131 -
   3.132 -	PEP_SESSION session;
   3.133 -	PEP_STATUS status1 = init(&session);
   3.134 -	assert(status1 == PEP_STATUS_OK);
   3.135 -	assert(session);
   3.136 -
   3.137 -	// import secret key
   3.138 -	identity_list* pk = NULL; 
   3.139 -	status1 = import_key( session, private_key.c_str(), private_key.size(), &pk );
   3.140 -	assert(status1 == PEP_STATUS_OK);
   3.141 -	std::cout << "Imported " << identity_list_length(pk) << " private key(s)." << endl;
   3.142 -	
   3.143 -	char* plaintext = nullptr;
   3.144 -	stringlist_t* keys_used = nullptr;
   3.145 -	PEP_rating rating;
   3.146 -	PEP_decrypt_flags_t dec_flags;
   3.147 -        char* modified_src = NULL;
   3.148 -	
   3.149 -        dec_flags = 0;
   3.150 -	PEP_STATUS status2 = MIME_decrypt_message(session, mimetext.c_str(), mimetext.length(),
   3.151 -		&plaintext, &keys_used, &rating, &dec_flags, &modified_src);
   3.152 -	
   3.153 -	std::cout << "MIME_decrypt_message returned " << std::dec << status2 << std::hex << " (0x" << status2 << ")" << std::dec << endl;
   3.154 -	
   3.155 -    // We have no public key, so we cannot, in fact, VERIFY the message. SO cannot be PEP_STATUS_OK.
   3.156 -	assert(status2 == PEP_DECRYPTED);
   3.157 -	assert(plaintext);
   3.158 -	
   3.159 -	pEp_free(plaintext);
   3.160 -	
   3.161 -	identity_list* il = pk;
   3.162 -	while(il)
   3.163 -	{
   3.164 -		std::cout << "Delete test key \"" << il->ident->fpr << "\"" << endl;
   3.165 -		delete_keypair( session, il->ident->fpr );
   3.166 -		il = il->next;
   3.167 -	}
   3.168 -	free_identity_list(pk);
   3.169 -}
   3.170 -
   3.171 -int main() {
   3.172 -    test_MIME_decrypt_message();
   3.173 -    return 0;
   3.174 -}