Dev/sraroseck/draft/update tests/unit tests/dwarf attribute value#1171
Draft
Dev/sraroseck/draft/update tests/unit tests/dwarf attribute value#1171
Conversation
… data reading behavior
…d line info extraction
…arfAttributeValue
…tails; add helper methods for DWARF line number program tests
- Created Test.IntegrationTests.BinSkim.Driver project and added to solution - Implemented BinSkimRunner to launch BinSkim as an external process - Added AnalyzeCommandIntegrationTests with 5 passing tests for self-scan and command line options
|
|
||
| public AnalyzeCommandIntegrationTests() | ||
| { | ||
| _tempDir = Path.Combine(Path.GetTempPath(), "BinSkimIntegration", Guid.NewGuid().ToString("N")); |
|
|
||
| public void Dispose() | ||
| { | ||
| try { Directory.Delete(_tempDir, recursive: true); } catch { /* best-effort cleanup */ } |
| { | ||
| // BinSkim analyzing its own DLL — PDB is co-located so symbol loading should succeed. | ||
| string targetBinary = BinSkimRunner.GetBinSkimDllPath(); | ||
| string sarifOutput = Path.Combine(_tempDir, "output.sarif"); |
| public async Task Analyze_SelfScan_ProducesValidSarif() | ||
| { | ||
| string targetBinary = BinSkimRunner.GetBinSkimDllPath(); | ||
| string sarifOutput = Path.Combine(_tempDir, "output.sarif"); |
| [Fact] | ||
| public async Task Analyze_NoValidTargets_ExitsWithNonZero() | ||
| { | ||
| string nonExistentTarget = Path.Combine(_tempDir, "does_not_exist.dll"); |
| public async Task Analyze_NoValidTargets_ExitsWithNonZero() | ||
| { | ||
| string nonExistentTarget = Path.Combine(_tempDir, "does_not_exist.dll"); | ||
| string sarifOutput = Path.Combine(_tempDir, "output.sarif"); |
| { | ||
| string assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
| string binSkimDll = Path.GetFullPath( | ||
| Path.Combine(assemblyDir, "..", "..", "BinSkim.Driver", "release", "BinSkim.dll")); |
| } | ||
| catch (OperationCanceledException) | ||
| { | ||
| try { process.Kill(entireProcessTree: true); } catch { /* best-effort cleanup */ } |
| { | ||
| string failBinary = GetFunctionalTestDataPath( | ||
| "BA2016.MarkImageAsNXCompatible", "Fail", "ManagedFail.dll"); | ||
| string sarifOutput = Path.Combine(_tempDir, "fail-output.sarif"); |
| public async Task Analyze_RunOnlyRules_FiltersToSpecifiedRule() | ||
| { | ||
| string targetBinary = BinSkimRunner.GetBinSkimDllPath(); | ||
| string sarifOutput = Path.Combine(_tempDir, "filtered.sarif"); |
| [Fact] | ||
| public async Task ExportRules_ProducesValidSarifOutput() | ||
| { | ||
| string outputPath = Path.Combine(_tempDir, "rules.sarif"); |
| [Fact] | ||
| public async Task ExportConfig_ProducesValidJsonOutput() | ||
| { | ||
| string outputPath = Path.Combine(_tempDir, "config.json"); |
Comment on lines
+289
to
+290
| Path.Combine(assemblyDir, "..", "..", "..", "..", "src", | ||
| "Test.FunctionalTests.BinSkim.Rules", "FunctionalTestData")); |
| string testDataRoot = Path.GetFullPath( | ||
| Path.Combine(assemblyDir, "..", "..", "..", "..", "src", | ||
| "Test.FunctionalTests.BinSkim.Rules", "FunctionalTestData")); | ||
| string fullPath = Path.Combine(new[] { testDataRoot }.Concat(relativeParts).ToArray()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.