diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-06-14 21:38:00 +0300 | 
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-06-14 21:38:00 +0300 | 
| commit | ba6ac70596d9f866e15983a4e2fc1d4f3d82b2ec (patch) | |
| tree | be9eb80e356af346c17852c116ed481a7d911277 /indra/test | |
| parent | f5e2708a0fc4e08d3d0a5dc393bbd4bac09e1c55 (diff) | |
| parent | c4fc76efefd12c7cb1224dc8a748da2958f4a7f0 (diff) | |
Merge branch 'release/maint-b' into marchcat/b-merge
# Conflicts:
#	.github/workflows/build.yaml
#	indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
#	indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
#	indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
#	indra/newview/llfilepicker.cpp
Diffstat (limited to 'indra/test')
| -rw-r--r-- | indra/test/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/test/test.cpp | 86 | 
2 files changed, 53 insertions, 35 deletions
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index 4a0a8716c4..3dcddf9dc2 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -9,7 +9,6 @@ include(Linking)  include(Tut)  include(LLAddBuildTest)  include(bugsplat) -include(GoogleMock)  set(test_SOURCE_FILES      io.cpp @@ -65,7 +64,6 @@ target_link_libraries(lltest          llxml          llcommon          llcorehttp -        ll::googlemock          )  if (WINDOWS) diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 61a4eb07c5..cc2c130072 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -36,6 +36,7 @@  #include "linden_common.h"  #include "llerrorcontrol.h" +#include "llexception.h"  #include "lltut.h"  #include "chained_callback.h"  #include "stringize.h" @@ -53,11 +54,6 @@  #   include "ctype_workaround.h"  #endif -#ifndef LL_WINDOWS -#include <gmock/gmock.h> -#include <gtest/gtest.h> -#endif -  #if LL_MSVC  #pragma warning (push)  #pragma warning (disable : 4702) // warning C4702: unreachable code @@ -68,11 +64,6 @@  #pragma warning (pop)  #endif -#include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/make_shared.hpp> -#include <boost/foreach.hpp> -  #include <fstream>  void wouldHaveCrashed(const std::string& message); @@ -181,10 +172,6 @@ public:      LLTestCallback(bool verbose_mode, std::ostream *stream,                     std::shared_ptr<LLReplayLog> replayer) :          mVerboseMode(verbose_mode), -        mTotalTests(0), -        mPassedTests(0), -        mFailedTests(0), -        mSkippedTests(0),          // By default, capture a shared_ptr to std::cout, with a no-op "deleter"          // so that destroying the shared_ptr makes no attempt to delete std::cout.          mStream(std::shared_ptr<std::ostream>(&std::cout, [](std::ostream*){})), @@ -220,6 +207,8 @@ public:      virtual void group_started(const std::string& name) {          LL_INFOS("TestRunner")<<"Unit test group_started name=" << name << LL_ENDL;          *mStream << "Unit test group_started name=" << name << std::endl; +        mGroup = name; +        mGroupTests = 0;          super::group_started(name);      } @@ -232,6 +221,7 @@ public:      virtual void test_completed(const tut::test_result& tr)      {          ++mTotalTests; +        ++mGroupTests;          // If this test failed, dump requested log messages BEFORE stating the          // test result. @@ -319,12 +309,15 @@ public:          super::run_completed();      } +    std::string mGroup; +    int mGroupTests{ 0 }; +  protected: -    bool mVerboseMode; -    int mTotalTests; -    int mPassedTests; -    int mFailedTests; -    int mSkippedTests; +    bool mVerboseMode{ false }; +    int mTotalTests{ 0 }; +    int mPassedTests{ 0 }; +    int mFailedTests{ 0 }; +    int mSkippedTests{ 0 };      std::shared_ptr<std::ostream> mStream;      std::shared_ptr<LLReplayLog> mReplayer;  }; @@ -522,12 +515,6 @@ static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL;  int main(int argc, char **argv)  { -    // The following line must be executed to initialize Google Mock -    // (and Google Test) before running the tests. -#ifndef LL_WINDOWS -    ::testing::InitGoogleMock(&argc, argv); -#endif -      ll_init_apr();      apr_getopt_t* os = NULL;      if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) @@ -658,14 +645,47 @@ int main(int argc, char **argv)      // a chained_callback subclass must be linked with previous      mycallback->link(); -    if(test_group.empty()) -    { -        tut::runner.get().run_tests(); -    } -    else -    { -        tut::runner.get().run_tests(test_group); -    } +    LL::seh::catcher( +        // __try +        [test_group] +        { +            if(test_group.empty()) +            { +                tut::runner.get().run_tests(); +            } +            else +            { +                tut::runner.get().run_tests(test_group); +            } +        }, +        // __except +        [mycallback](U32 code, const std::string& /*stacktrace*/) +        { +            static std::map<U32, const char*> codes = { +                { 0xC0000005, "Access Violation" }, +                { 0xC00000FD, "Stack Overflow" }, +                // ... continue filling in as desired +            }; + +            auto found{ codes.find(code) }; +            const char* name = ((found == codes.end())? "unknown" : found->second); +            auto msg{ stringize("test threw ", std::hex, code, " (", name, ")") }; + +            // Instead of bombing the whole test run, report this as a test +            // failure. Arguably, catching structured exceptions should be +            // hacked into TUT itself. +            mycallback->test_completed(tut::test_result( +                mycallback->mGroup, +                mycallback->mGroupTests+1, // test within group +                "unknown",                 // test name +                tut::test_result::ex,      // result: exception +                // we don't have to throw this exception subclass to use it to +                // populate the test_result struct +                Windows_SEH_exception(msg))); +            // we've left the TUT framework -- finish up by hand +            mycallback->group_completed(mycallback->mGroup); +            mycallback->run_completed(); +        });      bool success = (mycallback->getFailedTests() == 0);  | 
