akaaafk commited on
Commit
e08dd36
·
verified ·
1 Parent(s): 66cfe28

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs +25 -0
  2. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta +11 -0
  3. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs +36 -0
  4. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta +11 -0
  5. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs +359 -0
  6. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta +11 -0
  7. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs +75 -0
  8. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta +11 -0
  9. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs +98 -0
  10. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta +11 -0
  11. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs +34 -0
  12. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs.meta +11 -0
  13. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs +10 -0
  14. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs.meta +11 -0
  15. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs +13 -0
  16. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs.meta +11 -0
  17. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs +4 -0
  18. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs.meta +11 -0
  19. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs +127 -0
  20. benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs.meta +11 -0
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+ using NUnit.Framework.Interfaces;
3
+ using NUnit.Framework.Internal.Filters;
4
+
5
+ namespace UnityEngine.TestRunner.NUnitExtensions.Filters
6
+ {
7
+ internal class AssemblyNameFilter : ValueMatchFilter
8
+ {
9
+ public AssemblyNameFilter(string assemblyName) : base(assemblyName) {}
10
+
11
+ public override bool Match(ITest test)
12
+ {
13
+ string assemblyName = string.Empty;
14
+ //Assembly fullname is in the format "Assembly-name, meta data ...", so extract the name by looking for the comma
15
+ if (test.TypeInfo != null && test.TypeInfo.Assembly != null && test.TypeInfo.FullName != null)
16
+ assemblyName = test.TypeInfo.Assembly.FullName.Substring(0, test.TypeInfo.Assembly.FullName.IndexOf(',')).TrimEnd(',');
17
+ return ExpectedValue.Equals(assemblyName, StringComparison.OrdinalIgnoreCase);
18
+ }
19
+
20
+ protected override string ElementName
21
+ {
22
+ get { return "id"; }
23
+ }
24
+ }
25
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 91319408591cec1478efd3c62f9f418a
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System.Collections;
2
+ using System.Linq;
3
+ using NUnit.Framework.Interfaces;
4
+ using NUnit.Framework.Internal;
5
+ using NUnit.Framework.Internal.Filters;
6
+
7
+ namespace UnityEngine.TestRunner.NUnitExtensions.Filters
8
+ {
9
+ internal class CategoryFilterExtended : CategoryFilter
10
+ {
11
+ public static string k_DefaultCategory = "Uncategorized";
12
+
13
+ public CategoryFilterExtended(string name) : base(name)
14
+ {
15
+ }
16
+
17
+ public override bool Match(ITest test)
18
+ {
19
+ IList testCategories = test.Properties[PropertyNames.Category].Cast<string>().ToList();
20
+
21
+ if (test is TestMethod)
22
+ {
23
+ // Do not count tests with no attribute as Uncategorized if test fixture class has at least one attribute
24
+ // The test inherits the attribute from the test fixture
25
+ IList fixtureCategories = test.Parent.Properties[PropertyNames.Category].Cast<string>().ToList();
26
+ if (fixtureCategories.Count > 0)
27
+ return false;
28
+ }
29
+
30
+ if (testCategories.Count == 0 && ExpectedValue == k_DefaultCategory && test is TestMethod)
31
+ return true;
32
+
33
+ return base.Match(test);
34
+ }
35
+ }
36
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: ebeedaa04bb53e24ba2e7fb6745e3fd3
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+ using System.Collections;
3
+ using System.Collections.Generic;
4
+ using System.Linq;
5
+ using System.Reflection;
6
+ using NUnit.Framework;
7
+ using NUnit.Framework.Interfaces;
8
+ using NUnit.Framework.Internal;
9
+ using NUnit.Framework.Internal.Commands;
10
+ using NUnit.Framework.Internal.Execution;
11
+ using UnityEngine.TestTools.Logging;
12
+ using UnityEngine.TestTools.TestRunner;
13
+
14
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
15
+ {
16
+ internal class CompositeWorkItem : UnityWorkItem
17
+ {
18
+ private readonly TestSuite _suite;
19
+ private readonly TestSuiteResult _suiteResult;
20
+ private readonly ITestFilter _childFilter;
21
+ private TestCommand _setupCommand;
22
+ private TestCommand _teardownCommand;
23
+
24
+ public List<UnityWorkItem> Children { get; private set; }
25
+
26
+ private int _countOrder;
27
+
28
+ private CountdownEvent _childTestCountdown;
29
+
30
+ public CompositeWorkItem(TestSuite suite, ITestFilter childFilter, WorkItemFactory factory)
31
+ : base(suite, factory)
32
+ {
33
+ _suite = suite;
34
+ _suiteResult = Result as TestSuiteResult;
35
+ _childFilter = childFilter;
36
+ _countOrder = 0;
37
+ }
38
+
39
+ protected override IEnumerable PerformWork()
40
+ {
41
+ InitializeSetUpAndTearDownCommands();
42
+
43
+ if (UnityTestExecutionContext.CurrentContext != null && m_DontRunRestoringResult && EditModeTestCallbacks.RestoringTestContext != null)
44
+ {
45
+ EditModeTestCallbacks.RestoringTestContext();
46
+ }
47
+
48
+ if (!CheckForCancellation())
49
+ if (Test.RunState == RunState.Explicit && !_childFilter.IsExplicitMatch(Test))
50
+ SkipFixture(ResultState.Explicit, GetSkipReason(), null);
51
+ else
52
+ switch (Test.RunState)
53
+ {
54
+ default:
55
+ case RunState.Runnable:
56
+ case RunState.Explicit:
57
+ Result.SetResult(ResultState.Success);
58
+
59
+ CreateChildWorkItems();
60
+
61
+ if (Children.Count > 0)
62
+ {
63
+ if (!m_DontRunRestoringResult)
64
+ {
65
+ //This is needed to give the editor a chance to go out of playmode if needed before creating objects.
66
+ //If we do not, the objects could be automatically destroyed when exiting playmode and could result in errors later on
67
+ yield return null;
68
+ PerformOneTimeSetUp();
69
+ }
70
+
71
+ if (!CheckForCancellation())
72
+ {
73
+ switch (Result.ResultState.Status)
74
+ {
75
+ case TestStatus.Passed:
76
+ foreach (var child in RunChildren())
77
+ {
78
+ if (CheckForCancellation())
79
+ {
80
+ yield break;
81
+ }
82
+
83
+ yield return child;
84
+ }
85
+ break;
86
+ case TestStatus.Skipped:
87
+ case TestStatus.Inconclusive:
88
+ case TestStatus.Failed:
89
+ SkipChildren(_suite, Result.ResultState.WithSite(FailureSite.Parent), "OneTimeSetUp: " + Result.Message);
90
+ break;
91
+ }
92
+ }
93
+
94
+ if (Context.ExecutionStatus != TestExecutionStatus.AbortRequested && !m_DontRunRestoringResult)
95
+ {
96
+ PerformOneTimeTearDown();
97
+ }
98
+ }
99
+ break;
100
+
101
+ case RunState.Skipped:
102
+ SkipFixture(ResultState.Skipped, GetSkipReason(), null);
103
+ break;
104
+
105
+ case RunState.Ignored:
106
+ SkipFixture(ResultState.Ignored, GetSkipReason(), null);
107
+ break;
108
+
109
+ case RunState.NotRunnable:
110
+ SkipFixture(ResultState.NotRunnable, GetSkipReason(), GetProviderStackTrace());
111
+ break;
112
+ }
113
+ if (!ResultedInDomainReload)
114
+ {
115
+ WorkItemComplete();
116
+ }
117
+ }
118
+
119
+ private bool CheckForCancellation()
120
+ {
121
+ if (Context.ExecutionStatus != TestExecutionStatus.Running)
122
+ {
123
+ Result.SetResult(ResultState.Cancelled, "Test cancelled by user");
124
+ return true;
125
+ }
126
+
127
+ return false;
128
+ }
129
+
130
+ private void InitializeSetUpAndTearDownCommands()
131
+ {
132
+ List<SetUpTearDownItem> setUpTearDownItems = _suite.TypeInfo != null
133
+ ? CommandBuilder.BuildSetUpTearDownList(_suite.TypeInfo.Type, typeof(OneTimeSetUpAttribute), typeof(OneTimeTearDownAttribute))
134
+ : new List<SetUpTearDownItem>();
135
+
136
+ var actionItems = new List<TestActionItem>();
137
+ foreach (ITestAction action in Actions)
138
+ {
139
+ bool applyToSuite = (action.Targets & ActionTargets.Suite) == ActionTargets.Suite
140
+ || action.Targets == ActionTargets.Default && !(Test is ParameterizedMethodSuite);
141
+
142
+ bool applyToTest = (action.Targets & ActionTargets.Test) == ActionTargets.Test
143
+ && !(Test is ParameterizedMethodSuite);
144
+
145
+ if (applyToSuite)
146
+ actionItems.Add(new TestActionItem(action));
147
+
148
+ if (applyToTest)
149
+ Context.UpstreamActions.Add(action);
150
+ }
151
+
152
+ _setupCommand = CommandBuilder.MakeOneTimeSetUpCommand(_suite, setUpTearDownItems, actionItems);
153
+ _teardownCommand = CommandBuilder.MakeOneTimeTearDownCommand(_suite, setUpTearDownItems, actionItems);
154
+ }
155
+
156
+ private void PerformOneTimeSetUp()
157
+ {
158
+ var logScope = new LogScope();
159
+ try
160
+ {
161
+ _setupCommand.Execute(Context);
162
+ }
163
+ catch (Exception ex)
164
+ {
165
+ if (ex is NUnitException || ex is TargetInvocationException)
166
+ ex = ex.InnerException;
167
+
168
+ Result.RecordException(ex, FailureSite.SetUp);
169
+ }
170
+
171
+ if (logScope.AnyFailingLogs())
172
+ {
173
+ Result.RecordException(new UnhandledLogMessageException(logScope.FailingLogs.First()));
174
+ }
175
+ logScope.Dispose();
176
+ }
177
+
178
+ private IEnumerable RunChildren()
179
+ {
180
+ int childCount = Children.Count;
181
+ if (childCount == 0)
182
+ throw new InvalidOperationException("RunChildren called but item has no children");
183
+
184
+ _childTestCountdown = new CountdownEvent(childCount);
185
+
186
+ foreach (UnityWorkItem child in Children)
187
+ {
188
+ if (CheckForCancellation())
189
+ {
190
+ yield break;
191
+ }
192
+
193
+ var unityTestExecutionContext = new UnityTestExecutionContext(Context);
194
+ child.InitializeContext(unityTestExecutionContext);
195
+
196
+ var enumerable = child.Execute().GetEnumerator();
197
+
198
+ while (true)
199
+ {
200
+ if (!enumerable.MoveNext())
201
+ {
202
+ break;
203
+ }
204
+ ResultedInDomainReload |= child.ResultedInDomainReload;
205
+ yield return enumerable.Current;
206
+ }
207
+
208
+ _suiteResult.AddResult(child.Result);
209
+ childCount--;
210
+ }
211
+
212
+ if (childCount > 0)
213
+ {
214
+ while (childCount-- > 0)
215
+ CountDownChildTest();
216
+ }
217
+ }
218
+
219
+ private void CreateChildWorkItems()
220
+ {
221
+ Children = new List<UnityWorkItem>();
222
+ var testSuite = _suite;
223
+
224
+ foreach (ITest test in testSuite.Tests)
225
+ {
226
+ if (_childFilter.Pass(test))
227
+ {
228
+ var child = m_Factory.Create(test, _childFilter);
229
+
230
+ if (test.Properties.ContainsKey(PropertyNames.Order))
231
+ {
232
+ Children.Insert(0, child);
233
+ _countOrder++;
234
+ }
235
+ else
236
+ {
237
+ Children.Add(child);
238
+ }
239
+ }
240
+ }
241
+
242
+ if (_countOrder != 0) SortChildren();
243
+ }
244
+
245
+ private class UnityWorkItemOrderComparer : IComparer<UnityWorkItem>
246
+ {
247
+ public int Compare(UnityWorkItem x, UnityWorkItem y)
248
+ {
249
+ var xKey = int.MaxValue;
250
+ var yKey = int.MaxValue;
251
+
252
+ if (x.Test.Properties.ContainsKey(PropertyNames.Order))
253
+ xKey = (int)x.Test.Properties[PropertyNames.Order][0];
254
+
255
+ if (y.Test.Properties.ContainsKey(PropertyNames.Order))
256
+ yKey = (int)y.Test.Properties[PropertyNames.Order][0];
257
+
258
+ return xKey.CompareTo(yKey);
259
+ }
260
+ }
261
+
262
+ private void SortChildren()
263
+ {
264
+ Children.Sort(0, _countOrder, new UnityWorkItemOrderComparer());
265
+ }
266
+
267
+ private void SkipFixture(ResultState resultState, string message, string stackTrace)
268
+ {
269
+ Result.SetResult(resultState.WithSite(FailureSite.SetUp), message, StackFilter.Filter(stackTrace));
270
+ SkipChildren(_suite, resultState.WithSite(FailureSite.Parent), "OneTimeSetUp: " + message);
271
+ }
272
+
273
+ private void SkipChildren(TestSuite suite, ResultState resultState, string message)
274
+ {
275
+ foreach (Test child in suite.Tests)
276
+ {
277
+ if (_childFilter.Pass(child))
278
+ {
279
+ Context.Listener.TestStarted(child);
280
+ TestResult childResult = child.MakeTestResult();
281
+ childResult.SetResult(resultState, message);
282
+ _suiteResult.AddResult(childResult);
283
+
284
+ if (child.IsSuite)
285
+ SkipChildren((TestSuite)child, resultState, message);
286
+
287
+ Context.Listener.TestFinished(childResult);
288
+ }
289
+ }
290
+ }
291
+
292
+ private void PerformOneTimeTearDown()
293
+ {
294
+ var logScope = new LogScope();
295
+ try
296
+ {
297
+ _teardownCommand.Execute(Context);
298
+ }
299
+ catch (Exception ex)
300
+ {
301
+ if (ex is NUnitException || ex is TargetInvocationException)
302
+ ex = ex.InnerException;
303
+
304
+ Result.RecordException(ex, FailureSite.SetUp);
305
+ }
306
+
307
+ if (logScope.AnyFailingLogs())
308
+ {
309
+ Result.RecordException(new UnhandledLogMessageException(logScope.FailingLogs.First()));
310
+ }
311
+ logScope.Dispose();
312
+ }
313
+
314
+ private string GetSkipReason()
315
+ {
316
+ return (string)Test.Properties.Get(PropertyNames.SkipReason);
317
+ }
318
+
319
+ private string GetProviderStackTrace()
320
+ {
321
+ return (string)Test.Properties.Get(PropertyNames.ProviderStackTrace);
322
+ }
323
+
324
+ private void CountDownChildTest()
325
+ {
326
+ _childTestCountdown.Signal();
327
+ if (_childTestCountdown.CurrentCount == 0)
328
+ {
329
+ if (Context.ExecutionStatus != TestExecutionStatus.AbortRequested)
330
+ PerformOneTimeTearDown();
331
+
332
+ foreach (var childResult in _suiteResult.Children)
333
+ if (childResult.ResultState == ResultState.Cancelled)
334
+ {
335
+ this.Result.SetResult(ResultState.Cancelled, "Cancelled by user");
336
+ break;
337
+ }
338
+
339
+ WorkItemComplete();
340
+ }
341
+ }
342
+
343
+ public override void Cancel(bool force)
344
+ {
345
+ if (Children == null)
346
+ return;
347
+
348
+ foreach (var child in Children)
349
+ {
350
+ var ctx = child.Context;
351
+ if (ctx != null)
352
+ ctx.ExecutionStatus = force ? TestExecutionStatus.AbortRequested : TestExecutionStatus.StopRequested;
353
+
354
+ if (child.State == WorkItemState.Running)
355
+ child.Cancel(force);
356
+ }
357
+ }
358
+ }
359
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 110d5035a36a6a34580fb65bb40cd78f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+ using System.Collections;
3
+ using NUnit.Framework.Interfaces;
4
+ using NUnit.Framework.Internal;
5
+ using NUnit.Framework.Internal.Commands;
6
+ using NUnit.Framework.Internal.Execution;
7
+ using UnityEngine.TestTools.Utils;
8
+
9
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
10
+ {
11
+ internal class CoroutineTestWorkItem : UnityWorkItem
12
+ {
13
+ private static MonoBehaviour m_MonoBehaviourCoroutineRunner;
14
+ private TestCommand m_Command;
15
+
16
+ public static MonoBehaviour monoBehaviourCoroutineRunner
17
+ {
18
+ get
19
+ {
20
+ if (m_MonoBehaviourCoroutineRunner == null)
21
+ {
22
+ throw new NullReferenceException("MonoBehaviour coroutine runner not set");
23
+ }
24
+ return m_MonoBehaviourCoroutineRunner;
25
+ }
26
+ set { m_MonoBehaviourCoroutineRunner = value; }
27
+ }
28
+
29
+ public CoroutineTestWorkItem(TestMethod test, ITestFilter filter)
30
+ : base(test, null)
31
+ {
32
+ m_Command = m_Command = TestCommandBuilder.BuildTestCommand(test, filter);
33
+ }
34
+
35
+ protected override IEnumerable PerformWork()
36
+ {
37
+ if (m_Command is SkipCommand)
38
+ {
39
+ m_Command.Execute(Context);
40
+ Result = Context.CurrentResult;
41
+ WorkItemComplete();
42
+ yield break;
43
+ }
44
+
45
+ if (m_Command is ApplyChangesToContextCommand)
46
+ {
47
+ var applyChangesToContextCommand = (ApplyChangesToContextCommand)m_Command;
48
+ applyChangesToContextCommand.ApplyChanges(Context);
49
+ m_Command = applyChangesToContextCommand.GetInnerCommand();
50
+ }
51
+
52
+ var enumerableTestMethodCommand = (IEnumerableTestMethodCommand)m_Command;
53
+ try
54
+ {
55
+ var executeEnumerable = enumerableTestMethodCommand.ExecuteEnumerable(Context).GetEnumerator();
56
+
57
+ var coroutineRunner = new CoroutineRunner(monoBehaviourCoroutineRunner, Context);
58
+ yield return coroutineRunner.HandleEnumerableTest(executeEnumerable);
59
+
60
+ if (coroutineRunner.HasFailedWithTimeout())
61
+ {
62
+ Context.CurrentResult.SetResult(ResultState.Failure, string.Format("Test exceeded Timeout value of {0}ms", Context.TestCaseTimeout));
63
+ }
64
+
65
+ while (executeEnumerable.MoveNext()) {}
66
+
67
+ Result = Context.CurrentResult;
68
+ }
69
+ finally
70
+ {
71
+ WorkItemComplete();
72
+ }
73
+ }
74
+ }
75
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: b557515fff172984e8c4400b43f1c631
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+ using System.Collections;
3
+ using System.Linq;
4
+ using NUnit.Framework.Interfaces;
5
+ using NUnit.Framework.Internal;
6
+ using NUnit.Framework.Internal.Commands;
7
+ using NUnit.Framework.Internal.Execution;
8
+ using UnityEngine.TestTools;
9
+ using SetUpTearDownCommand = NUnit.Framework.Internal.Commands.SetUpTearDownCommand;
10
+ using TestActionCommand = NUnit.Framework.Internal.Commands.TestActionCommand;
11
+
12
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
13
+ {
14
+ internal class EditModeTestCallbacks
15
+ {
16
+ public static Action RestoringTestContext { get; set; }
17
+ }
18
+
19
+ internal class DefaultTestWorkItem : UnityWorkItem
20
+ {
21
+ private TestCommand _command;
22
+ public DefaultTestWorkItem(TestMethod test, ITestFilter filter)
23
+ : base(test, null)
24
+ {
25
+ _command = TestCommandBuilder.BuildTestCommand(test, filter);
26
+ }
27
+
28
+ protected override IEnumerable PerformWork()
29
+ {
30
+ if (m_DontRunRestoringResult && EditModeTestCallbacks.RestoringTestContext != null)
31
+ {
32
+ EditModeTestCallbacks.RestoringTestContext();
33
+ Result = Context.CurrentResult;
34
+ yield break;
35
+ }
36
+
37
+ try
38
+ {
39
+ if (_command is SkipCommand || _command is FailCommand)
40
+ {
41
+ Result = _command.Execute(Context);
42
+ yield break;
43
+ }
44
+
45
+ if (!(_command is IEnumerableTestMethodCommand))
46
+ {
47
+ Debug.LogError("Cannot perform work on " + _command.GetType().Name);
48
+ yield break;
49
+ }
50
+ if (Context.TestCaseTimeout == 0)
51
+ {
52
+ Context.TestCaseTimeout = k_DefaultTimeout;
53
+ }
54
+ foreach (var workItemStep in ((IEnumerableTestMethodCommand)_command).ExecuteEnumerable(Context))
55
+ {
56
+ ResultedInDomainReload = false;
57
+
58
+ if (workItemStep is IEditModeTestYieldInstruction)
59
+ {
60
+ var editModeTestYieldInstruction = (IEditModeTestYieldInstruction)workItemStep;
61
+ yield return editModeTestYieldInstruction;
62
+ var enumerator = editModeTestYieldInstruction.Perform();
63
+ while (true)
64
+ {
65
+ bool moveNext;
66
+ try
67
+ {
68
+ moveNext = enumerator.MoveNext();
69
+ }
70
+ catch (Exception e)
71
+ {
72
+ Context.CurrentResult.RecordException(e);
73
+ break;
74
+ }
75
+
76
+ if (!moveNext)
77
+ {
78
+ break;
79
+ }
80
+
81
+ yield return null;
82
+ }
83
+ }
84
+ else
85
+ {
86
+ yield return workItemStep;
87
+ }
88
+ }
89
+
90
+ Result = Context.CurrentResult;
91
+ }
92
+ finally
93
+ {
94
+ WorkItemComplete();
95
+ }
96
+ }
97
+ }
98
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: c7cfda246e604b945b12b7afedb094ce
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ using System.Collections;
3
+ using NUnit.Framework.Interfaces;
4
+ using NUnit.Framework.Internal;
5
+ using NUnit.Framework.Internal.Commands;
6
+
7
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
8
+ {
9
+ internal class FailCommand : TestCommand, IEnumerableTestMethodCommand
10
+ {
11
+ private ResultState m_ResultState;
12
+ private string m_Message;
13
+
14
+ public FailCommand(Test test, ResultState resultState, string message)
15
+ : base(test)
16
+ {
17
+ m_ResultState = resultState;
18
+ m_Message = message;
19
+ }
20
+
21
+ public override TestResult Execute(ITestExecutionContext context)
22
+ {
23
+ context.CurrentResult.SetResult(m_ResultState, m_Message);
24
+ return context.CurrentResult;
25
+ }
26
+
27
+ public IEnumerable ExecuteEnumerable(ITestExecutionContext context)
28
+ {
29
+ context.CurrentResult.SetResult(m_ResultState, m_Message);
30
+ yield return null;
31
+ }
32
+ }
33
+
34
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 68e5dc8bfd5d72647a93b7f2e1da831a
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ using System.Collections;
2
+ using NUnit.Framework.Internal;
3
+
4
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
5
+ {
6
+ internal interface IEnumerableTestMethodCommand
7
+ {
8
+ IEnumerable ExecuteEnumerable(ITestExecutionContext context);
9
+ }
10
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: dbd43d8a3b8122d4e89b055f53382b11
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using NUnit.Framework.Interfaces;
2
+ using NUnit.Framework.Internal;
3
+
4
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
5
+ {
6
+ internal class PlaymodeWorkItemFactory : WorkItemFactory
7
+ {
8
+ protected override UnityWorkItem Create(TestMethod method, ITestFilter filter, ITest loadedTest)
9
+ {
10
+ return new CoroutineTestWorkItem(method, filter);
11
+ }
12
+ }
13
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 7ef6801a8b664544aa9f2ab1bc1f8b60
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
2
+ {
3
+ internal class RestoreTestContextAfterDomainReload {}
4
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 26721f9940339264fb14bdbfe1290e21
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+ using System.Collections;
3
+ using System.Linq;
4
+ using NUnit.Framework;
5
+ using NUnit.Framework.Interfaces;
6
+ using NUnit.Framework.Internal;
7
+ using NUnit.Framework.Internal.Commands;
8
+ using UnityEngine.TestTools;
9
+
10
+ namespace UnityEngine.TestRunner.NUnitExtensions.Runner
11
+ {
12
+ internal static class TestCommandBuilder
13
+ {
14
+ public static TestCommand BuildTestCommand(TestMethod test, ITestFilter filter)
15
+ {
16
+ if (test.RunState != RunState.Runnable &&
17
+ !(test.RunState == RunState.Explicit && filter.IsExplicitMatch(test)))
18
+ {
19
+ return new SkipCommand(test);
20
+ }
21
+
22
+ var testReturnsIEnumerator = test.Method.ReturnType.Type == typeof(IEnumerator);
23
+
24
+ TestCommand command;
25
+ if (!testReturnsIEnumerator)
26
+ {
27
+ command = new TestMethodCommand(test);
28
+ }
29
+ else
30
+ {
31
+ command = new EnumerableTestMethodCommand(test);
32
+ }
33
+
34
+ command = new UnityLogCheckDelegatingCommand(command);
35
+ foreach (var wrapper in test.Method.GetCustomAttributes<IWrapTestMethod>(true))
36
+ {
37
+ command = wrapper.Wrap(command);
38
+ if (command == null)
39
+ {
40
+ var message = String.Format("IWrapTestMethod implementation '{0}' returned null as command.",
41
+ wrapper.GetType().FullName);
42
+ return new FailCommand(test, ResultState.Failure, message);
43
+ }
44
+
45
+ if (testReturnsIEnumerator && !(command is IEnumerableTestMethodCommand))
46
+ {
47
+ command = TryReplaceWithEnumerableCommand(command);
48
+ if (command != null)
49
+ {
50
+ continue;
51
+ }
52
+
53
+ var message = String.Format("'{0}' is not supported on {1} as it does not handle returning IEnumerator.",
54
+ wrapper.GetType().FullName,
55
+ GetTestBuilderName(test));
56
+ return new FailCommand(test, ResultState.Failure, message);
57
+ }
58
+ }
59
+
60
+ command = new UnityEngine.TestTools.TestActionCommand(command);
61
+ command = new UnityEngine.TestTools.SetUpTearDownCommand(command);
62
+
63
+ if (!testReturnsIEnumerator)
64
+ {
65
+ command = new ImmediateEnumerableCommand(command);
66
+ }
67
+
68
+ foreach (var wrapper in test.Method.GetCustomAttributes<IWrapSetUpTearDown>(true))
69
+ {
70
+ command = wrapper.Wrap(command);
71
+ if (command == null)
72
+ {
73
+ var message = String.Format("IWrapSetUpTearDown implementation '{0}' returned null as command.",
74
+ wrapper.GetType().FullName);
75
+ return new FailCommand(test, ResultState.Failure, message);
76
+ }
77
+
78
+ if (testReturnsIEnumerator && !(command is IEnumerableTestMethodCommand))
79
+ {
80
+ command = TryReplaceWithEnumerableCommand(command);
81
+ if (command != null)
82
+ {
83
+ continue;
84
+ }
85
+
86
+ var message = String.Format("'{0}' is not supported on {1} as it does not handle returning IEnumerator.",
87
+ wrapper.GetType().FullName,
88
+ GetTestBuilderName(test));
89
+ return new FailCommand(test, ResultState.Failure, message);
90
+ }
91
+ }
92
+
93
+ command = new EnumerableSetUpTearDownCommand(command);
94
+ command = new OuterUnityTestActionCommand(command);
95
+
96
+ IApplyToContext[] changes = test.Method.GetCustomAttributes<IApplyToContext>(true);
97
+ if (changes.Length > 0)
98
+ {
99
+ command = new EnumerableApplyChangesToContextCommand(command, changes);
100
+ }
101
+
102
+ return command;
103
+ }
104
+
105
+ private static string GetTestBuilderName(TestMethod testMethod)
106
+ {
107
+ return new[]
108
+ {
109
+ testMethod.Method.GetCustomAttributes<ITestBuilder>(true).Select(attribute => attribute.GetType().Name),
110
+ testMethod.Method.GetCustomAttributes<ISimpleTestBuilder>(true).Select(attribute => attribute.GetType().Name)
111
+ }.SelectMany(v => v).FirstOrDefault();
112
+ }
113
+
114
+ private static TestCommand TryReplaceWithEnumerableCommand(TestCommand command)
115
+ {
116
+ switch (command.GetType().Name)
117
+ {
118
+ case nameof(RepeatAttribute.RepeatedTestCommand):
119
+ return new EnumerableRepeatedTestCommand(command as RepeatAttribute.RepeatedTestCommand);
120
+ case nameof(RetryAttribute.RetryCommand):
121
+ return new EnumerableRetryTestCommand(command as RetryAttribute.RetryCommand);
122
+ default:
123
+ return null;
124
+ }
125
+ }
126
+ }
127
+ }
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.test-framework@1.1.22/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: f40df9c8cf926b241b093a37028d8815
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: