Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Feed the stall-watch test from a thread of its own
KnifeLemon7b96c4e3689b
diff --git a/tests/Filee.Engines.Tests/StallWatchTests.cs b/tests/Filee.Engines.Tests/StallWatchTests.csindex d35ffa7b..1f7df6d9 100644--- a/tests/Filee.Engines.Tests/StallWatchTests.cs+++ b/tests/Filee.Engines.Tests/StallWatchTests.cs@@ -18,23 +18,27 @@ public sealed class StallWatchTestsvar token = TestContext.Current.CancellationToken;// A limit far above the 50 ms between lines: a busy CI runner can delay a 50 ms wait by a few hundred ms.var watch = new StallWatch(TimeSpan.FromSeconds(1));- var exited = new TaskCompletionSource();+ // Asynchronously: the test must not go on on the output thread, which it joins at the end.+ var exited = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);var started = Stopwatch.StartNew();- // "34% Running transforms on e-book..." every 50 ms for three seconds, three times the limit.- var output = Task.Run(async () =>+ // "34% Running transforms on e-book..." every 50 ms for three seconds, three times the limit. On a thread of its+ // own, like the real output reader: a Task.Delay loop waits for the thread pool, which the other test classes+ // running in parallel can keep busy for over a second on a CI runner, and the watch then sees a stall.+ var output = new Thread(() =>{- while (started.Elapsed < TimeSpan.FromSeconds(3))+ while (started.Elapsed < TimeSpan.FromSeconds(3) && !token.IsCancellationRequested){watch.Touch();- await Task.Delay(50, token);+ Thread.Sleep(50);}exited.SetResult();- }, token);+ }) { IsBackground = true };+ output.Start();Assert.True(await watch.WaitAsync(exited.Task, token, Interval));Assert.True(started.Elapsed >= TimeSpan.FromSeconds(3));- await output;+ output.Join();}[Fact]