From 3740e3401e76625fd79fa9e278a4205dd5e7d55c Mon Sep 17 00:00:00 2001 From: Cinder Biscuits <cinder@cinderblocks.biz> Date: Wed, 4 Sep 2019 20:50:34 -0500 Subject: [PATCH] Fixes for integration tests --- indra/llcommon/tests/commonmisc_test.cpp | 46 ----------------- indra/llcommon/tests/llsingleton_test.cpp | 4 +- indra/llcommon/tests/wrapllerrs.h | 6 --- .../llcorehttp/examples/http_texture_load.cpp | 51 ------------------- indra/llcorehttp/tests/llcorehttp_test.cpp | 50 ------------------ indra/llkdu/tests/llimagej2ckdu_test.cpp | 10 +++- indra/newview/tests/lllogininstance_test.cpp | 4 +- .../newview/tests/llsechandler_basic_test.cpp | 24 +++++---- indra/test/llsdmessagebuilder_tut.cpp | 1 - indra/test/lltemplatemessagebuilder_tut.cpp | 1 - 10 files changed, 25 insertions(+), 172 deletions(-) diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index 1dc1e267db..a18364b6b3 100644 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -41,7 +41,6 @@ #include "../llmemorystream.h" #include "../llsd.h" #include "../llsdserialize.h" -#include "../u64.h" #include "../test/lltut.h" @@ -466,51 +465,6 @@ namespace tut namespace tut { - struct U64_data - { - }; - typedef test_group<U64_data> U64_test; - typedef U64_test::object U64_object; - tut::U64_test U64_testcase("U64_conversion"); - - - // U64_to_F64 - template<> template<> - void U64_object::test<1>() - { - F64 val; - F64 result; - - result = 18446744073709551610.0; - val = U64_to_F64(U64L(18446744073709551610)); - ensure_equals("U64_to_F64 converted 3.1", val, result); - - result = 18446744073709551615.0; // 0xFFFFFFFFFFFFFFFF - val = U64_to_F64(U64L(18446744073709551615)); - ensure_equals("U64_to_F64 converted 3.2", val, result); - - result = 0.0; // overflow 0xFFFFFFFFFFFFFFFF + 1 == 0 - // overflow - will result in warning at compile time - val = U64_to_F64(U64L(18446744073709551615)+1); - ensure_equals("U64_to_F64 converted 3.3", val, result); - - result = 0.0; // 0 - val = U64_to_F64(U64L(0)); - ensure_equals("U64_to_F64 converted 3.4", val, result); - - result = 1.0; // odd - val = U64_to_F64(U64L(1)); - ensure_equals("U64_to_F64 converted 3.5", val, result); - - result = 2.0; // even - val = U64_to_F64(U64L(2)); - ensure_equals("U64_to_F64 converted 3.6", val, result); - - result = U64L(0x7FFFFFFFFFFFFFFF) * 1.0L; // 0x7FFFFFFFFFFFFFFF - val = U64_to_F64(U64L(0x7FFFFFFFFFFFFFFF)); - ensure_equals("U64_to_F64 converted 3.7", val, result); - } - // llstrtou64 // seems to be deprecated - could not find it being used // anywhere in the tarball - skipping unit tests for now diff --git a/indra/llcommon/tests/llsingleton_test.cpp b/indra/llcommon/tests/llsingleton_test.cpp index 56886bc73f..6338e9a9cb 100644 --- a/indra/llcommon/tests/llsingleton_test.cpp +++ b/indra/llcommon/tests/llsingleton_test.cpp @@ -46,8 +46,8 @@ public: \ DEP_INIT /* dependency in initSingleton */ \ } sDepFlag; \ \ - void initSingleton(); \ - void cleanupSingleton(); \ + void initSingleton() override; \ + void cleanupSingleton() override; \ }; \ \ CLS::dep_flag CLS::sDepFlag = DEP_NONE diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index 5d51a558e8..7c4b4fbd44 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -158,12 +158,6 @@ private: MessageList mMessages; }; -inline -std::ostream& operator<<(std::ostream& out, const CaptureLogRecorder& log) -{ - return log.streamto(out); -} - /** * Capture log messages. This is adapted (simplified) from the one in * llerror_test.cpp. diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp index 10fdc3f70b..c95c11d889 100644 --- a/indra/llcorehttp/examples/http_texture_load.cpp +++ b/indra/llcorehttp/examples/http_texture_load.cpp @@ -52,8 +52,6 @@ void init_curl(); void term_curl(); -unsigned long ssl_thread_id_callback(void); -void ssl_locking_callback(int mode, int type, const char * file, int line); void usage(std::ostream & out); // Default command line settings @@ -606,63 +604,14 @@ void WorkingSet::loadAssetUuids(FILE * in) } -int ssl_mutex_count(0); -LLCoreInt::HttpMutex ** ssl_mutex_list = NULL; - void init_curl() { curl_global_init(CURL_GLOBAL_ALL); - - ssl_mutex_count = CRYPTO_num_locks(); - if (ssl_mutex_count > 0) - { - ssl_mutex_list = new LLCoreInt::HttpMutex * [ssl_mutex_count]; - - for (int i(0); i < ssl_mutex_count; ++i) - { - ssl_mutex_list[i] = new LLCoreInt::HttpMutex; - } - - CRYPTO_set_locking_callback(ssl_locking_callback); - CRYPTO_set_id_callback(ssl_thread_id_callback); - } } void term_curl() { - CRYPTO_set_locking_callback(NULL); - for (int i(0); i < ssl_mutex_count; ++i) - { - delete ssl_mutex_list[i]; - } - delete [] ssl_mutex_list; -} - - -unsigned long ssl_thread_id_callback(void) -{ -#if defined(WIN32) - return (unsigned long) GetCurrentThreadId(); -#else - return (unsigned long) pthread_self(); -#endif -} - - -void ssl_locking_callback(int mode, int type, const char * /* file */, int /* line */) -{ - if (type >= 0 && type < ssl_mutex_count) - { - if (mode & CRYPTO_LOCK) - { - ssl_mutex_list[type]->lock(); - } - else - { - ssl_mutex_list[type]->unlock(); - } - } } diff --git a/indra/llcorehttp/tests/llcorehttp_test.cpp b/indra/llcorehttp/tests/llcorehttp_test.cpp index b4627c5a24..9614920172 100755 --- a/indra/llcorehttp/tests/llcorehttp_test.cpp +++ b/indra/llcorehttp/tests/llcorehttp_test.cpp @@ -51,9 +51,6 @@ #include "llproxy.h" #include "llcleanup.h" -unsigned long ssl_thread_id_callback(void); -void ssl_locking_callback(int mode, int type, const char * file, int line); - #if 0 // lltut provides main and runner namespace tut @@ -85,20 +82,6 @@ void init_curl() { curl_global_init(CURL_GLOBAL_ALL); - ssl_mutex_count = CRYPTO_num_locks(); - if (ssl_mutex_count > 0) - { - ssl_mutex_list = new LLCoreInt::HttpMutex * [ssl_mutex_count]; - - for (int i(0); i < ssl_mutex_count; ++i) - { - ssl_mutex_list[i] = new LLCoreInt::HttpMutex; - } - - CRYPTO_set_locking_callback(ssl_locking_callback); - CRYPTO_set_id_callback(ssl_thread_id_callback); - } - LLProxy::getInstance(); } @@ -106,39 +89,6 @@ void init_curl() void term_curl() { SUBSYSTEM_CLEANUP(LLProxy); - - CRYPTO_set_locking_callback(NULL); - for (int i(0); i < ssl_mutex_count; ++i) - { - delete ssl_mutex_list[i]; - } - delete [] ssl_mutex_list; -} - - -unsigned long ssl_thread_id_callback(void) -{ -#if defined(WIN32) - return (unsigned long) GetCurrentThreadId(); -#else - return (unsigned long) pthread_self(); -#endif -} - - -void ssl_locking_callback(int mode, int type, const char * /* file */, int /* line */) -{ - if (type >= 0 && type < ssl_mutex_count) - { - if (mode & CRYPTO_LOCK) - { - ssl_mutex_list[type]->lock(); - } - else - { - ssl_mutex_list[type]->unlock(); - } - } } diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index 5a17d782a9..9b6876f77a 100644 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -28,6 +28,9 @@ #include "linden_common.h" // Class to test #include "llimagej2ckdu.h" +#ifdef LL_CLANG +# pragma GCC diagnostic ignored "-Wunused-private-field" +#endif // LL_CLANG #include "llkdumem.h" #include "kdu_block_coding.h" // Tut header @@ -135,9 +138,9 @@ void kdu_resolution::get_dims(kdu_dims& ) { } int kdu_resolution::which() { return 0; } int kdu_resolution::get_valid_band_indices(int &) { return 1; } kdu_synthesis::kdu_synthesis(kdu_resolution, kdu_sample_allocator*, bool, float, kdu_thread_env*, kdu_thread_queue*) { } -//kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool) { } -kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool, kd_core_local::kd_coremem*) {} kdu_params::~kdu_params() { } +void kdu_params::destroy() { } +kdu_params::kdu_params(char const*, bool, bool, bool, bool, bool) { } void kdu_params::set(const char* , int , int , bool ) { } void kdu_params::set(const char* , int , int , int ) { } void kdu_params::finalize_all(bool ) { } @@ -151,6 +154,7 @@ kdu_params* kdu_params::access_relation(int, int, int, bool) { return NULL; } kdu_params* kdu_params::access_cluster(const char*) { return NULL; } void kdu_codestream::set_fast() { } void kdu_codestream::set_fussy() { } +kdu_codestream_comment kdu_codestream::get_comment(kdu_core::kdu_codestream_comment e ) { return e; } void kdu_codestream::get_dims(int, kdu_dims&, bool ) { } int kdu_codestream::get_min_dwt_levels() { return 5; } int kdu_codestream::get_max_tile_layers() { return 1; } @@ -187,6 +191,7 @@ void kdu_subband::close_block(kdu_block*, kdu_thread_env*) { } void kdu_subband::get_valid_blocks(kdu_dims &indices) const { } kdu_block * kdu_subband::open_block(kdu_coords, int *, kdu_thread_env *, int, bool) { return NULL; } bool kdu_codestream_comment::put_text(const char*) { return false; } +const char * kdu_codestream_comment::get_text() { return nullptr; } void kdu_customize_warnings(kdu_message*) { } void kdu_customize_errors(kdu_message*) { } kdu_long kdu_multi_analysis::create( @@ -202,6 +207,7 @@ kdu_long kdu_multi_analysis::create( kdu_membroker*) { return kdu_long(0); } void kdu_multi_analysis::destroy(kdu_thread_env *) {} siz_params::siz_params(kd_core_local::kd_coremem*) : kdu_params(NULL, false, false, false, false, false) { } +siz_params::siz_params() : kdu_params(NULL, false, false, false, false, false) {} siz_params::~siz_params() {} void siz_params::finalize(bool ) { } void siz_params::copy_with_xforms(kdu_params*, int, int, bool, bool, bool) { } diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index bda96ecb07..fbf2f36904 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -305,10 +305,10 @@ S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& resp #include "../llmachineid.h" unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2}; -S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) +U32 LLMachineID::getUniqueID(U8 unique_id[32], size_t len) const { memcpy(unique_id, gMACAddress, len); - return 1; + return 6; } //----------------------------------------------------------------------------- // misc diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index cc696a4841..c253c0e169 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -28,6 +28,7 @@ #include "../llviewerprecompiledheaders.h" #include "../test/lltut.h" #include "../llsecapi.h" +#include "../llsecapicerthandler.h" #include "../llsechandler_basic.h" #include "../../llxml/llcontrol.h" #include "../llviewernetwork.h" @@ -100,18 +101,19 @@ void LLCredential::identifierType(std::string &idType) {} void LLCredential::authenticatorType(std::string &idType) { } LLSD LLCredential::asLLSD(bool save_authenticator) { return LLSD(); } /*static*/ std::string LLCredential::userIDFromIdentifier(const LLSD& sdIdentifier) { return std::string(); } -/*static*/ std::string LLCredential::userNameFromIdentifier(const LLSD& sdIdentifier) { return std::string(); } +/*static*/ std::string LLCredential::usernameFromIdentifier(const LLSD& identifier) { return std::string(); } LLControlGroup gSavedSettings("test"); unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2}; -S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) +U32 LLMachineID::getUniqueID(U8 unique_id[32], size_t len) const { memcpy(unique_id, gMACAddress, len); return 1; } -S32 LLMachineID::init() { return 1; } + +bool LLMachineID::init() { return true; } // ------------------------------------------------------------------------------------------- @@ -594,11 +596,9 @@ namespace tut sechandler_basic_test() { - LLMachineID::init(); - OpenSSL_add_all_algorithms(); - OpenSSL_add_all_ciphers(); - OpenSSL_add_all_digests(); - ERR_load_crypto_strings(); + LLMachineID machineId; + machineId.init(); + gFirstName = ""; gLastName = ""; mValidationDate[CERT_VALIDATION_DATE] = LLDate("2017-04-11T00:00:00.00Z"); @@ -716,6 +716,8 @@ namespace tut template<> template<> void sechandler_basic_test_object::test<3>() { + LLMachineID machineId; + machineId.init(); std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u" "GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO" "nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq" @@ -727,9 +729,9 @@ namespace tut LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES); cipher.decrypt(&binary_data[0], 16); - unsigned char unique_id[MAC_ADDRESS_BYTES]; - LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); - LLXORCipher cipher2(unique_id, sizeof(unique_id)); + U8 unique_id[32]; + U32 id_len = machineId.getUniqueID(unique_id, sizeof(unique_id)); + LLXORCipher cipher2(unique_id, sizeof(id_len)); cipher2.encrypt(&binary_data[0], 16); std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary); temp_file.write((const char *)&binary_data[0], binary_data.size()); diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp index b7283f53a6..d2a811904c 100644 --- a/indra/test/llsdmessagebuilder_tut.cpp +++ b/indra/test/llsdmessagebuilder_tut.cpp @@ -35,7 +35,6 @@ #include "llsdtraits.h" #include "llmath.h" #include "llquaternion.h" -#include "u64.h" #include "v3dmath.h" #include "v3math.h" #include "v4math.h" diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index 7b4b6a8b70..288fc3ba8f 100644 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -36,7 +36,6 @@ #include "lltemplatemessagebuilder.h" #include "lltemplatemessagereader.h" #include "message_prehash.h" -#include "u64.h" #include "v3dmath.h" #include "v3math.h" #include "v4math.h" -- GitLab