Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SarifVersionOneToCurrentVisitor for run.files array #1221

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
019ca91
Uncomment v1 -> v2 tests; 3/14 fail.
Jan 16, 2019
f848f8e
Move test data to locations expected by FileDiffingTests.
Jan 16, 2019
a774c8f
Fix up some IDE C#7 code cleanups.
Jan 16, 2019
91cd0d2
Use FileDiffingTests helper.
Jan 16, 2019
da6e9ee
Fix bug in FileDiffingTests that caused a test failure.
Jan 16, 2019
bd5f3e1
Remove default-valued argument from a call to RunTest.
Jan 16, 2019
2fa702e
Create basic files array
Jan 16, 2019
baad98a
Revert incorrect change in FileDiffingTests.
Jan 16, 2019
4645900
Merge branch 'files-array' into users/lgolding/files-array-v1-to-v2-t…
Jan 16, 2019
10548c3
Fix one unit test with spot fix to "expected" file.
Jan 16, 2019
c9e375b
Fix up some C#7 IDE warnings
Jan 16, 2019
2138f8f
Force update in FileDiffing tests to avoid deserialization errors fro…
Jan 16, 2019
56bf415
Merge branch 'files-array' into users/lgolding/files-array-v1-to-v2-t…
Jan 16, 2019
3e97d66
Fix missing "modified" flag sets in PreRelCompatTransformer.
Jan 16, 2019
9c1990d
Merge branch 'files-array' into users/lgolding/files-array-v1-to-v2-t…
Jan 16, 2019
e60bc52
Merge branch 'files-array' into users/lgolding/files-array-v1-to-v2-t…
Jan 17, 2019
458e068
Populate fileIndex in run.files array.
Jan 17, 2019
6765bfc
Fix unit test by fixing fileLocation creation.
Jan 17, 2019
0c32164
Restore response file handling.
Jan 17, 2019
9f488ca
Populate fileIndex on fileLocations as appropriate.
Jan 17, 2019
d94dbca
Fix last test failure by reworking response file handling.
Jan 17, 2019
69e03e3
Feedback: Introduce transformer helper PopulatePropertyIfAbsent.
Jan 18, 2019
9fe211b
Feedback: Tighten platform-independent string compare.
Jan 18, 2019
928e336
Feedbakc: Revert FileDiffingTest change; downgrade affected test file…
Jan 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void AndroidStudioConverter_Convert_NullOutput()
Assert.Throws<ArgumentNullException>(() => _converter.Convert(new MemoryStream(), null, OptionallyEmittedData.None));
}

