UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AutomationTestExcludelist.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreMinimal.h"
7#include "Misc/SecureHash.h"
8
9#include "AutomationTestExcludelist.generated.h"
10
11UENUM()
13{
16 Vulkan,
17 Metal,
18 Null
19};
20
22{
23 switch (Option)
24 {
25 case ETEST_RHI_Options::DirectX11: return TEXT("DirectX 11");
26 case ETEST_RHI_Options::DirectX12: return TEXT("DirectX 12");
27 case ETEST_RHI_Options::Vulkan: return TEXT("Vulkan");
28 case ETEST_RHI_Options::Metal: return TEXT("Metal");
29 case ETEST_RHI_Options::Null: return TEXT("Null");
30 default: return TEXT("Unknown");
31 }
32}
33
34UENUM()
40
42{
43 switch (Option)
44 {
45 case ETEST_RHI_FeatureLevel_Options::SM5: return TEXT("SM5");
46 case ETEST_RHI_FeatureLevel_Options::SM6: return TEXT("SM6");
47 default: return TEXT("Unknown");
48 }
49}
50
51inline FString SetToString(const TSet<FName>& Set)
52{
53 if (Set.IsEmpty())
54 {
55 return TEXT("");
56 }
57
58 TArray<FString> List;
59 for (auto& Item : Set)
60 {
61 List.Add(Item.ToString());
62 }
63 List.Sort();
64
65 return FString::Join(List, TEXT(", "));
66}
67
68inline FString SetToShortString(const TSet<FName>& Set)
69{
70 if (Set.IsEmpty())
71 {
72 return TEXT("");
73 }
74
75 TArray<FString> List;
76 for (auto& Item : Set)
77 {
78 List.Add(Item.ToString());
79 }
80 if (List.Num() == 1)
81 {
82 return List[0];
83 }
84 List.Sort();
85
86 return List[0] + TEXT("+");
87}
88
89UCLASS(config = Engine, defaultconfig, MinimalAPI)
91{
93
94public:
95
96 UPROPERTY(Config)
97 TArray<FName> SupportedRHIs;
98
100 virtual void InitializeSettingsDefault() { }
101 virtual FString GetSectionName() { return TEXT("AutomationTestExcludelistSettings"); }
102
103};
104
105USTRUCT()
107{
109
110 template<typename EnumType>
112 {
113 LLM_SCOPE_BYNAME(TEXT("AutomationTest/Settings"));
114 static TSet<FName> NameSet;
115 if (NameSet.IsEmpty())
116 {
117 if constexpr (std::is_same_v<EnumType, ETEST_RHI_Options> || std::is_same_v<EnumType, ETEST_RHI_FeatureLevel_Options>)
118 {
120 int32 Num_Flags = Enum->NumEnums() - 1;
121 for (int32 i = 0; i < Num_Flags; i++)
122 {
123 NameSet.Add(*LexToString((EnumType)Enum->GetValueByIndex(i)));
124 }
125 }
126 }
127
128 return NameSet;
129 }
130
132 {
133 LLM_SCOPE_BYNAME(TEXT("AutomationTest/Settings"));
134 static TSet<FName> NameSet;
135 if (NameSet.IsEmpty())
136 {
137 for (auto Settings : AutomationTestPlatform::GetAllPlatformsSettings(UAutomationTestExcludelistSettings::StaticClass()))
138 {
139 NameSet.Append(CastChecked<UAutomationTestExcludelistSettings>(Settings)->SupportedRHIs);
140 }
141 NameSet.Sort([](const FName& A, const FName& B) { return A.ToString() < B.ToString(); });
142 }
143
144 return NameSet;
145 }
146
148 {
149 LLM_SCOPE_BYNAME(TEXT("AutomationTest/Settings"));
150 static TMap<FName, TSet<FName>> PlatformSettings;
151 if (PlatformSettings.IsEmpty())
152 {
153 for (auto Settings : AutomationTestPlatform::GetAllPlatformsSettings(UAutomationTestExcludelistSettings::StaticClass()))
154 {
155 PlatformSettings.Emplace(Settings->GetPlatformName()).Append(CastChecked<UAutomationTestExcludelistSettings>(Settings)->SupportedRHIs);
156 }
157 }
158
159 return PlatformSettings.FindOrAdd(Platform);
160 }
161
162#if WITH_EDITOR
163 AUTOMATIONTEST_API void UpdateReason(const FString& BeautifiedReason, const FString& TaskTrackerTicketId);
164#endif //WITH_EDITOR
165
166 /* Name of the target test */
167 UPROPERTY(VisibleAnywhere, Category = ExcludeTestOptions)
169
170 /* Reason to why the test is excluded */
171 UPROPERTY(EditAnywhere, Category = ExcludeTestOptions)
172 FName Reason;
173
174 /* Options to target specific RHI. No option means it should be applied to all RHIs */
175 UPROPERTY(EditAnywhere, Category = ExcludeTestOptions)
176 TSet<FName> RHIs;
177
178 /* Options to target specific platform. No option means it should be applied to all platforms */
179 UPROPERTY(EditAnywhere, Category = ExcludeTestOptions)
180 TSet<FName> Platforms;
181
182 /* Should the Reason be reported as a warning in the log */
183 UPROPERTY(EditAnywhere, Category = ExcludeTestOptions)
184 bool Warn = false;
185};
186
187USTRUCT()
189{
191
193
195 : Platforms(Options.Platforms)
196 , Test(Options.Test)
197 , Reason(Options.Reason)
198 , RHIs(Options.RHIs)
199 , Warn(Options.Warn)
200 { }
201
203 {
205 Options->Test = Test;
206 Options->Reason = Reason;
207 Options->Warn = Warn;
208 Options->RHIs = RHIs;
209 Options->Platforms = Platforms;
210
211 return Options;
212 }
213
214 /* Return the number of RHI types that needs to be matched for exclusion */
216 {
217 int8 Num = 0;
218 // Test mentions of each RHI option types
220 if (RHIs.Difference(AllRHI_OptionNames).Num() < RHIs.Num())
221 {
222 Num++;
223 }
224 static const TSet<FName> AllRHI_FeatureLevel_OptionNames = FAutomationTestExcludeOptions::GetAllRHIOptionNames<ETEST_RHI_FeatureLevel_Options>();
225 if (RHIs.Difference(AllRHI_FeatureLevel_OptionNames).Num() < RHIs.Num())
226 {
227 Num++;
228 }
229
230 return Num;
231 }
232
233 /* Determine if exclusion entry is propagated based on test name - used for management in test automation window */
234 void SetPropagation(const FString& ForTestName)
235 {
236 bIsPropagated = FullTestName != ForTestName.TrimStartAndEnd().ToLower();
237 }
238
239 /* Return true if the entry is not specific */
240 bool IsEmpty() const
241 {
242 return FullTestName.IsEmpty();
243 }
244
245 /* Reset entry to be un-specific */
246 void Reset()
247 {
248 FullTestName.Empty();
249 bIsPropagated = false;
250 }
251
252 /* Make the entry specific */
253 void Finalize();
254
255 /* Output string used to generate hash */
256 FString GetStringForHash() const;
257
258 /* Has conditional exclusion */
259 bool HasConditions() const
260 {
261 return !RHIs.IsEmpty() || !Platforms.IsEmpty();
262 }
263
264 /* Remove overlapping exclusion conditions, return true if at least one condition was removed */
266 {
267 if (!Entry.HasConditions())
268 {
269 return false;
270 }
271
272 bool GotRemoved = false;
273 int Length;
274 // Check RHIs
275 Length = RHIs.Num();
276 if (Length > 0)
277 {
278 RHIs = RHIs.Difference(Entry.RHIs);
279 GotRemoved = GotRemoved || Length != RHIs.Num();
280 }
281 // Check Platforms
282 Length = Platforms.Num();
283 if (Length > 0)
284 {
285 Platforms = Platforms.Difference(Entry.Platforms);
286 GotRemoved = GotRemoved || Length != Platforms.Num();
287 }
288
289 return GotRemoved;
290 }
291
292 /* Hold full test name/path */
294 /* Is the entry comes from propagation */
295 bool bIsPropagated = false;
296 /* Platforms to which the entry applies */
298
299 // Use FName instead of FString to read params from config that aren't wrapped with quotes
300
301 /* Hold the name of the target functional test map */
302 UPROPERTY(Config)
304
305 /* Hold the name of the target test - full test name is require here unless for functional tests */
306 UPROPERTY(Config)
308
309 /* Reason to why the test is excluded */
310 UPROPERTY(Config)
311 FName Reason;
312
313 /* Option to target specific RHI. Empty array means it should be applied to all RHI */
314 UPROPERTY(Config)
315 TSet<FName> RHIs;
316
317 /* Should the Reason be reported as a warning in the log */
318 UPROPERTY(Config)
319 bool Warn = false;
320};
321
322UCLASS(config = Engine, defaultconfig, MinimalAPI)
324{
326
327public:
328 void Reset();
329 void AddEntry(const FAutomationTestExcludelistEntry& Entry);
330 const TArray<FAutomationTestExcludelistEntry>& GetEntries() const;
331 FString GetTaskTrackerURLHashtag() const { return TaskTrackerURLHashtag; }
332 FString GetTaskTrackerURLBase() const { return TaskTrackerURLBase; }
333
334 void SaveConfig();
335
336 void LoadTaskTrackerProperties();
337
338protected:
339 virtual void PostInitProperties() override;
340 virtual void InitializeSettingsDefault() override;
341 virtual FString GetSectionName() override { return TEXT("AutomationTestExcludelist"); }
342
343private:
344 void UpdateHash(const FAutomationTestExcludelistEntry& Entry);
345
347 FString TaskTrackerURLHashtag;
348
350 FString TaskTrackerURLBase;
351
352 UPROPERTY(Config)
354
355 FString PlatformName;
357 FSHAHash EntriesHash;
359 FSHAHash SavedEntriesHash;
360};
361
362UCLASS(MinimalAPI)
364{
366
367public:
369
371
378 AUTOMATIONTEST_API void AddToExcludeTest(const FString& TestName, const FAutomationTestExcludelistEntry& ExcludelistEntry);
379
385 AUTOMATIONTEST_API void RemoveFromExcludeTest(const FString& TestName);
386
393 AUTOMATIONTEST_API bool IsTestExcluded(const FString& TestName) const;
394
404 AUTOMATIONTEST_API bool IsTestExcluded(const FString& TestName, const TSet<FName>& RHI, FName* OutReason, bool* OutWarn) const;
405
416 AUTOMATIONTEST_API bool IsTestExcluded(const FString& TestName, const FName& Platform, const TSet<FName>& RHI, FName* OutReason, bool* OutWarn) const;
417
424 AUTOMATIONTEST_API const FAutomationTestExcludelistEntry* GetExcludeTestEntry(const FString& TestName) const;
425
433 AUTOMATIONTEST_API const FAutomationTestExcludelistEntry* GetExcludeTestEntry(const FString& TestName, const TSet<FName>& RHI) const;
434
443 AUTOMATIONTEST_API const FAutomationTestExcludelistEntry* GetExcludeTestEntry(const FString& TestName, const FName& Platform, const TSet<FName>& RHI) const;
444
445 UE_DEPRECATED(5.4, "Please use GetConfigFilenameForEntry instead.")
447
454 AUTOMATIONTEST_API FString GetConfigFilenameForEntry(const FAutomationTestExcludelistEntry& Entry) const;
455
463 AUTOMATIONTEST_API FString GetConfigFilenameForEntry(const FAutomationTestExcludelistEntry& Entry, const FName& Platform) const;
464
470 AUTOMATIONTEST_API FString GetTaskTrackerURLBase() const;
471
477 AUTOMATIONTEST_API FString GetConfigTaskTrackerHashtag() const;
478
484 AUTOMATIONTEST_API FString GetTaskTrackerName() const;
485
491 AUTOMATIONTEST_API FString GetTaskTrackerTicketTag() const;
492
494 AUTOMATIONTEST_API void SaveToConfigs();
495
496 UE_DEPRECATED(5.4, "Please use SaveToConfigs instead.")
497 void SaveConfig() { SaveToConfigs(); }
498
499private:
501 void Initialize();
502
504 void LoadPlatformConfigs();
505
507 void PopulateEntries();
508
510 FString GetBeautifiedTaskTrackerTicketTagSuffix() const;
511
514
517
520};
ETEST_RHI_FeatureLevel_Options
Definition AutomationTestExcludelist.h:36
ETEST_RHI_Options
Definition AutomationTestExcludelist.h:13
FString SetToString(const TSet< FName > &Set)
Definition AutomationTestExcludelist.h:51
FString LexToString(ETEST_RHI_Options Option)
Definition AutomationTestExcludelist.h:21
FString SetToShortString(const TSet< FName > &Set)
Definition AutomationTestExcludelist.h:68
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)
Definition SharedPointer.h:1947
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define LLM_SCOPE_BYNAME(...)
Definition LowLevelMemTracker.h:1098
@ Num
Definition MetalRHIPrivate.h:234
FString GetConfigFilename(UObject *SourceObject)
Definition Obj.cpp:2276
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
Definition Engine.Build.cs:7
Definition NameTypes.h:617
Definition UnrealType.h:3087
Definition SecureHash.h:226
Definition RHI.Build.cs:8
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition AutomationTestExcludelist.h:324
virtual FString GetSectionName() override
Definition AutomationTestExcludelist.h:341
FString GetTaskTrackerURLBase() const
Definition AutomationTestExcludelist.h:332
FString GetTaskTrackerURLHashtag() const
Definition AutomationTestExcludelist.h:331
Definition AutomationTestExcludelist.h:91
virtual FString GetSectionName()
Definition AutomationTestExcludelist.h:101
Definition AutomationTestExcludelist.h:364
UAutomationTestExcludelist()
Definition AutomationTestExcludelist.h:368
Definition AutomationTestPlatform.h:12
Definition Class.h:2791
Definition Object.h:95
TArray< UAutomationTestPlatformSettings * > & GetAllPlatformsSettings(TSubclassOf< UAutomationTestPlatformSettings > SettingsClass)
Definition AutomationTestPlatform.cpp:48
Definition TestUtils.cpp:8
@ false
Definition radaudio_common.h:23
Definition AutomationTestExcludelist.h:107
static const TSet< FName > & GetPlatformRHIOptionNamesFromSettings(const FName &Platform)
Definition AutomationTestExcludelist.h:147
static const TSet< FName > & GetAllRHIOptionNamesFromSettings()
Definition AutomationTestExcludelist.h:131
static const TSet< FName > & GetAllRHIOptionNames()
Definition AutomationTestExcludelist.h:111
Definition AutomationTestExcludelist.h:189
FAutomationTestExcludelistEntry(const FAutomationTestExcludeOptions &Options)
Definition AutomationTestExcludelist.h:194
void SetPropagation(const FString &ForTestName)
Definition AutomationTestExcludelist.h:234
TSet< FName > Platforms
Definition AutomationTestExcludelist.h:297
FString FullTestName
Definition AutomationTestExcludelist.h:293
bool RemoveConditions(const FAutomationTestExcludelistEntry &Entry)
Definition AutomationTestExcludelist.h:265
TSet< FName > RHIs
Definition AutomationTestExcludelist.h:315
bool IsEmpty() const
Definition AutomationTestExcludelist.h:240
void Reset()
Definition AutomationTestExcludelist.h:246
TSharedPtr< FAutomationTestExcludeOptions > GetOptions() const
Definition AutomationTestExcludelist.h:202
bool HasConditions() const
Definition AutomationTestExcludelist.h:259
int8 NumRHIType() const
Definition AutomationTestExcludelist.h:215
Definition ObjectPtr.h:488