Skip to content

Commit 3f4b501

Browse files
committed
[wasi] Fix FileProviders.Physical test filtering on WASI
FileSystemWatcher is not supported on WASI, so add Wasi to the remaining FileSystemWatcher SkipOnPlatform attributes. Wildcard polling hashes with SHA256, which is not supported on WASI yet. Quarantine the PollingWildCardChangeToken tests and the wildcard rows of the polling watcher tests against dotnet#99126, splitting the UsePollingFileWatcher theories so the non-wildcard rows keep running. Co-authored-by: Copilot App <[email protected]>
1 parent 14a5f79 commit 3f4b501

3 files changed

Lines changed: 49 additions & 34 deletions

File tree

‎src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.cs‎

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public void TokenIsSameForSamePath()
355355
}
356356

357357
[Fact]
358-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
358+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
359359
public async Task TokensFiredOnFileChange()
360360
{
361361
using (var root = new TempDirectory(GetTestFilePath()))
@@ -385,7 +385,7 @@ public async Task TokensFiredOnFileChange()
385385
}
386386

387387
[Fact]
388-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
388+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
389389
[SkipOnCoreClr("JitStress slows this down too much", RuntimeTestModes.JitStress | RuntimeTestModes.JitStressRegs)]
390390
public async Task TokenCallbackInvokedOnFileChange()
391391
{
@@ -422,7 +422,7 @@ public async Task TokenCallbackInvokedOnFileChange()
422422
}
423423

424424
[Fact]
425-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
425+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
426426
public async Task WatcherWithPolling_ReturnsTrueForFileChangedWhenFileSystemWatcherDoesNotRaiseEvents()
427427
{
428428
using (var root = new TempDirectory(GetTestFilePath()))
@@ -450,7 +450,7 @@ public async Task WatcherWithPolling_ReturnsTrueForFileChangedWhenFileSystemWatc
450450
}
451451

452452
[Fact]
453-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
453+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
454454
public async Task WatcherWithPolling_ReturnsTrueForFileRemovedWhenFileSystemWatcherDoesNotRaiseEvents()
455455
{
456456
using (var root = new TempDirectory(GetTestFilePath()))
@@ -480,7 +480,7 @@ public async Task WatcherWithPolling_ReturnsTrueForFileRemovedWhenFileSystemWatc
480480
}
481481

482482
[Fact]
483-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
483+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
484484
public async Task TokensFiredOnFileDeleted()
485485
{
486486
using (var root = new TempDirectory(GetTestFilePath()))
@@ -815,7 +815,7 @@ public void GetDirectoryContentsReturnsFilesWhenExclusionDisabled()
815815
}
816816

817817
[Fact]
818-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
818+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
819819
public async Task FileChangeTokenNotNotifiedAfterExpiry()
820820
{
821821
using (var root = new TempDirectory(GetTestFilePath()))
@@ -863,7 +863,7 @@ public void TokenIsSameForSamePathCaseInsensitive()
863863
}
864864

865865
[Fact]
866-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
866+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
867867
public async Task CorrectTokensFiredForMultipleFiles()
868868
{
869869
using (var root = new TempDirectory(GetTestFilePath()))
@@ -896,7 +896,7 @@ public async Task CorrectTokensFiredForMultipleFiles()
896896
}
897897

898898
[Fact]
899-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
899+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
900900
public async Task TokenNotAffectedByExceptions()
901901
{
902902
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1001,7 +1001,7 @@ public void NoopChangeTokenForAbsolutePathFilters()
10011001
}
10021002

10031003
[Fact]
1004-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1004+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
10051005
public async Task TokenFiredOnCreation()
10061006
{
10071007
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1026,7 +1026,7 @@ public async Task TokenFiredOnCreation()
10261026
}
10271027

10281028
[Fact]
1029-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1029+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
10301030
public async Task TokenFiredOnDeletion()
10311031
{
10321032
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1051,7 +1051,7 @@ public async Task TokenFiredOnDeletion()
10511051
}
10521052