private string emptyResult =
private readonly string emptyResult =
@"{
""$schema"": """ + SarifUtilities.SarifSchemaUri + @""",
""version"": """ + SarifUtilities.SemanticVersion + @""",
Expand Down
7 changes: 7 additions & 0 deletions src/Sarif.TestUtilities/AssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ namespace Microsoft.CodeAnalysis.Sarif.TestUtilities
{
public static class AssertionExtensions
{
/// <summary>
/// Asserts that two strings are identical except for their casing and end of line conventions.
/// </summary>
/// <remarks>
/// This is useful for comparing logs that might have been generated on platforms with different
/// end of line conventions.
/// </remarks>
public static AndConstraint<StringAssertions> BeCrossPlatformEquivalentStrings(
this StringAssertions assertion,
string expected, string because = "", params object[] becauseArgs)
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif.TestUtilities/FileDiffingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected virtual void RunTest(string inputResourceName, string expectedOutputRe
bool passed;
if (_testProducesSarifCurrentVersion)
{
PrereleaseCompatibilityTransformer.UpdateToCurrentVersion(expectedSarifText, forceUpdate: false, Formatting.Indented, out expectedSarifText);
PrereleaseCompatibilityTransformer.UpdateToCurrentVersion(expectedSarifText, forceUpdate: true, Formatting.Indented, out expectedSarifText);
Copy link
Author

@ghost ghost Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true [](start = 106, length = 4)

Some tests were failing with deserialization errors because without this, the core transformations didn't happen. #Resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. this could indicate we have input files that improperly describe their version. alternately, you could have found those inputs and reset their version to "2.0.0". this is speculative, i don't know what you actually encountered of course.


In reply to: 248876087 [](ancestors = 248876087)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. suggest resetting this value to false. there are three inputs that are failing. go update their version to 10-10, which will provoke the transform. i think this is better than having test files that profess to be 11-28 but which clearly aren't


In reply to: 248880334 [](ancestors = 248880334,248876087)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Two of the files actually were already 10-10 and needed to be downgraded to 09-26 to provoke the core transform, but all tests now pass with forceUpdate: false.


In reply to: 248887247 [](ancestors = 248887247,248880334,248876087)

passed = AreEquivalent<SarifLog>(actualSarifText, expectedSarifText);
}
else
Expand Down
112 changes: 56 additions & 56 deletions src/Sarif.UnitTests/Sarif.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,34 @@
<None Remove="TestData\SarifCurrentToVersionOneVisitor\Inputs\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifCurrentToVersionOneVisitor\Inputs\ResultLocations.sarif" />
<None Remove="TestData\SarifCurrentToVersionOneVisitor\Inputs\TwoResultsWithFixes.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\BasicResult.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\CodeFlows.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\Minimum.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\MinimumWithPropertiesAndTags.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\MinimumWithTwoRuns.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\NotificationExceptionWithStack.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithFiles.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithInvocationAndNotifications.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithLogicalLocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithNotificationsButNoInvocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithRules.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v1\TwoResultsWithFixes.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\BasicResult.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\CodeFlows.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\Minimum.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\MinimumWithPropertiesAndTags.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\MinimumWithTwoRuns.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\NotificationExceptionWithStack.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithFiles.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithInvocationAndNotifications.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithLogicalLocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithNotificationsButNoInvocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithRules.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\v2\TwoResultsWithFixes.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\BasicResult.sarif" />
Copy link
Author

@ghost ghost Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inputs [](start = 59, length = 6)

Migrate to FileDiffingTests pattern. #ByDesign

<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\CodeFlows.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\Minimum.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithPropertiesAndTags.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithTwoRuns.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\NotificationExceptionWithStack.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithFiles.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithInvocationAndNotifications.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithLogicalLocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithNotificationsButNoInvocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithRules.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\TwoResultsWithFixes.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\BasicResult.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\CodeFlows.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\Minimum.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithPropertiesAndTags.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithTwoRuns.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NotificationExceptionWithStack.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithFiles.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithInvocationAndNotifications.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithLogicalLocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithNotificationsButNoInvocations.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithRules.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\TwoResultsWithFixes.sarif" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -136,34 +136,34 @@
<EmbeddedResource Include="TestData\SarifCurrentToVersionOneVisitor\Inputs\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifCurrentToVersionOneVisitor\Inputs\ResultLocations.sarif" />
<EmbeddedResource Include="TestData\SarifCurrentToVersionOneVisitor\Inputs\TwoResultsWithFixes.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\BasicResult.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\CodeFlows.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\Minimum.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\MinimumWithPropertiesAndTags.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\MinimumWithTwoRuns.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\NotificationExceptionWithStack.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithBasicInvocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithFiles.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithInvocationAndNotifications.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithLogicalLocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithNotificationsButNoInvocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\OneRunWithRules.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v1\TwoResultsWithFixes.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\BasicResult.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\CodeFlows.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\Minimum.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\MinimumWithPropertiesAndTags.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\MinimumWithTwoRuns.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\NotificationExceptionWithStack.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithBasicInvocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithFiles.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithInvocationAndNotifications.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithLogicalLocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithNotificationsButNoInvocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\OneRunWithRules.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\v2\TwoResultsWithFixes.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\BasicResult.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\CodeFlows.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\Minimum.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithPropertiesAndTags.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithTwoRuns.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\NotificationExceptionWithStack.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithBasicInvocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithFiles.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithInvocationAndNotifications.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithLogicalLocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithNotificationsButNoInvocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithRules.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\TwoResultsWithFixes.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\BasicResult.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\CodeFlows.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\Minimum.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithPropertiesAndTags.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithTwoRuns.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NotificationExceptionWithStack.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithBasicInvocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithFiles.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithInvocationAndNotifications.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithLogicalLocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithNotificationsButNoInvocations.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithRules.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\TwoResultsWithFixes.sarif" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@
},
"level": "error",
"threadId": 52,
"time": "2016-07-16T14:18:43.119Z",
"timeUtc": "2016-07-16T14:18:43.119Z",
"exception": {
"kind": "ExecutionEngine.RuleFailureException",
"message": "Unhandled exception during rule evaluation.",
"message": {
"text": "Unhandled exception during rule evaluation."
},
"innerExceptions": [
{
"kind": "System.ArgumentException",
"message": "length is < 0"
"message": {
"text": "length is < 0"
}
}
]
}
Expand Down
Loading