diff options
| author | Erik Kundiman <erik@megapahit.org> | 2025-12-04 13:58:12 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2025-12-04 16:48:50 +0800 |
| commit | e3a35af2c676fb211ff7d01a79eb1a3299bc82f3 (patch) | |
| tree | 0ff7a0a15d1a53850399250b65f0a2a42f7bbf22 /indra/test | |
| parent | ac052bed7f9f97efc63f0a0322214d4dcdcd5664 (diff) | |
| parent | c4ec3d866082d588de671e833413474d7ab19524 (diff) | |
Merge remote-tracking branch 'secondlife/release/2026.01' into 2026.01
Diffstat (limited to 'indra/test')
| -rw-r--r-- | indra/test/CMakeLists.txt | 1 | ||||
| -rwxr-xr-x | indra/test/blowfish.1.bin | 1 | ||||
| -rwxr-xr-x | indra/test/blowfish.2.bin | bin | 40 -> 0 bytes | |||
| -rw-r--r-- | indra/test/blowfish.digits.txt | 1 | ||||
| -rwxr-xr-x | indra/test/blowfish.pl | 79 | ||||
| -rw-r--r-- | indra/test/llblowfish_tut.cpp | 141 | ||||
| -rw-r--r-- | indra/test/llevents_tut.cpp | 31 | ||||
| -rw-r--r-- | indra/test/test.cpp | 12 |
8 files changed, 21 insertions, 245 deletions
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index f80286a630..246fc5e6f8 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -13,7 +13,6 @@ include(bugsplat) set(test_SOURCE_FILES io.cpp llapp_tut.cpp - llblowfish_tut.cpp llbuffer_tut.cpp lldoubledispatch_tut.cpp llevents_tut.cpp diff --git a/indra/test/blowfish.1.bin b/indra/test/blowfish.1.bin deleted file mode 100755 index 61286e45e3..0000000000 --- a/indra/test/blowfish.1.bin +++ /dev/null @@ -1 +0,0 @@ -.A„Ä3ŒLÜE ``òøÝKÛ@¼ûÇ;M[ÚBë·ø„>ËÊC—'
\ No newline at end of file diff --git a/indra/test/blowfish.2.bin b/indra/test/blowfish.2.bin Binary files differdeleted file mode 100755 index ef72d96bbf..0000000000 --- a/indra/test/blowfish.2.bin +++ /dev/null diff --git a/indra/test/blowfish.digits.txt b/indra/test/blowfish.digits.txt deleted file mode 100644 index fce1fed943..0000000000 --- a/indra/test/blowfish.digits.txt +++ /dev/null @@ -1 +0,0 @@ -01234567890123456789012345678901234 diff --git a/indra/test/blowfish.pl b/indra/test/blowfish.pl deleted file mode 100755 index 30f41dcd4c..0000000000 --- a/indra/test/blowfish.pl +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -# -# Test Perl Crypt::CBC Blowfish algorithm and initial parameter settings -# for compatibility with OpenSSL's Blowfish algorithm/settings. -# -# Used by outbound LSL email (openssl C library) and mailglue (Perl library) -use strict; -use warnings; - -# *TODO: specify test count here -use Test::More qw(no_plan); - -use Crypt::CBC; -use MIME::Base64; - -my $init_vector = "\x00" x 8; -# my $key = pack("H*", "ef5a8376eb0c99fe0dafa487d15bec19cae63d1e25fe31d8d92f7ab0398246d70ee733108e47360e16359654571cf5bab6c3375b42cee4fa"); -# my $key = "d263eb8a78034e40"; - #"8d082918aa369174"; -my $key = "\x00" x 16; - -my $cipher = Crypt::CBC->new( { cipher => 'Blowfish', - regenerate_key => 0, - key => $key, - iv => $init_vector, - header => 'none', - prepend_iv => 0, - keysize => 16 } ); - -#my $blocks = $cipher->blocksize(); -#print "blocksize $blocks\n"; - -my $len; -my $input = "01234567890123456789012345678901234\n"; -#my $input = "a whale of a tale I tell you lad, a whale of a tale for me, a whale of a tale and the fiddlers three"; -$len = length($input); -is ($len, 36, "input length"); - -$len = length($key); -is ($len, 16, "key length"); - - -my $encrypted = $cipher->encrypt($input); -is (length($encrypted), 40, "encrypted length"); - -open(FH, "blowfish.1.bin"); -my $bin = scalar <FH>; -is ($encrypted, $bin, "matches openssl"); -close(FH); - -my $base64 = encode_base64($encrypted); -is ($base64, "LkGExDOMTNxFIGBg8gP43UvbQLz7xztNWwYF2kLrtwT4hD7LykOXJw==\n", - "base64 output"); - -my $unbase64 = decode_base64($base64); -is( $encrypted, $unbase64, "reverse base64" ); - -my $output = $cipher->decrypt($unbase64); -is ($input, $output, "reverse encrypt"); - -$key = pack("H[32]", "526a1e07a19dbaed84c4ff08a488d15e"); -$cipher = Crypt::CBC->new( { cipher => 'Blowfish', - regenerate_key => 0, - key => $key, - iv => $init_vector, - header => 'none', - prepend_iv => 0, - keysize => 16 } ); -$encrypted = $cipher->encrypt($input); -is (length($encrypted), 40, "uuid encrypted length"); -$output = $cipher->decrypt($encrypted); -is ($input, $output, "uuid reverse encrypt"); - -open(FH, "blowfish.2.bin"); -$bin = scalar <FH>; -close(FH); -is( $encrypted, $bin, "uuid matches openssl" ); - -print encode_base64($encrypted); diff --git a/indra/test/llblowfish_tut.cpp b/indra/test/llblowfish_tut.cpp deleted file mode 100644 index a8690ccb33..0000000000 --- a/indra/test/llblowfish_tut.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @file llblowfish_tut.cpp - * @author James Cook, james@lindenlab.com - * @date 2007-02-04 - * - * Data files generated with: - * openssl enc -bf-cbc -in blowfish.digits.txt -out blowfish.1.bin -K 00000000000000000000000000000000 -iv 0000000000000000 -p - * openssl enc -bf-cbc -in blowfish.digits.txt -out blowfish.2.bin -K 526a1e07a19dbaed84c4ff08a488d15e -iv 0000000000000000 -p - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "lltut.h" - -#include "llblowfishcipher.h" - -#include "lluuid.h" - -namespace tut -{ - class LLData - { - public: - unsigned char* mInput; - int mInputSize; - - LLData() - { - // \n to make it easier to create text files - // for testing with command line openssl - mInput = (unsigned char*)"01234567890123456789012345678901234\n"; - mInputSize = 36; - } - - bool matchFile(const std::string& filename, - const std::string& data) - { - LLFILE* fp = LLFile::fopen(filename, "rb"); - if (!fp) - { - // sometimes test is run inside the indra directory - std::string path = "test/"; - path += filename; - fp = LLFile::fopen(path, "rb"); - } - if (!fp) - { - LL_WARNS() << "unable to open " << filename << LL_ENDL; - return false; - } - - std::string good; - good.resize(256); - size_t got = fread(&good[0], 1, 256, fp); - LL_DEBUGS() << "matchFile read " << got << LL_ENDL; - fclose(fp); - good.resize(got); - - return (good == data); - } - }; - typedef test_group<LLData> blowfish_test; - typedef blowfish_test::object blowfish_object; - // Create test with name that can be selected on - // command line of test app. - tut::blowfish_test blowfish("blowfish"); - - template<> template<> - void blowfish_object::test<1>() - { - LLUUID blank; - LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); - - U32 dst_len = cipher.requiredEncryptionSpace(36); - ensure("encryption space 36", - (dst_len == 40) ); - - // Blowfish adds an additional 8-byte block if your - // input is an exact multiple of 8 - dst_len = cipher.requiredEncryptionSpace(8); - ensure("encryption space 8", - (dst_len == 16) ); - } - - template<> template<> - void blowfish_object::test<2>() - { - LLUUID blank; - LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); - - std::string result; - result.resize(256); - U32 count = cipher.encrypt(mInput, mInputSize, - (U8*) &result[0], 256); - - ensure("encrypt output count", - (count == 40) ); - result.resize(count); - - ensure("encrypt null key", matchFile("blowfish.1.bin", result)); - } - - template<> template<> - void blowfish_object::test<3>() - { - // same as base64 test id - LLUUID id("526a1e07-a19d-baed-84c4-ff08a488d15e"); - LLBlowfishCipher cipher(&id.mData[0], UUID_BYTES); - - std::string result; - result.resize(256); - U32 count = cipher.encrypt(mInput, mInputSize, - (U8*) &result[0], 256); - - ensure("encrypt output count", - (count == 40) ); - result.resize(count); - - ensure("encrypt real key", matchFile("blowfish.2.bin", result)); - } -} diff --git a/indra/test/llevents_tut.cpp b/indra/test/llevents_tut.cpp index bf5cd3f853..c5d5dcb9d4 100644 --- a/indra/test/llevents_tut.cpp +++ b/indra/test/llevents_tut.cpp @@ -44,15 +44,12 @@ #include <typeinfo> // external library headers #include <boost/bind.hpp> -#include <boost/assign/list_of.hpp> // other Linden headers #include "tests/listener.h" // must PRECEDE lltut.h #include "lltut.h" #include "catch_and_store_what_in.h" #include "stringize.h" -using boost::assign::list_of; - template<typename T> T make(const T& value) { @@ -178,7 +175,7 @@ void events_object::test<2>() LLBoundListener bound0 = listener0.listenTo(per_frame, &Listener::callstop); LLBoundListener bound1 = listener1.listenTo(per_frame, &Listener::call, // after listener0 - make<LLEventPump::NameList>(list_of(listener0.getName()))); + make<LLEventPump::NameList>(LLEventPump::NameList{ listener0.getName() })); ensure("enabled", per_frame.enabled()); ensure("connected 0", bound0.connected()); ensure("unblocked 0", !bound0.blocked()); @@ -278,24 +275,24 @@ void events_object::test<6>() button.listen("Mary", boost::bind(&Collect::add, boost::ref(collector), "Mary", _1), // state that "Mary" must come after "checked" - make<NameList> (list_of("checked"))); + make<NameList>(NameList{ "checked" })); button.listen("checked", boost::bind(&Collect::add, boost::ref(collector), "checked", _1), // "checked" must come after "spot" - make<NameList> (list_of("spot"))); + make<NameList>(NameList{ "spot" })); button.listen("spot", boost::bind(&Collect::add, boost::ref(collector), "spot", _1)); button.post(1); - ensure_equals(collector.result, make<StringVec>(list_of("spot")("checked")("Mary"))); + ensure_equals(collector.result, make<StringVec>(StringVec{ "spot", "checked", "Mary" })); collector.clear(); button.stopListening("Mary"); button.listen("Mary", boost::bind(&Collect::add, boost::ref(collector), "Mary", _1), LLEventPump::empty, // no after dependencies // now "Mary" must come before "spot" - make<NameList>(list_of("spot"))); + make<NameList>(NameList{ "spot" })); button.post(2); - ensure_equals(collector.result, make<StringVec>(list_of("Mary")("spot")("checked"))); + ensure_equals(collector.result, make<StringVec>(StringVec{ "Mary", "spot", "checked" })); collector.clear(); button.stopListening("spot"); std::string threw = catch_what<LLEventPump::Cycle>( @@ -303,7 +300,7 @@ void events_object::test<6>() button.listen("spot", boost::bind(&Collect::add, boost::ref(collector), "spot", _1), // after "Mary" and "checked" -- whoops! - make<NameList>(list_of("Mary")("checked"))); + make<NameList>(NameList{ "Mary", "checked" })); }); // Obviously the specific wording of the exception text can // change; go ahead and change the test to match. @@ -321,20 +318,18 @@ void events_object::test<6>() ensure_contains("cyclic dependencies", threw, "after (\"Mary\", \"checked\") -> \"spot\""); button.listen("yellow", - boost::bind(&Collect::add, boost::ref(collector), "yellow", _1), - make<NameList>(list_of("checked"))); + boost::bind(&Collect::add, boost::ref(collector), "yellow", _1), make<NameList>(NameList{ "checked" })); button.listen("shoelaces", - boost::bind(&Collect::add, boost::ref(collector), "shoelaces", _1), - make<NameList>(list_of("checked"))); + boost::bind(&Collect::add, boost::ref(collector), "shoelaces", _1), make<NameList>(NameList{ "checked" })); button.post(3); - ensure_equals(collector.result, make<StringVec>(list_of("Mary")("checked")("yellow")("shoelaces"))); + ensure_equals(collector.result, make<StringVec>(StringVec{ "Mary", "checked", "yellow", "shoelaces" })); collector.clear(); threw = catch_what<LLEventPump::OrderChange>( [&button, &collector](){ button.listen("of", boost::bind(&Collect::add, boost::ref(collector), "of", _1), - make<NameList>(list_of("shoelaces")), - make<NameList>(list_of("yellow"))); + make<NameList>(NameList{ "shoelaces" }), + make<NameList>(NameList{ "yellow" })); }); // Same remarks about the specific wording of the exception. Just // ensure that it contains enough information to clarify the @@ -347,7 +342,7 @@ void events_object::test<6>() ensure_contains("old order", threw, "was: Mary, checked, yellow, shoelaces"); ensure_contains("new order", threw, "now: Mary, checked, shoelaces, of, yellow"); button.post(4); - ensure_equals(collector.result, make<StringVec>(list_of("Mary")("checked")("yellow")("shoelaces"))); + ensure_equals(collector.result, make<StringVec>(StringVec{ "Mary", "checked", "yellow", "shoelaces" })); } template<> template<> diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 09147a65a3..f6f5b5a5fc 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -84,12 +84,14 @@ public: virtual void replay(std::ostream&) {} }; -class RecordToTempFile : public LLError::Recorder, public boost::noncopyable +class RecordToTempFile : public LLError::Recorder { public: + RecordToTempFile(const RecordToTempFile&) = delete; + RecordToTempFile& operator=(const RecordToTempFile&) = delete; + RecordToTempFile() : LLError::Recorder(), - boost::noncopyable(), mTempFile("log", ""), mFile(mTempFile.getName().c_str()) { @@ -128,12 +130,14 @@ private: llofstream mFile; }; -class LLReplayLogReal: public LLReplayLog, public boost::noncopyable +class LLReplayLogReal: public LLReplayLog { public: + LLReplayLogReal(const LLReplayLogReal&) = delete; + LLReplayLogReal& operator=(const LLReplayLogReal&) = delete; + LLReplayLogReal(LLError::ELevel level) : LLReplayLog(), - boost::noncopyable(), mOldSettings(LLError::saveAndResetSettings()), mRecorder(new RecordToTempFile()) { |
