summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
diff options
context:
space:
mode:
authorRye <rye@alchemyviewer.org>2025-12-11 17:41:55 -0500
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-12-15 19:02:17 +0200
commita1eee717de59c0b1f514cedb7a7614d4b0a62e65 (patch)
treefa456591d01bcb0ff98a6ee2ab193af734265d44 /indra/llcommon/tests
parent3b88739957d8b0d5072646e571d27b743e68fe2e (diff)
Restore multiple disabled tests in llcharacter and newview
Clean up dead test files from llcommon and newview Signed-off-by: Rye <rye@alchemyviewer.org>
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r--indra/llcommon/tests/llallocator_heap_profile_test.cpp144
-rw-r--r--indra/llcommon/tests/llallocator_test.cpp80
-rw-r--r--indra/llcommon/tests/lllazy_test.cpp239
-rw-r--r--indra/llcommon/tests/llmemtype_test.cpp117
4 files changed, 0 insertions, 580 deletions
diff --git a/indra/llcommon/tests/llallocator_heap_profile_test.cpp b/indra/llcommon/tests/llallocator_heap_profile_test.cpp
deleted file mode 100644
index da8b54ffc0..0000000000
--- a/indra/llcommon/tests/llallocator_heap_profile_test.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * @file llallocator_heap_profile_test.cpp
- * @author Brad Kittenbrink
- * @date 2008-02-
- * @brief Test for llallocator_heap_profile.cpp.
- *
- * $LicenseInfo:firstyear=2009&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 "../llallocator_heap_profile.h"
-#include "../test/lltut.h"
-
-namespace tut
-{
- struct llallocator_heap_profile_data
- {
- LLAllocatorHeapProfile prof;
-
- static char const * const sample_win_profile;
- // *TODO - get test output from mac/linux tcmalloc
- static char const * const sample_mac_profile;
- static char const * const sample_lin_profile;
-
- static char const * const crash_testcase;
- };
- typedef test_group<llallocator_heap_profile_data> factory;
- typedef factory::object object;
-}
-namespace
-{
- tut::factory llallocator_heap_profile_test_factory("LLAllocatorHeapProfile");
-}
-
-namespace tut
-{
- template<> template<>
- void object::test<1>()
- {
- prof.parse(sample_win_profile);
-
- ensure_equals("count lines", prof.mLines.size() , 5);
- ensure_equals("alloc counts", prof.mLines[0].mLiveCount, 2131854U);
- ensure_equals("alloc counts", prof.mLines[0].mLiveSize, 2245710106ULL);
- ensure_equals("alloc counts", prof.mLines[0].mTotalCount, 14069198U);
- ensure_equals("alloc counts", prof.mLines[0].mTotalSize, 4295177308ULL);
- ensure_equals("count markers", prof.mLines[0].mTrace.size(), 0);
- ensure_equals("count markers", prof.mLines[1].mTrace.size(), 0);
- ensure_equals("count markers", prof.mLines[2].mTrace.size(), 4);
- ensure_equals("count markers", prof.mLines[3].mTrace.size(), 6);
- ensure_equals("count markers", prof.mLines[4].mTrace.size(), 7);
-
- //prof.dump(std::cout);
- }
-
- template<> template<>
- void object::test<2>()
- {
- prof.parse(crash_testcase);
-
- ensure_equals("count lines", prof.mLines.size(), 2);
- ensure_equals("alloc counts", prof.mLines[0].mLiveCount, 3U);
- ensure_equals("alloc counts", prof.mLines[0].mLiveSize, 1049652ULL);
- ensure_equals("alloc counts", prof.mLines[0].mTotalCount, 8U);
- ensure_equals("alloc counts", prof.mLines[0].mTotalSize, 1049748ULL);
- ensure_equals("count markers", prof.mLines[0].mTrace.size(), 0);
- ensure_equals("count markers", prof.mLines[1].mTrace.size(), 0);
-
- //prof.dump(std::cout);
- }
-
- template<> template<>
- void object::test<3>()
- {
- // test that we don't crash on edge case data
- prof.parse("");
- ensure("emtpy on error", prof.mLines.empty());
-
- prof.parse("heap profile:");
- ensure("emtpy on error", prof.mLines.empty());
- }
-
-char const * const llallocator_heap_profile_data::sample_win_profile =
-"heap profile: 2131854: 2245710106 [14069198: 4295177308] @\n"
-"308592: 1073398388 [966564: 1280998739] @\n"
-"462651: 375969538 [1177377: 753561247] @ 2 3 6 1\n"
-"314744: 206611283 [2008722: 570934755] @ 2 3 3 7 21 32\n"
-"277152: 82862770 [621961: 168503640] @ 2 3 3 7 21 32 87\n"
-"\n"
-"MAPPED_LIBRARIES:\n"
-"00400000-02681000 r-xp 00000000 00:00 0 c:\\proj\\tcmalloc-eval-9\\indra\\build-vc80\\newview\\RelWithDebInfo\\secondlife-bin.exe\n"
-"77280000-773a7000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\ntdll.dll\n"
-"76df0000-76ecb000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\kernel32.dll\n"
-"76000000-76073000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\comdlg32.dll\n"
-"75ee0000-75f8a000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\msvcrt.dll\n"
-"76c30000-76c88000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\SHLWAPI.dll\n"
-"75f90000-75fdb000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\GDI32.dll\n"
-"77420000-774bd000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\USER32.dll\n"
-"75e10000-75ed6000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\ADVAPI32.dll\n"
-"75b00000-75bc2000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\RPCRT4.dll\n"
-"72ca0000-72d25000 r-xp 00000000 00:00 0 C:\\Windows\\WinSxS\\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6001.18000_none_886786f450a74a05\\COMCTL32.dll\n"
-"76120000-76c30000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\SHELL32.dll\n"
-"71ce0000-71d13000 r-xp 00000000 00:00 0 C:\\Windows\\system32\\DINPUT8.dll\n";
-
-
-char const * const llallocator_heap_profile_data::crash_testcase =
-"heap profile: 3: 1049652 [ 8: 1049748] @\n"
-" 3: 1049652 [ 8: 1049748] @\n"
-"\n"
-"MAPPED_LIBRARIES:\n"
-"00400000-004d5000 r-xp 00000000 00:00 0 c:\\code\\linden\\tcmalloc\\indra\\build-vc80\\llcommon\\RelWithDebInfo\\llallocator_test.exe\n"
-"7c900000-7c9af000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\ntdll.dll\n"
-"7c800000-7c8f6000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\kernel32.dll\n"
-"77dd0000-77e6b000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\ADVAPI32.dll\n"
-"77e70000-77f02000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\RPCRT4.dll\n"
-"77fe0000-77ff1000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\Secur32.dll\n"
-"71ab0000-71ac7000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\WS2_32.dll\n"
-"77c10000-77c68000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\msvcrt.dll\n"
-"71aa0000-71aa8000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\WS2HELP.dll\n"
-"76bf0000-76bfb000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\PSAPI.DLL\n"
-"5b860000-5b8b5000 r-xp 00000000 00:00 0 C:\\WINDOWS\\system32\\NETAPI32.dll\n"
-"10000000-10041000 r-xp 00000000 00:00 0 c:\\code\\linden\\tcmalloc\\indra\\build-vc80\\llcommon\\RelWithDebInfo\\libtcmalloc_minimal.dll\n"
-"7c420000-7c4a7000 r-xp 00000000 00:00 0 C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\\MSVCP80.dll\n"
-"78130000-781cb000 r-xp 00000000 00:00 0 C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\\MSVCR80.dll\n";
-
-}
diff --git a/indra/llcommon/tests/llallocator_test.cpp b/indra/llcommon/tests/llallocator_test.cpp
deleted file mode 100644
index a7573641c7..0000000000
--- a/indra/llcommon/tests/llallocator_test.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * @file llallocator_test.cpp
- * @author Brad Kittenbrink
- * @date 2008-02-
- * @brief Test for llallocator.cpp.
- *
- * $LicenseInfo:firstyear=2009&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 "../llallocator.h"
-#include "../test/lltut.h"
-
-namespace tut
-{
- struct llallocator_data
- {
- LLAllocator llallocator;
- };
- typedef test_group<llallocator_data> factory;
- typedef factory::object object;
-}
-namespace
-{
- tut::factory llallocator_test_factory("LLAllocator");
-}
-
-namespace tut
-{
- template<> template<>
- void object::test<1>()
- {
- llallocator.setProfilingEnabled(false);
- ensure("Profiler disable", !llallocator.isProfiling());
- }
-
-#if LL_USE_TCMALLOC
- template<> template<>
- void object::test<2>()
- {
- llallocator.setProfilingEnabled(true);
- ensure("Profiler enable", llallocator.isProfiling());
- }
-
- template <> template <>
- void object::test<3>()
- {
- llallocator.setProfilingEnabled(true);
-
- char * test_alloc = new char[1024];
-
- llallocator.getProfile();
-
- delete [] test_alloc;
-
- llallocator.getProfile();
-
- // *NOTE - this test isn't ensuring anything right now other than no
- // exceptions are thrown.
- }
-#endif // LL_USE_TCMALLOC
-};
diff --git a/indra/llcommon/tests/lllazy_test.cpp b/indra/llcommon/tests/lllazy_test.cpp
deleted file mode 100644
index 923fe952a9..0000000000
--- a/indra/llcommon/tests/lllazy_test.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * @file lllazy_test.cpp
- * @author Nat Goodspeed
- * @date 2009-01-28
- * @brief Tests of lllazy.h.
- *
- * $LicenseInfo:firstyear=2009&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$
- */
-
-// Precompiled header
-#include "linden_common.h"
-// associated header
-#include "lllazy.h"
-// STL headers
-#include <iostream>
-// std headers
-// external library headers
-#include <boost/lambda/construct.hpp>
-#include <boost/lambda/bind.hpp>
-// other Linden headers
-#include "../test/lltut.h"
-#include "../test/catch_and_store_what_in.h"
-
-namespace bll = boost::lambda;
-
-/*****************************************************************************
-* Test classes
-*****************************************************************************/
-
-// Let's say that because of its many external dependencies, YuckyFoo is very
-// hard to instantiate in a test harness.
-class YuckyFoo
-{
-public:
- virtual ~YuckyFoo() {}
- virtual std::string whoami() const { return "YuckyFoo"; }
-};
-
-// Let's further suppose that YuckyBar is another hard-to-instantiate class.
-class YuckyBar
-{
-public:
- YuckyBar(const std::string& which):
- mWhich(which)
- {}
- virtual ~YuckyBar() {}
-
- virtual std::string identity() const { return std::string("YuckyBar(") + mWhich + ")"; }
-
-private:
- const std::string mWhich;
-};
-
-// Pretend that this class would be tough to test because, up until we started
-// trying to test it, it contained instances of both YuckyFoo and YuckyBar.
-// Now we've refactored so it contains LLLazy<YuckyFoo> and LLLazy<YuckyBar>.
-// More than that, it contains them by virtue of deriving from
-// LLLazyBase<YuckyFoo> and LLLazyBase<YuckyBar>.
-// We postulate two different LLLazyBases because, with only one, you need not
-// specify *which* get()/set() method you're talking about. That's a simpler
-// case.
-class NeedsTesting: public LLLazyBase<YuckyFoo>, public LLLazyBase<YuckyBar>
-{
-public:
- NeedsTesting():
- // mYuckyBar("RealYuckyBar")
- LLLazyBase<YuckyBar>(bll::bind(bll::new_ptr<YuckyBar>(), "RealYuckyBar"))
- {}
- virtual ~NeedsTesting() {}
-
- virtual std::string describe() const
- {
- return std::string("NeedsTesting(") + getLazy<YuckyFoo>(this).whoami() + ", " +
- getLazy<YuckyBar>(this).identity() + ")";
- }
-
-private:
- // These instance members were moved to LLLazyBases:
- // YuckyFoo mYuckyFoo;
- // YuckyBar mYuckyBar;
-};
-
-// Fake up a test YuckyFoo class
-class TestFoo: public YuckyFoo
-{
-public:
- virtual std::string whoami() const { return "TestFoo"; }
-};
-
-// and a test YuckyBar
-class TestBar: public YuckyBar
-{
-public:
- TestBar(const std::string& which): YuckyBar(which) {}
- virtual std::string identity() const
- {
- return std::string("TestBar(") + YuckyBar::identity() + ")";
- }
-};
-
-// So here's a test subclass of NeedsTesting that uses TestFoo and TestBar
-// instead of YuckyFoo and YuckyBar.
-class TestNeedsTesting: public NeedsTesting
-{
-public:
- TestNeedsTesting()
- {
- // Exercise setLazy(T*)
- setLazy<YuckyFoo>(this, new TestFoo());
- // Exercise setLazy(Factory)
- setLazy<YuckyBar>(this, bll::bind(bll::new_ptr<TestBar>(), "TestYuckyBar"));
- }
-
- virtual std::string describe() const
- {
- return std::string("TestNeedsTesting(") + NeedsTesting::describe() + ")";
- }
-
- void toolate()
- {
- setLazy<YuckyFoo>(this, new TestFoo());
- }
-};
-
-// This class tests having an explicit LLLazy<T> instance as a named member,
-// rather than deriving from LLLazyBase<T>.
-class LazyMember
-{
-public:
- YuckyFoo& getYuckyFoo() { return *mYuckyFoo; }
- std::string whoisit() const { return mYuckyFoo->whoami(); }
-
-protected:
- LLLazy<YuckyFoo> mYuckyFoo;
-};
-
-// This is a test subclass of the above, dynamically replacing the
-// LLLazy<YuckyFoo> member.
-class TestLazyMember: public LazyMember
-{
-public:
- // use factory setter
- TestLazyMember()
- {
- mYuckyFoo.set(bll::new_ptr<TestFoo>());
- }
-
- // use instance setter
- TestLazyMember(YuckyFoo* instance)
- {
- mYuckyFoo.set(instance);
- }
-};
-
-/*****************************************************************************
-* TUT
-*****************************************************************************/
-namespace tut
-{
- struct lllazy_data
- {
- };
- typedef test_group<lllazy_data> lllazy_group;
- typedef lllazy_group::object lllazy_object;
- lllazy_group lllazygrp("lllazy");
-
- template<> template<>
- void lllazy_object::test<1>()
- {
- // Instantiate an official one, just because we can
- NeedsTesting nt;
- // and a test one
- TestNeedsTesting tnt;
-// std::cout << nt.describe() << '\n';
- ensure_equals(nt.describe(), "NeedsTesting(YuckyFoo, YuckyBar(RealYuckyBar))");
-// std::cout << tnt.describe() << '\n';
- ensure_equals(tnt.describe(),
- "TestNeedsTesting(NeedsTesting(TestFoo, TestBar(YuckyBar(TestYuckyBar))))");
- }
-
- template<> template<>
- void lllazy_object::test<2>()
- {
- TestNeedsTesting tnt;
- std::string threw = catch_what<LLLazyCommon::InstanceChange>([&tnt](){
- tnt.toolate();
- });
- ensure_contains("InstanceChange exception", threw, "replace LLLazy instance");
- }
-
- template<> template<>
- void lllazy_object::test<3>()
- {
- {
- LazyMember lm;
- // operator*() on-demand instantiation
- ensure_equals(lm.getYuckyFoo().whoami(), "YuckyFoo");
- }
- {
- LazyMember lm;
- // operator->() on-demand instantiation
- ensure_equals(lm.whoisit(), "YuckyFoo");
- }
- }
-
- template<> template<>
- void lllazy_object::test<4>()
- {
- {
- // factory setter
- TestLazyMember tlm;
- ensure_equals(tlm.whoisit(), "TestFoo");
- }
- {
- // instance setter
- TestLazyMember tlm(new TestFoo());
- ensure_equals(tlm.whoisit(), "TestFoo");
- }
- }
-} // namespace tut
diff --git a/indra/llcommon/tests/llmemtype_test.cpp b/indra/llcommon/tests/llmemtype_test.cpp
deleted file mode 100644
index 2d64d342ae..0000000000
--- a/indra/llcommon/tests/llmemtype_test.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * @file llmemtype_test.cpp
- * @author Palmer Truelson
- * @date 2008-03-
- * @brief Test for llmemtype.cpp.
- *
- * $LicenseInfo:firstyear=2009&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 "../llmemtype.h"
-#include "../test/lltut.h"
-#include "../llallocator.h"
-
-
-#include <stack>
-
-std::stack<S32> memTypeStack;
-
-void LLAllocator::pushMemType(S32 i)
-{
- memTypeStack.push(i);
-}
-
-S32 LLAllocator::popMemType(void)
-{
- S32 ret = memTypeStack.top();
- memTypeStack.pop();
- return ret;
-}
-
-namespace tut
-{
- struct llmemtype_data
- {
- };
-
- typedef test_group<llmemtype_data> factory;
- typedef factory::object object;
-}
-namespace
-{
- tut::factory llmemtype_test_factory("LLMemType");
-}
-
-namespace tut
-{
- template<> template<>
- void object::test<1>()
- {
- ensure("Simplest test ever", true);
- }
-
- // test with no scripts
- template<> template<>
- void object::test<2>()
- {
- {
- LLMemType m1(LLMemType::MTYPE_INIT);
- }
- ensure("Test that you can construct and destruct the mem type");
- }
-
- // test creation and stack testing
- template<> template<>
- void object::test<3>()
- {
- {
- ensure("Test that creation and destruction properly inc/dec the stack");
- ensure_equals(memTypeStack.size(), 0);
- {
- LLMemType m1(LLMemType::MTYPE_INIT);
- ensure_equals(memTypeStack.size(), 1);
- LLMemType m2(LLMemType::MTYPE_STARTUP);
- ensure_equals(memTypeStack.size(), 2);
- }
- ensure_equals(memTypeStack.size(), 0);
- }
- }
-
- // test with no scripts
- template<> template<>
- void object::test<4>()
- {
- // catch the begining and end
- std::string test_name = LLMemType::getNameFromID(LLMemType::MTYPE_INIT.mID);
- ensure_equals("Init name", test_name, "Init");
-
- std::string test_name2 = LLMemType::getNameFromID(LLMemType::MTYPE_VOLUME.mID);
- ensure_equals("Volume name", test_name2, "Volume");
-
- std::string test_name3 = LLMemType::getNameFromID(LLMemType::MTYPE_OTHER.mID);
- ensure_equals("Other name", test_name3, "Other");
-
- std::string test_name4 = LLMemType::getNameFromID(-1);
- ensure_equals("Invalid name", test_name4, "INVALID");
- }
-
-};