[PR #404] [MERGED] Enable parallel test execution #1011

Closed
opened 2026-01-29 22:18:36 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/404
Author: @MattKotsenas
Created: 7/12/2018
Status: Merged
Merged: 7/12/2018
Merged by: @adamhathcock

Base: masterHead: bugfix/idisposable


📝 Commits (10+)

  • 6ae715b Move the TestStream and ForwardOnlyStream to Mocks folder
  • 084c5e2 Rename StreamTests.cs --> LzmaStreamTests.cs
  • a35c66e Move RewindableStreamTest.cs to the Streams/ folder
  • c2bf540 Close verification streams in TestBase.CompareArchivesByPath
  • 6c2e5e1 Cleanup NonDisposingStream for reuse
  • cab1ce3 Update sub-streams to uniformly inherit from NonDisposingStream
  • 1652471 Fix Stream leak in ArchiveFactory
  • 4cd80e9 Simplify GZip bad compression test
  • c6cf0d4 Simplify ReaderTests
  • 0473ec1 Open test archives as read

📊 Changes

24 files changed (+218 additions, -473 deletions)

View changed files

📝 src/SharpCompress/Archives/ArchiveFactory.cs (+2 -7)
📝 src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs (+5 -6)
📝 src/SharpCompress/Common/Volume.cs (+10 -6)
src/SharpCompress/IO/AppendingStream.cs (+0 -74)
📝 src/SharpCompress/IO/BufferedSubStream.cs (+2 -13)
📝 src/SharpCompress/IO/CountingWritableSubStream.cs (+5 -8)
📝 src/SharpCompress/IO/ListeningStream.cs (+1 -5)
📝 src/SharpCompress/IO/NonDisposingStream.cs (+1 -12)
📝 src/SharpCompress/IO/ReadOnlySubStream.cs (+1 -1)
📝 tests/SharpCompress.Test/ArchiveTests.cs (+25 -99)
📝 tests/SharpCompress.Test/GZip/GZipArchiveTests.cs (+4 -4)
📝 tests/SharpCompress.Test/GZip/GZipWriterTests.cs (+6 -10)
📝 tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs (+10 -9)
tests/SharpCompress.Test/Mocks/TestStream.cs (+69 -0)
📝 tests/SharpCompress.Test/Rar/RarHeaderFactoryTest.cs (+1 -6)
📝 tests/SharpCompress.Test/Rar/RarReaderTests.cs (+5 -24)
📝 tests/SharpCompress.Test/ReaderTests.cs (+33 -18)
📝 tests/SharpCompress.Test/Streams/LzmaStreamTests.cs (+1 -1)
📝 tests/SharpCompress.Test/Streams/RewindableStreamTest.cs (+1 -1)
📝 tests/SharpCompress.Test/Tar/TarReaderTests.cs (+1 -0)

...and 4 more files

📄 Description

Enable test execution by fixing two classes of file locking problems:

  1. Improper use of IDisposable in the library
  2. Locked file streams by the tests themselves

Solving these problems generally had one of two solutions:

  1. Using the NonDisposingStream in additional places so types that were "borrowing" a stream could still follow the Dispose pattern without upsetting code analysis
  2. Changing tests to not take exclusive locks on original files

Lastly, the IsLocked check in TestBase had to be removed because it isn't parallel-test-execution-aware. Some of that gap is closed by the expanded test coverage in ReaderTests, though more is certainly welcome. I chose to stop here to avoid making the PR unmanageable.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/404 **Author:** [@MattKotsenas](https://github.com/MattKotsenas) **Created:** 7/12/2018 **Status:** ✅ Merged **Merged:** 7/12/2018 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `bugfix/idisposable` --- ### 📝 Commits (10+) - [`6ae715b`](https://github.com/adamhathcock/sharpcompress/commit/6ae715b153ee21d27aa0caa0d42ed8ff4a86d61c) Move the TestStream and ForwardOnlyStream to Mocks folder - [`084c5e2`](https://github.com/adamhathcock/sharpcompress/commit/084c5e268620b110ab0e48cd9204fd5fe32ed746) Rename StreamTests.cs --> LzmaStreamTests.cs - [`a35c66e`](https://github.com/adamhathcock/sharpcompress/commit/a35c66e166b67bc2677604c3bea05d7f244ef5af) Move RewindableStreamTest.cs to the Streams/ folder - [`c2bf540`](https://github.com/adamhathcock/sharpcompress/commit/c2bf540057e8711b21aac7e6693eded14c8af8e4) Close verification streams in TestBase.CompareArchivesByPath - [`6c2e5e1`](https://github.com/adamhathcock/sharpcompress/commit/6c2e5e116436fef65648b9dbd378060ccbdbf335) Cleanup NonDisposingStream for reuse - [`cab1ce3`](https://github.com/adamhathcock/sharpcompress/commit/cab1ce3d0cda16f931a2348f58873338646def5d) Update sub-streams to uniformly inherit from NonDisposingStream - [`1652471`](https://github.com/adamhathcock/sharpcompress/commit/16524717ba346407c87d5d9a3b23cae2ba6380f7) Fix Stream leak in ArchiveFactory - [`4cd80e9`](https://github.com/adamhathcock/sharpcompress/commit/4cd80e96f3c514383e7921741061f4716cd4b9e4) Simplify GZip bad compression test - [`c6cf0d4`](https://github.com/adamhathcock/sharpcompress/commit/c6cf0d40ee6868d5ee04e9b5dff63065acc194f6) Simplify ReaderTests - [`0473ec1`](https://github.com/adamhathcock/sharpcompress/commit/0473ec1626a729fe851df5bf09db0ab30b78fb63) Open test archives as read ### 📊 Changes **24 files changed** (+218 additions, -473 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Archives/ArchiveFactory.cs` (+2 -7) 📝 `src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs` (+5 -6) 📝 `src/SharpCompress/Common/Volume.cs` (+10 -6) ➖ `src/SharpCompress/IO/AppendingStream.cs` (+0 -74) 📝 `src/SharpCompress/IO/BufferedSubStream.cs` (+2 -13) 📝 `src/SharpCompress/IO/CountingWritableSubStream.cs` (+5 -8) 📝 `src/SharpCompress/IO/ListeningStream.cs` (+1 -5) 📝 `src/SharpCompress/IO/NonDisposingStream.cs` (+1 -12) 📝 `src/SharpCompress/IO/ReadOnlySubStream.cs` (+1 -1) 📝 `tests/SharpCompress.Test/ArchiveTests.cs` (+25 -99) 📝 `tests/SharpCompress.Test/GZip/GZipArchiveTests.cs` (+4 -4) 📝 `tests/SharpCompress.Test/GZip/GZipWriterTests.cs` (+6 -10) 📝 `tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs` (+10 -9) ➕ `tests/SharpCompress.Test/Mocks/TestStream.cs` (+69 -0) 📝 `tests/SharpCompress.Test/Rar/RarHeaderFactoryTest.cs` (+1 -6) 📝 `tests/SharpCompress.Test/Rar/RarReaderTests.cs` (+5 -24) 📝 `tests/SharpCompress.Test/ReaderTests.cs` (+33 -18) 📝 `tests/SharpCompress.Test/Streams/LzmaStreamTests.cs` (+1 -1) 📝 `tests/SharpCompress.Test/Streams/RewindableStreamTest.cs` (+1 -1) 📝 `tests/SharpCompress.Test/Tar/TarReaderTests.cs` (+1 -0) _...and 4 more files_ </details> ### 📄 Description Enable test execution by fixing two classes of file locking problems: 1. Improper use of `IDisposable` in the library 2. Locked file streams by the tests themselves Solving these problems generally had one of two solutions: 1. Using the `NonDisposingStream` in additional places so types that were "borrowing" a stream could still follow the `Dispose` pattern without upsetting code analysis 2. Changing tests to not take exclusive locks on original files Lastly, the `IsLocked` check in `TestBase` had to be removed because it isn't parallel-test-execution-aware. Some of that gap is closed by the expanded test coverage in `ReaderTests`, though more is certainly welcome. I chose to stop here to avoid making the PR unmanageable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:18:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1011