Files
UnrealEngineUWP/Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Classes/Net/UnitTestPackageMap.h
John Barrett 5d70d237c5 Merging from /usr/John_Barrett: Added UE4 UScript/Blueprint Virtual Machine reflection class, new stack tracing and log tracing code, fixed and verified fixes for many broken unit tests; full list of changes:
- Added class for allowing reflection of UObjects/UStructs/UProperties/etc., so that properties can be referenced dynamically by string, instead of statically
     - Allows game code to be referenced without direct linking
     - Allows unit tests to break without blocking compiles, allows easier backwards compatability, and easier archiving of old unit tests
     - Very useful for quick debug code; may tie it into the console with autocomplete at some stage
     - Example:
          FGuid* EntryItemGuidRef = (FGuid*)(void*)((FVMReflection(UnitPC.Get())->*"WorldInventory"->*"Inventory"->*ItemsPropName)["FFortItemEntry"][0]->*"ItemGuid")["FGuid"];

- Added a new stack tracing manager, which can be used by unit tests through GTraceManager, or through the whole engine with the StackTrace console command (see UnitTestManager.cpp for full command list)
     - Allows conditional/filtered stack traces to be inserted anywhere into the code (categorized by name), for debugging purposes
     - Once-off stack trace example:
          GEngine->Exec(NULL, TEXT("StackTrace TraceName"));
     - Multiple/accumulated stack trace examples:
          GEngine->Exec(NULL, TEXT("StackTrace TraceName Add -Log"));
          GEngine->Exec(NULL, TEXT("StackTrace TraceName Dump"));

- Added a log hook for the stack tracing manager, and a LogTrace command, which allows stack traces to be dumped whenever a specific log is encountered (see UnitTestManager.cpp for full command list)
     - Example, for debugging the cause of a disconnect:
          "LogTrace AddPartial UNetConnection::Close: Name: IpConnection_"

- Added -UnitTestCap=x commandline parameter, to limit the maximum number of unit tests that can run at once

- Added AllowedClientActors/AllowedClientRPCs to ClientUnitTest, to allow better whitelisting of accepted actors/RPC's

- Fixed many broken unit tests

- Adjusted actor replication blocking hook, to allow blocking of all instances of actor replication, instead of just actor channels

- Made console command results, auto-focus the Console tab, if the current tab won't display the results

- Fixed blocking automation testing, when the current game project doesn't support unit tests (doesn't have a unit test environment setup)

- Disable recursive killing of unit test child processes, while TerminateProc has a bug that kills all killable Windows processes

- Updated crash callstack detection

[CL 2565239 by John Barrett in Main branch]
2015-05-26 13:35:34 -04:00

38 lines
1.1 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "UnitTestPackageMap.generated.h"
/**
* Package map override, for blocking the creation of actor channels for specific actors (by detecting the actor class being created)
*/
UCLASS(transient)
class UUnitTestPackageMap : public UPackageMapClient
{
GENERATED_UCLASS_BODY()
#if TARGET_UE4_CL < CL_DEPRECATENEW
UUnitTestPackageMap(const FObjectInitializer& ObjectInitializer, UNetConnection* InConnection,
TSharedPtr<FNetGUIDCache> InNetGUIDCache)
: UPackageMapClient(ObjectInitializer, InConnection, InNetGUIDCache)
, bWithinSerializeNewActor(false)
, bPendingArchetypeSpawn(false)
{
}
#endif
virtual bool SerializeObject(FArchive& Ar, UClass* Class, UObject*& Obj, FNetworkGUID* OutNetGUID=NULL) override;
virtual bool SerializeNewActor(FArchive& Ar, class UActorChannel* Channel, class AActor*& Actor) override;
public:
/** Whether or not we are currently within execution of SerializeNewActor */
bool bWithinSerializeNewActor;
/** Whether or not SerializeNewActor is about to spawn an actor, from an archetype */
bool bPendingArchetypeSpawn;
};