10531053
[Fact]
1054-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1054+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
10551055
public async Task TokenFiredForFilesUnderPathEndingWithSlash()
10561056
{
10571057
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1105,7 +1105,7 @@ public async Task TokenFiredForRelativePathStartingWithSlash_Windows(string slas
11051105
[InlineData("///")]
11061106
// Testing Unix specific behaviour on leading slashes.
11071107
[PlatformSpecific(TestPlatforms.AnyUnix)]
1108-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1108+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
11091109
public async Task TokenFiredForRelativePathStartingWithSlash_Unix(string slashes)
11101110
{
11111111
await TokenFiredForRelativePathStartingWithSlash(slashes);
@@ -1148,7 +1148,7 @@ public async Task TokenNotFiredForInvalidPathStartingWithSlash_Windows(string sl
11481148
[InlineData("/\0/")]
11491149
// Testing Unix specific behaviour on leading slashes.
11501150
[PlatformSpecific(TestPlatforms.AnyUnix)]
1151-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1151+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
11521152
public async Task TokenNotFiredForInvalidPathStartingWithSlash_Unix(string slashes)
11531153
{
11541154
await TokenNotFiredForInvalidPathStartingWithSlash(slashes);
@@ -1179,7 +1179,7 @@ private async Task TokenNotFiredForInvalidPathStartingWithSlash(string slashes)
11791179
}
11801180

11811181
[Fact]
1182-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1182+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
11831183
public async Task TokenFiredForGlobbingPatternsPointingToSubDirectory()
11841184
{
11851185
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1222,7 +1222,7 @@ public void TokensWithForwardAndBackwardSlashesAreSame()
12221222
}
12231223

12241224
[Fact]
1225-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1225+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
12261226
public async Task TokensFiredForOldAndNewNamesOnRename()
12271227
{
12281228
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1256,7 +1256,7 @@ public async Task TokensFiredForOldAndNewNamesOnRename()
12561256
}
12571257

12581258
[Fact]
1259-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1259+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
12601260
public async Task TokensFiredForNewDirectoryContentsOnRename()
12611261
{
12621262
var tcsShouldNotFire = new TaskCompletionSource<bool>();
@@ -1329,7 +1329,7 @@ void Fail(object state)
13291329
}
13301330

13311331
[Fact]
1332-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1332+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
13331333
public async Task TokenNotFiredForFileNameStartingWithPeriod()
13341334
{
13351335
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1395,7 +1395,7 @@ public async Task TokensNotFiredForHiddenAndSystemFiles()
13951395
}
13961396

13971397
[Fact]
1398-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1398+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
13991399
public async Task TokensFiredForAllEntriesOnError()
14001400
{
14011401
using (var root = new TempDirectory(GetTestFilePath()))
@@ -1423,7 +1423,7 @@ public async Task TokensFiredForAllEntriesOnError()
14231423
}
14241424

14251425
[Fact]
1426-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1426+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
14271427
public async Task WildCardToken_RaisesEventsForNewFilesAdded()
14281428
{
14291429
// Arrange
@@ -1449,7 +1449,7 @@ public async Task WildCardToken_RaisesEventsForNewFilesAdded()
14491449
}
14501450

14511451
[Fact]
1452-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1452+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
14531453
public async Task WildCardToken_RaisesEventsWhenFileSystemWatcherDoesNotFire()
14541454
{
14551455
// Arrange
@@ -1542,8 +1542,14 @@ public void UsePollingFileWatcher_FileWatcherNotNull_ReturnsFalse()
15421542

15431543
[Theory]
15441544
[InlineData(false)]
1545+
public Task UsePollingFileWatcher_UseActivePolling_HasChanged(bool useWildcard) => UsePollingFileWatcher_UseActivePolling_HasChangedCore(useWildcard);
1546+
1547+
[Theory]
15451548
[InlineData(true)]
1546-
public async Task UsePollingFileWatcher_UseActivePolling_HasChanged(bool useWildcard)
1549+
[ActiveIssue("https://github.com/dotnet/runtime/issues/99126", TestPlatforms.Wasi)]
1550+
public Task UsePollingFileWatcher_UseActivePolling_HasChanged_Wildcard(bool useWildcard) => UsePollingFileWatcher_UseActivePolling_HasChangedCore(useWildcard);
1551+
1552+
private async Task UsePollingFileWatcher_UseActivePolling_HasChangedCore(bool useWildcard)
15471553
{
15481554
// Arrange
15491555
using var root = new TempDirectory(GetTestFilePath());
@@ -1571,8 +1577,14 @@ public async Task UsePollingFileWatcher_UseActivePolling_HasChanged(bool useWild
15711577

15721578
[Theory]
15731579
[InlineData(false)]
1580+
public Task UsePollingFileWatcher_UseActivePolling_HasChanged_FileDeleted(bool useWildcard) => UsePollingFileWatcher_UseActivePolling_HasChanged_FileDeletedCore(useWildcard);
1581+
1582+
[Theory]
15741583
[InlineData(true)]
1575-
public async Task UsePollingFileWatcher_UseActivePolling_HasChanged_FileDeleted(bool useWildcard)
1584+
[ActiveIssue("https://github.com/dotnet/runtime/issues/99126", TestPlatforms.Wasi)]
1585+
public Task UsePollingFileWatcher_UseActivePolling_HasChanged_FileDeleted_Wildcard(bool useWildcard) => UsePollingFileWatcher_UseActivePolling_HasChanged_FileDeletedCore(useWildcard);
1586+
1587+
private async Task UsePollingFileWatcher_UseActivePolling_HasChanged_FileDeletedCore(bool useWildcard)
15761588
{
15771589
// Arrange
15781590
using var root = new TempDirectory(GetTestFilePath());
@@ -1620,7 +1632,7 @@ public void CreateFileWatcher_CreatesWatcherWithPollingAndActiveFlags()
16201632
[Theory]
16211633
[InlineData(false)]
16221634
[InlineData(true)]
1623-
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
1635+
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/WASI/iOS/tvOS")]
16241636
public async Task CanDeleteWatchedDirectory(bool useActivePolling)
16251637
{
16261638
using (var root = new TempDirectory(GetTestFilePath()))

0 commit comments

Comments
 (0)