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

Fixing AnalyzeCommandBase and MultithreadedAnalyzeCommandBase artifacts generation #2433

Merged
merged 16 commits into from
Jan 31, 2022
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Fixing tests and flags
eddynaka committed Jan 28, 2022
commit 6972472ac49ff5c2b5da1fea05aaaed3db6add98
10 changes: 4 additions & 6 deletions src/Sarif.Driver/Sdk/MultithreadedAnalyzeCommandBase.cs
Original file line number Diff line number Diff line change
@@ -308,12 +308,10 @@ private void LogCachingLogger(TContext rootContext, IAnalysisLogger logger, TCon

if (results?.Count > 0)
{
if (_persistArtifacts)
{
_run?.GetFileIndex(new ArtifactLocation { Uri = context.TargetUri },
dataToInsert: _dataToInsert,
hashData: context.Hashes);
}
_run?.GetFileIndex(new ArtifactLocation { Uri = context.TargetUri },
addToFilesTableIfNotPresent: _persistArtifacts,
dataToInsert: _dataToInsert,
hashData: context.Hashes);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we should only persist if:

  1. we have results
  2. if we have hashes/textfiles/binaryfiles flag enabled


foreach (KeyValuePair<ReportingDescriptor, IList<Result>> kv in results)
{
Original file line number Diff line number Diff line change
@@ -1184,7 +1184,7 @@ public void AnalyzeCommandBase_ShouldGenerateSameResultsWhenRunningSingleAndMult
Assert.True(report.NumOfFoundBugs == 0, $"Coyote found {report.NumOfFoundBugs} bug(s).");
}

[Fact(Skip = "Artifacts will be different while we don't fix SarifLogger and AnalyzeCommandBase.)]
[Fact(Skip = "Artifacts will be different while we don't fix SarifLogger and AnalyzeCommandBase.")]
public void AnalyzeCommandBase_ShouldGenerateSameResultsWhenRunningSingleAndMultiThread()
{
int[] scenarios = SetupScenarios();