-
Notifications
You must be signed in to change notification settings - Fork 513
add AOT smoke and missing tests #1334
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
Merged
+518
−13
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
55df0d3
add AOT smoke and missing tests
adamhathcock c0b42d4
test: dispose reader stream in async parity test
Copilot 851aa39
test: dispose wrapped cancellation stream
Copilot 0a3c36d
Dispose caller-provided stream in async archive open test
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| using System; | ||
| using System.IO; | ||
| using System.Text; | ||
| using SharpCompress.Archives; | ||
| using SharpCompress.Common; | ||
| using SharpCompress.Readers; | ||
| using SharpCompress.Writers; | ||
|
|
||
| var original = "SharpCompress AOT smoke test"; | ||
| using var archiveStream = new MemoryStream(); | ||
|
|
||
| using ( | ||
| var writer = WriterFactory.OpenWriter( | ||
| archiveStream, | ||
| ArchiveType.Zip, | ||
| new WriterOptions(CompressionType.Deflate) { LeaveStreamOpen = true } | ||
| ) | ||
| ) | ||
| { | ||
| using var entryStream = new MemoryStream(Encoding.UTF8.GetBytes(original)); | ||
| writer.Write("payload.txt", entryStream, DateTime.UtcNow); | ||
| } | ||
|
|
||
| archiveStream.Position = 0; | ||
| using (var reader = ReaderFactory.OpenReader(archiveStream, ReaderOptions.ForExternalStream)) | ||
| { | ||
| if (!reader.MoveToNextEntry() || reader.Entry.IsDirectory) | ||
| { | ||
| throw new InvalidOperationException("Expected a file entry."); | ||
| } | ||
|
|
||
| using var extracted = new MemoryStream(); | ||
| reader.WriteEntryTo(extracted); | ||
| var actual = Encoding.UTF8.GetString(extracted.ToArray()); | ||
| if (!string.Equals(original, actual, StringComparison.Ordinal)) | ||
| { | ||
| throw new InvalidOperationException("ReaderFactory round-trip content mismatch."); | ||
| } | ||
| } | ||
|
|
||
| archiveStream.Position = 0; | ||
| using (var archive = ArchiveFactory.OpenArchive(archiveStream, ReaderOptions.ForExternalStream)) | ||
| { | ||
| var entryCount = 0; | ||
| foreach (var entry in archive.Entries) | ||
| { | ||
| if (!entry.IsDirectory) | ||
| { | ||
| entryCount++; | ||
| } | ||
| } | ||
|
|
||
| if (entryCount != 1) | ||
| { | ||
| throw new InvalidOperationException("ArchiveFactory did not see the expected entry."); | ||
| } | ||
| } | ||
|
|
||
| Console.WriteLine("SharpCompress AOT smoke test passed."); |
12 changes: 12 additions & 0 deletions
12
tests/SharpCompress.AotSmoke/SharpCompress.AotSmoke.csproj
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <PublishAot>true</PublishAot> | ||
| <PublishTrimmed>true</PublishTrimmed> | ||
| <TrimMode>full</TrimMode> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\src\SharpCompress\SharpCompress.csproj" /> | ||
| </ItemGroup> | ||
| </Project> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "version": 2, | ||
| "dependencies": { | ||
| "net10.0": { | ||
| "Microsoft.DotNet.ILCompiler": { | ||
| "type": "Direct", | ||
| "requested": "[10.0.6, )", | ||
| "resolved": "10.0.6", | ||
| "contentHash": "nBOzxOys8OeyJ+Nsi/uYlI/5TSsvwjaM/p5m4dTL6khCLx9UuP3b2ec3HeuBw/+F7hHCAZG1yFx8VBeoRAX+EQ==" | ||
| }, | ||
| "Microsoft.NET.ILLink.Tasks": { | ||
| "type": "Direct", | ||
| "requested": "[10.0.6, )", | ||
| "resolved": "10.0.6", | ||
| "contentHash": "QKuvS0LWX4fjFqeDkyM7Kqt8P3wYTiPD4nwU+9y59n0sCiG714fxDgbbN82vDnzq89AF/PiHl92TP2C4aFDUQA==" | ||
| }, | ||
| "Microsoft.NETFramework.ReferenceAssemblies": { | ||
| "type": "Direct", | ||
| "requested": "[1.0.3, )", | ||
| "resolved": "1.0.3", | ||
| "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", | ||
| "dependencies": { | ||
| "Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3" | ||
| } | ||
| }, | ||
| "Microsoft.SourceLink.GitHub": { | ||
| "type": "Direct", | ||
| "requested": "[10.0.102, )", | ||
| "resolved": "10.0.102", | ||
| "contentHash": "Oxq3RCIJSdtpIU4hLqO7XaDe/Ra3HS9Wi8rJl838SAg6Zu1iQjerA0+xXWBgUFYbgknUGCLOU0T+lzMLkvY9Qg==", | ||
| "dependencies": { | ||
| "Microsoft.Build.Tasks.Git": "10.0.102", | ||
| "Microsoft.SourceLink.Common": "10.0.102" | ||
| } | ||
| }, | ||
| "Microsoft.VisualStudio.Threading.Analyzers": { | ||
| "type": "Direct", | ||
| "requested": "[17.14.15, )", | ||
| "resolved": "17.14.15", | ||
| "contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw==" | ||
| }, | ||
| "PolySharp": { | ||
| "type": "Direct", | ||
| "requested": "[1.15.0, )", | ||
| "resolved": "1.15.0", | ||
| "contentHash": "FbU0El+EEjdpuIX4iDbeS7ki1uzpJPx8vbqOzEtqnl1GZeAGJfq+jCbxeJL2y0EPnUNk8dRnnqR2xnYXg9Tf+g==" | ||
| }, | ||
| "Microsoft.Build.Tasks.Git": { | ||
| "type": "Transitive", | ||
| "resolved": "10.0.102", | ||
| "contentHash": "0i81LYX31U6UiXz4NOLbvc++u+/mVDmOt+PskrM/MygpDxkv9THKQyRUmavBpLK6iBV0abNWnn+CQgSRz//Pwg==" | ||
| }, | ||
| "Microsoft.NETFramework.ReferenceAssemblies.net461": { | ||
| "type": "Transitive", | ||
| "resolved": "1.0.3", | ||
| "contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA==" | ||
| }, | ||
| "Microsoft.SourceLink.Common": { | ||
| "type": "Transitive", | ||
| "resolved": "10.0.102", | ||
| "contentHash": "Mk1IMb9q5tahC2NltxYXFkLBtuBvfBoCQ3pIxYQWfzbCE9o1OB9SsHe0hnNGo7lWgTA/ePbFAJLWu6nLL9K17A==" | ||
| }, | ||
| "sharpcompress": { | ||
| "type": "Project" | ||
| } | ||
| }, | ||
| "net10.0/osx-arm64": { | ||
| "Microsoft.DotNet.ILCompiler": { | ||
| "type": "Direct", | ||
| "requested": "[10.0.6, )", | ||
| "resolved": "10.0.6", | ||
| "contentHash": "nBOzxOys8OeyJ+Nsi/uYlI/5TSsvwjaM/p5m4dTL6khCLx9UuP3b2ec3HeuBw/+F7hHCAZG1yFx8VBeoRAX+EQ==", | ||
| "dependencies": { | ||
| "runtime.osx-arm64.Microsoft.DotNet.ILCompiler": "10.0.6" | ||
| } | ||
| }, | ||
| "runtime.osx-arm64.Microsoft.DotNet.ILCompiler": { | ||
| "type": "Transitive", | ||
| "resolved": "10.0.6", | ||
| "contentHash": "+yovwOAlIpfIcH+ZWmLYXWTSWYJ93wcQxF/RVk+X4MXgLASeosCJYVLqP20g0cufKjoRqvCmnklR6y9Su3ORtA==" | ||
| } | ||
| } | ||
| } | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.