Skip to content

Commit

Permalink
#3591 More test coverage for crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
akleshchev committed Feb 25, 2025
1 parent 1754aea commit a845f22
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
21 changes: 21 additions & 0 deletions indra/newview/llappviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5611,6 +5611,27 @@ void LLAppViewer::forceErrorCoroutineCrash()
LLCoros::instance().launch("LLAppViewer::crashyCoro", [] {throw LLException("A deliberate crash from LLCoros"); });
}

void LLAppViewer::forceErrorCoroprocedureCrash()
{
LL_WARNS() << "Forcing a crash in LLCoprocedureManager" << LL_ENDL;
LLCoprocedureManager::instance().enqueueCoprocedure("Upload", "DeliberateCrash",
[](LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t&, const LLUUID&)
{
LL_WARNS() << "Forcing a deliberate bad memory access from LLCoprocedureManager" << LL_ENDL;
S32* crash = NULL;
*crash = 0xDEADBEEF;
});
}

void LLAppViewer::forceErrorWorkQueueCrash()
{
LL::WorkQueue::ptr_t workqueue = LL::WorkQueue::getInstance("General");
if (workqueue)
{
workqueue->post([]() { throw LLException("This is a deliberate crash from General Queue"); });
}
}

void LLAppViewer::forceErrorThreadCrash()
{
class LLCrashTestThread : public LLThread
Expand Down
2 changes: 2 additions & 0 deletions indra/newview/llappviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class LLAppViewer : public LLApp
virtual void forceErrorOSSpecificException();
virtual void forceErrorDriverCrash();
virtual void forceErrorCoroutineCrash();
virtual void forceErrorCoroprocedureCrash();
virtual void forceErrorWorkQueueCrash();
virtual void forceErrorThreadCrash();

// The list is found in app_settings/settings_files.xml
Expand Down
32 changes: 32 additions & 0 deletions indra/newview/llviewermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ void force_error_software_exception();
void force_error_os_exception();
void force_error_driver_crash();
void force_error_coroutine_crash();
void force_error_coroprocedure_crash();
void force_error_work_queue_crash();
void force_error_thread_crash();

void handle_force_delete();
Expand Down Expand Up @@ -2634,6 +2636,24 @@ class LLAdvancedForceErrorCoroutineCrash : public view_listener_t
}
};

class LLAdvancedForceErrorCoroprocedureCrash : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
force_error_coroprocedure_crash();
return true;
}
};

class LLAdvancedForceErrorWorkQueueCrash : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
force_error_work_queue_crash();
return true;
}
};

class LLAdvancedForceErrorThreadCrash : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
Expand Down Expand Up @@ -8657,6 +8677,16 @@ void force_error_coroutine_crash()
LLAppViewer::instance()->forceErrorCoroutineCrash();
}

void force_error_coroprocedure_crash()
{
LLAppViewer::instance()->forceErrorCoroprocedureCrash();
}

void force_error_work_queue_crash()
{
LLAppViewer::instance()->forceErrorWorkQueueCrash();
}

void force_error_thread_crash()
{
LLAppViewer::instance()->forceErrorThreadCrash();
Expand Down Expand Up @@ -9861,6 +9891,8 @@ void initialize_menus()
view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareExceptionCoro(), "Advanced.ForceErrorSoftwareExceptionCoro");
view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDriverCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorCoroutineCrash(), "Advanced.ForceErrorCoroutineCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorCoroprocedureCrash(), "Advanced.ForceErrorCoroprocedureCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorWorkQueueCrash(), "Advanced.ForceErrorWorkQueueCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorThreadCrash(), "Advanced.ForceErrorThreadCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorDisconnectViewer(), "Advanced.ForceErrorDisconnectViewer");

Expand Down
14 changes: 13 additions & 1 deletion indra/newview/skins/default/xui/en/menu_viewer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2788,13 +2788,25 @@ function="World.EnvPreset"
function="Advanced.ForceErrorOSException" />
<menu_item_call.on_visible
function="Advanced.EnableErrorOSException" />
</menu_item_call>
</menu_item_call>
<menu_item_call
label="Force a Crash in a Coroutine"
name="Force a Crash in a Coroutine">
<menu_item_call.on_click
function="Advanced.ForceErrorCoroutineCrash" />
</menu_item_call>
<menu_item_call
label="Force a Crash in a Coroprocedure"
name="Force a Crash in a Coroprocedure">
<menu_item_call.on_click
function="Advanced.ForceErrorCoroprocedureCrash" />
</menu_item_call>
<menu_item_call
label="Force a Crash in a Work Queue"
name="Force a Crash in a Work Queue">
<menu_item_call.on_click
function="Advanced.ForceErrorWorkQueueCrash" />
</menu_item_call>
<menu_item_call
label="Force a Crash in a Thread"
name="Force a Crash in a Thread">
Expand Down

0 comments on commit a845f22

Please sign in to comment.