ABTest regression it does not reset back to first argument when stopping

[Image Removed]

When stopping the abtest command it mentions that it’s going to run the A command again.

The code calls a function to switch the command back to the first parameter but since that function doesn’t execute the command it doesn’t change anything.

This possibly has unintended consequences due to changes in cvars leaking through to other tests that happen afterwards.

From the looks of it, it seems to come from this change when moving the ABTest system into it’s own cpp file

https://github.com/EpicGames/UnrealEngine/commit/2547171a65ba9b50a9d8d2cf294d4f18e9b6badb

I have a fix for it, since the TickAndGetCommand function runs each frame I just added a new variable bABTestStopping to the headed and added this code

`const TCHAR* FABTest::TickAndGetCommand()
{
const TCHAR* OutCommand = nullptr;

static double LastTime = 0;
#ifdef ABTESTFIX // Fix for ABTest not returning back to A command
if (bABTestStopping) {
OutCommand = SwitchTest(0);
bABTestStopping = false;
}
else
#endif
if (bABTestActive && RemainingCoolDown)
…`turning on the new flag

void FABTest::Stop() { if (bABTestActive) { ABTEST_LOG(TEXT("Running 'A' console command and stopping test.")); SwitchTest(0); bABTestActive = false; #ifdef ABTESTFIX // Fix for ABTest not returning back to A command bABTestStopping = true; #endifallowing the SwitchTest function to return the command string

`const TCHAR* FABTest::SwitchTest(int32 Index)
{
RemainingCoolDown = CoolDown;
CurrentTest = Index;
RemainingTrial = Stream.RandRange(MinFramesPerTrial, MinFramesPerTrial * 3);
check(RemainingTrial);

if (!bABScopeTestActive
#ifdef ABTESTFIX // Fix for ABTest not returning back to A command
|| bABTestStopping
#endif
)`

Hey there,

Thanks for bringing this to our attention. Please feel free to submit a PR for this issue, and I can look at it getting reviewed and submitted!

Kind regards,

Julian

Hey Julian, Thanks for getting back to me.

https://github.com/EpicGames/UnrealEngine/commit/2547171a65ba9b50a9d8d2cf294d4f18e9b6badb

I made the pull request on github if that works for you. Thanks for taking a look.

Sorry I pasted the wrong link last night.. https://github.com/EpicGames/UnrealEngine/pull/13452