From a1388eb282300bc1e20123904e89bae4b28f6cad Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 01:30:26 +0100 Subject: [PATCH 01/49] Add initial tests Using big brother implementation: https://github.com/dotnet/runtime/tree/main/src/libraries/System.IO.FileSystem.Primitives/tests --- .../System.IO.FileSystem.nfproj | 12 +-- .../FileAccessTests.cs | 22 ++++++ .../FileAttributesTests.cs | 36 +++++++++ .../FileModeTests.cs | 25 ++++++ .../FileShareTests.cs | 25 ++++++ .../Properties/AssemblyInfo.cs | 31 ++++++++ .../System.IO.FileSystem.Tests.nfproj | 77 +++++++++++++++++++ .../nano.runsettings | 16 ++++ .../packages.config | 8 ++ nanoFramework.System.IO.FileSystem.sln | 8 ++ 10 files changed, 252 insertions(+), 8 deletions(-) create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config diff --git a/System.IO.FileSystem/System.IO.FileSystem.nfproj b/System.IO.FileSystem/System.IO.FileSystem.nfproj index ac28d11..ccd5beb 100644 --- a/System.IO.FileSystem/System.IO.FileSystem.nfproj +++ b/System.IO.FileSystem/System.IO.FileSystem.nfproj @@ -61,21 +61,17 @@ - + ..\packages\nanoFramework.CoreLibrary.1.12.0\lib\mscorlib.dll - True - + ..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll - True - + ..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll - True - + ..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll - True diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs new file mode 100644 index 0000000..68005ac --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using nanoFramework.TestFramework; +using System.IO; +using System.IO.FileSystem; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileAccessTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(1, (int)FileAccess.Read); + Assert.Equal(2, (int)FileAccess.Write); + Assert.Equal(3, (int)FileAccess.ReadWrite); + } + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs new file mode 100644 index 0000000..7c2366c --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using nanoFramework.TestFramework; +using System.IO; +using System.IO.FileSystem; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileAttributesTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(0x0001, (int)FileAttributes.ReadOnly); + Assert.Equal(0x0002, (int)FileAttributes.Hidden); + Assert.Equal(0x0004, (int)FileAttributes.System); + Assert.Equal(0x0010, (int)FileAttributes.Directory); + Assert.Equal(0x0020, (int)FileAttributes.Archive); + Assert.Equal(0x0040, (int)FileAttributes.Device); + Assert.Equal(0x0080, (int)FileAttributes.Normal); + Assert.Equal(0x0100, (int)FileAttributes.Temporary); + Assert.Equal(0x0200, (int)FileAttributes.SparseFile); + Assert.Equal(0x0400, (int)FileAttributes.ReparsePoint); + Assert.Equal(0x0800, (int)FileAttributes.Compressed); + Assert.Equal(0x1000, (int)FileAttributes.Offline); + Assert.Equal(0x2000, (int)FileAttributes.NotContentIndexed); + Assert.Equal(0x4000, (int)FileAttributes.Encrypted); + Assert.Equal(0x8000, (int)FileAttributes.IntegrityStream); + Assert.Equal(0x20000, (int)FileAttributes.NoScrubData); + } + + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs new file mode 100644 index 0000000..de7788f --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO.FileSystem; +using System.IO; +using nanoFramework.TestFramework; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileModeTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(1, (int)FileMode.CreateNew); + Assert.Equal(2, (int)FileMode.Create); + Assert.Equal(3, (int)FileMode.Open); + Assert.Equal(4, (int)FileMode.OpenOrCreate); + Assert.Equal(5, (int)FileMode.Truncate); + Assert.Equal(6, (int)FileMode.Append); + } + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs new file mode 100644 index 0000000..d856784 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO.FileSystem; +using System.IO; +using nanoFramework.TestFramework; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileShareTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(0, (int)FileShare.None); + Assert.Equal(1, (int)FileShare.Read); + Assert.Equal(2, (int)FileShare.Write); + Assert.Equal(3, (int)FileShare.ReadWrite); + Assert.Equal(4, (int)FileShare.Delete); + Assert.Equal(0x10, (int)FileShare.Inheritable); + } + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a3735af --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright (c) 2021 nanoFramework contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj new file mode 100644 index 0000000..5c528c6 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -0,0 +1,77 @@ + + + + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ + + + + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 59af586e-78d2-451c-95b8-b3c0571cfd97 + Library + Properties + 512 + System.IO.FileSystem.Tests + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + + ..\..\..\packages\nanoFramework.CoreLibrary.1.12.0\lib\mscorlib.dll + + + ..\..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll + + + ..\..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll + + + ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.TestFramework.dll + + + ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.UnitTestLauncher.exe + + + ..\..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll + + + + + + + + + + + + + + + + + + + + Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. + + + + \ No newline at end of file diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings new file mode 100644 index 0000000..a7622c2 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings @@ -0,0 +1,16 @@ + + + + + 1 + .\TestResults + + 120000 + + Framework40 + + + None + False + + diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config new file mode 100644 index 0000000..4c5eef8 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.System.IO.FileSystem.sln b/nanoFramework.System.IO.FileSystem.sln index 87e4591..ad11f39 100644 --- a/nanoFramework.System.IO.FileSystem.sln +++ b/nanoFramework.System.IO.FileSystem.sln @@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "System.IO.FileSystem\tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -22,6 +24,12 @@ Global {94C34547-1E2B-4967-8D1F-F3359460BB6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {94C34547-1E2B-4967-8D1F-F3359460BB6D}.Release|Any CPU.Build.0 = Release|Any CPU {94C34547-1E2B-4967-8D1F-F3359460BB6D}.Release|Any CPU.Deploy.0 = Release|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Release|Any CPU.Build.0 = Release|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 6349b814f5e0084bb5a75e50f9ebd078f4f65c41 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 02:35:38 +0100 Subject: [PATCH 02/49] Remove unused usings. Add fixes to enums. --- System.IO.FileSystem/FileAttributes.cs | 77 +++++++++++++++++-- System.IO.FileSystem/FileShare.cs | 20 ++++- .../FileAccessTests.cs | 3 - .../FileModeTests.cs | 3 - .../FileShareTests.cs | 3 - 5 files changed, 87 insertions(+), 19 deletions(-) diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 1895e65..7b4661f 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -14,26 +14,91 @@ public enum FileAttributes /// /// The file is read-only. /// - ReadOnly = 0x1, + ReadOnly = 0x0001, /// /// The file is hidden, and thus is not included in an ordinary directory listing. /// - Hidden = 0x2, + Hidden = 0x0002, /// - /// The file is a system file. That is, the file is part of the operating system or is used exclusively by the operating system. + /// The file is a system file. + /// That is, the file is part of the operating system or is used exclusively by the operating system. /// - System = 0x4, + System = 0x0004, /// /// The file is a directory. /// - Directory = 0x10, + Directory = 0x0010, /// /// This file is marked to be included in incremental backup operation. /// - Archive = 0x20, + Archive = 0x0020, + + /// + /// Reserved for future use. + /// + Device = 0x0040, + + /// + /// The file is a standard file that has no special attributes. + /// This attribute is valid only if it is used alone. + /// Normal is supported on Windows, Linux, and macOS. + /// + Normal = 0x0080, + + /// + /// The file is temporary. + /// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. + /// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. + /// A temporary file should be deleted by the application as soon as it is no longer needed. + /// + Temporary = 0x0100, + + /// + /// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. + /// + SparseFile = 0x0200, + + /// + /// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. + /// ReparsePoint is supported on Windows, Linux, and macOS. + /// + ReparsePoint = 0x0400, + + /// + /// The file is compressed. + /// + Compressed = 0x0800, + + /// + /// The file is offline. The data of the file is not immediately available. + /// + Offline = 0x1000, + + /// + /// The file will not be indexed by the operating system's content indexing service. + /// + NotContentIndexed = 0x2000, + + /// + /// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. + /// For a directory, this means that encryption is the default for newly created files and directories. + /// + Encrypted = 0x4000, + + /// + /// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. + /// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. + /// + IntegrityStream = 0x8000, + + /// + /// The file or directory is excluded from the data integrity scan. + /// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. + /// + NoScrubData = 0x20000 } } diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index 88c957d..8a0ce21 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -17,27 +17,39 @@ public enum FileShare /// No sharing. Any request to open the file (by this process or another /// process) will fail until the file is closed. /// - None = 0, + None = 0x00, /// /// Allows subsequent opening of the file for reading. If this flag is not /// specified, any request to open the file for reading (by this process or /// another process) will fail until the file is closed. /// - Read = 1, + Read = 0x01, /// /// Allows subsequent opening of the file for writing. If this flag is not /// specified, any request to open the file for writing (by this process or /// another process) will fail until the file is closed. /// - Write = 2, + Write = 0x02, /// /// Allows subsequent opening of the file for writing or reading. If this flag /// is not specified, any request to open the file for writing or reading (by /// this process or another process) will fail until the file is closed. /// - ReadWrite = 3, + ReadWrite = 0x03, + + /// + /// Open the file, but allow someone else to delete the file. + /// + Delete = 0x04, + /// + /// Whether the file handle should be inheritable by child processes. + /// + /// + /// Note this is not directly supported like this by nanoFramework. + /// + Inheritable = 0x10 } } diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs index 68005ac..b0c7ccc 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs @@ -1,10 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using nanoFramework.TestFramework; -using System.IO; -using System.IO.FileSystem; namespace System.IO.FileSystem.Tests { diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs index de7788f..e79ed0c 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.IO.FileSystem; -using System.IO; using nanoFramework.TestFramework; namespace System.IO.FileSystem.Tests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs index d856784..2b8a32c 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.IO.FileSystem; -using System.IO; using nanoFramework.TestFramework; namespace System.IO.FileSystem.Tests From 8d899607ea8d381161beb8d88447deecd60c7fa5 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 03:16:13 +0100 Subject: [PATCH 03/49] Move tests to Primitives --- .../{ => Primitives}/FileAccessTests.cs | 2 +- .../{ => Primitives}/FileAttributesTests.cs | 5 +---- .../{ => Primitives}/FileModeTests.cs | 2 +- .../{ => Primitives}/FileShareTests.cs | 2 +- .../System.IO.FileSystem.Tests.nfproj | 8 ++++---- 5 files changed, 8 insertions(+), 11 deletions(-) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileAccessTests.cs (91%) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileAttributesTests.cs (93%) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileModeTests.cs (93%) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileShareTests.cs (93%) diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 91% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs index b0c7ccc..339d475 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs @@ -3,7 +3,7 @@ using nanoFramework.TestFramework; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileAccessTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 93% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index 7c2366c..ef92541 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -1,12 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using nanoFramework.TestFramework; -using System.IO; -using System.IO.FileSystem; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileAttributesTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 93% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs index e79ed0c..93856b6 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs @@ -3,7 +3,7 @@ using nanoFramework.TestFramework; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileModeTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 93% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index 2b8a32c..f2f9f5a 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -3,7 +3,7 @@ using nanoFramework.TestFramework; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileShareTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index 5c528c6..2efd2c9 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -27,10 +27,10 @@ $(MSBuildProjectDirectory)\nano.runsettings - - - - + + + + From bc14d24ee971de59ade21dadf7206144f6918d33 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 03:24:53 +0100 Subject: [PATCH 04/49] Add folders for future tests. --- .../System.IO.FileSystem.Tests.nfproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index 2efd2c9..d733582 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -60,6 +60,13 @@ + + + + + + + From cd5eb8ce70d4d11765f63bfb07082766e99d75ae Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 20:09:32 +0100 Subject: [PATCH 05/49] Move test folder to root --- nanoFramework.System.IO.FileSystem.sln | 2 +- .../System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs | 0 .../Primitives/FileAttributesTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileModeTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileShareTests.cs | 0 .../System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs | 0 .../System.IO.FileSystem.Tests.nfproj | 0 .../tests => tests}/System.IO.FileSystem.Tests/nano.runsettings | 0 .../tests => tests}/System.IO.FileSystem.Tests/packages.config | 0 9 files changed, 1 insertion(+), 1 deletion(-) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/nano.runsettings (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/packages.config (100%) diff --git a/nanoFramework.System.IO.FileSystem.sln b/nanoFramework.System.IO.FileSystem.sln index ad11f39..86d22a5 100644 --- a/nanoFramework.System.IO.FileSystem.sln +++ b/nanoFramework.System.IO.FileSystem.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "System.IO.FileSystem\tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs rename to tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj rename to tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings b/tests/System.IO.FileSystem.Tests/nano.runsettings similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings rename to tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config b/tests/System.IO.FileSystem.Tests/packages.config similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config rename to tests/System.IO.FileSystem.Tests/packages.config From 1c72ccdde5509c788409564ff1e5c35807547a9b Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 20:21:38 +0100 Subject: [PATCH 06/49] Update assembily info for tests. Update some nuget packages. --- .../Properties/AssemblyInfo.cs | 10 ++++------ .../System.IO.FileSystem.Tests.nfproj | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs index a3735af..3f7a4fd 100644 --- a/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs +++ b/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs @@ -5,12 +5,10 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyCopyright("Copyright (c) 2021 nanoFramework contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly: AssemblyTitle("nanoFramework.System.IO.FileSystem.Tests")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework.System.IO.FileSystem.Tests")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index d733582..f70a250 100644 --- a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -21,6 +21,8 @@ true UnitTest v1.0 + true + true @@ -34,8 +36,9 @@ - - ..\..\..\packages\nanoFramework.CoreLibrary.1.12.0\lib\mscorlib.dll + + ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll + True ..\..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll @@ -43,11 +46,13 @@ ..\..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll - - ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll + True - - ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.UnitTestLauncher.exe + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe + True ..\..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll @@ -79,6 +84,6 @@ Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. - + \ No newline at end of file From 9f3f6e80cea7c5d2da6d49a20f67a0533d207896 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:34:51 +0100 Subject: [PATCH 07/49] Fix build --- .runsettings | 15 ++++++++ System.IO.FileSystem/FileStream.cs | 4 ++ .../packages.lock.json | 37 +++++++++++++++++++ nanoFramework.System.IO.FileSystem.sln | 2 +- .../System.IO.FileSystem.Tests.nfproj | 30 ++++++--------- .../nano.runsettings | 16 -------- .../packages.config | 10 ++--- 7 files changed, 74 insertions(+), 40 deletions(-) create mode 100644 .runsettings create mode 100644 Tests/System.IO.FileSystem.Tests/packages.lock.json delete mode 100644 tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/.runsettings b/.runsettings new file mode 100644 index 0000000..e82b99e --- /dev/null +++ b/.runsettings @@ -0,0 +1,15 @@ + + + + + 1 + .\TestResults + 120000 + net48 + x64 + + + None + False + + \ No newline at end of file diff --git a/System.IO.FileSystem/FileStream.cs b/System.IO.FileSystem/FileStream.cs index 28fdc88..da36975 100644 --- a/System.IO.FileSystem/FileStream.cs +++ b/System.IO.FileSystem/FileStream.cs @@ -558,6 +558,10 @@ public override void WriteByte(byte value) [MethodImpl(MethodImplOptions.InternalCall)] private extern long GetLengthNative(string path, string fileName); + /// + /// Reads bytes from the file stream. + /// + /// Bytes to read from the stream. public override int Read(SpanByte buffer) { throw new NotImplementedException(); diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json new file mode 100644 index 0000000..93c1552 --- /dev/null +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -0,0 +1,37 @@ +{ + "version": 1, + "dependencies": { + ".NETnanoFramework,Version=v1.0": { + "nanoFramework.CoreLibrary": { + "type": "Direct", + "requested": "[1.14.2, 1.14.2]", + "resolved": "1.14.2", + "contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" + }, + "nanoFramework.Runtime.Events": { + "type": "Direct", + "requested": "[1.11.6, 1.11.6]", + "resolved": "1.11.6", + "contentHash": "xkltRh/2xKaZ9zmPHbVr32s1k+e17AInUBhzxKKkUDicJKF39yzTShSklb1OL6DBER5z71SpkGLyl9IdMK9l6w==" + }, + "nanoFramework.System.IO.Streams": { + "type": "Direct", + "requested": "[1.1.38, 1.1.38]", + "resolved": "1.1.38", + "contentHash": "qEtu/lMDtr5kPKc939vO3uX8h+W0/+Qx2N3Zx005JxqGiL71e4ScecEyGPIp8v1MzRd9pkoxInUb6jOAh+eyXA==" + }, + "nanoFramework.System.Text": { + "type": "Direct", + "requested": "[1.2.37, 1.2.37]", + "resolved": "1.2.37", + "contentHash": "ORgRq0HSynSBhlXRTHdhzZiOdq/nRhdnX+DeIGw56y9OSc8dvqUz6elm97Jz+4WQ6ikpvs5PFGINAa35kBebwQ==" + }, + "nanoFramework.TestFramework": { + "type": "Direct", + "requested": "[2.1.60, 2.1.60]", + "resolved": "2.1.60", + "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" + } + } + } +} \ No newline at end of file diff --git a/nanoFramework.System.IO.FileSystem.sln b/nanoFramework.System.IO.FileSystem.sln index 86d22a5..61c4ec4 100644 --- a/nanoFramework.System.IO.FileSystem.sln +++ b/nanoFramework.System.IO.FileSystem.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "Tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index f70a250..ed0ea99 100644 --- a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -25,9 +25,6 @@ true - - $(MSBuildProjectDirectory)\nano.runsettings - @@ -41,49 +38,46 @@ True - ..\..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll + ..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll - ..\..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll + ..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll + + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll True - + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe - True - ..\..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll + ..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll - - + - - - - - + - + - Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/tests/System.IO.FileSystem.Tests/nano.runsettings b/tests/System.IO.FileSystem.Tests/nano.runsettings deleted file mode 100644 index a7622c2..0000000 --- a/tests/System.IO.FileSystem.Tests/nano.runsettings +++ /dev/null @@ -1,16 +0,0 @@ - - - - - 1 - .\TestResults - - 120000 - - Framework40 - - - None - False - - diff --git a/tests/System.IO.FileSystem.Tests/packages.config b/tests/System.IO.FileSystem.Tests/packages.config index 4c5eef8..8a3e36a 100644 --- a/tests/System.IO.FileSystem.Tests/packages.config +++ b/tests/System.IO.FileSystem.Tests/packages.config @@ -1,8 +1,8 @@  - - - - - + + + + + \ No newline at end of file From ab247a84a11e0f8053ebb17d4813a2e1e3c365a5 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:44:08 +0100 Subject: [PATCH 08/49] Windows fix temp --- .../System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileModeTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileShareTests.cs | 0 .../System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs | 0 .../System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj | 0 {tests => TestsTemp}/System.IO.FileSystem.Tests/packages.config | 0 .../System.IO.FileSystem.Tests/packages.lock.json | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/packages.config (100%) rename {Tests => TestsTemp}/System.IO.FileSystem.Tests/packages.lock.json (100%) diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs rename to TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs diff --git a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj similarity index 100% rename from tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj rename to TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj diff --git a/tests/System.IO.FileSystem.Tests/packages.config b/TestsTemp/System.IO.FileSystem.Tests/packages.config similarity index 100% rename from tests/System.IO.FileSystem.Tests/packages.config rename to TestsTemp/System.IO.FileSystem.Tests/packages.config diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/TestsTemp/System.IO.FileSystem.Tests/packages.lock.json similarity index 100% rename from Tests/System.IO.FileSystem.Tests/packages.lock.json rename to TestsTemp/System.IO.FileSystem.Tests/packages.lock.json From f976caa2e5768c232bc8ee2f18e15f8f1c21b3c1 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:45:09 +0100 Subject: [PATCH 09/49] Windows fix folder case --- .../System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileModeTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileShareTests.cs | 0 .../System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs | 0 .../System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj | 0 {TestsTemp => Tests}/System.IO.FileSystem.Tests/packages.config | 0 .../System.IO.FileSystem.Tests/packages.lock.json | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/packages.config (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/packages.lock.json (100%) diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/Tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs rename to Tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj rename to Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj diff --git a/TestsTemp/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/packages.config rename to Tests/System.IO.FileSystem.Tests/packages.config diff --git a/TestsTemp/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/packages.lock.json rename to Tests/System.IO.FileSystem.Tests/packages.lock.json From af9f56529f012e58a0676dfc8af897661ee7d2bc Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:58:22 +0100 Subject: [PATCH 10/49] Fix test package requirements. --- .../System.IO.FileSystem.nfproj | 6 ++++-- .../System.IO.FileSystem.Tests.nfproj | 12 ------------ .../System.IO.FileSystem.Tests/packages.config | 3 --- .../packages.lock.json | 18 ------------------ 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/System.IO.FileSystem/System.IO.FileSystem.nfproj b/System.IO.FileSystem/System.IO.FileSystem.nfproj index 0a590cf..fa05f18 100644 --- a/System.IO.FileSystem/System.IO.FileSystem.nfproj +++ b/System.IO.FileSystem/System.IO.FileSystem.nfproj @@ -68,9 +68,8 @@ ..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - + ..\packages\nanoFramework.Runtime.Events.1.11.6\lib\nanoFramework.Runtime.Events.dll - True ..\packages\nanoFramework.System.Text.1.2.37\lib\nanoFramework.System.Text.dll @@ -81,6 +80,9 @@ True + + + diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index ed0ea99..a73f5aa 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -37,15 +37,6 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll - - - ..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll - - - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll True @@ -53,9 +44,6 @@ ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe - - ..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll - diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index 8a3e36a..b23bb96 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,8 +1,5 @@  - - - \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 93c1552..95ce2e7 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -8,24 +8,6 @@ "resolved": "1.14.2", "contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" }, - "nanoFramework.Runtime.Events": { - "type": "Direct", - "requested": "[1.11.6, 1.11.6]", - "resolved": "1.11.6", - "contentHash": "xkltRh/2xKaZ9zmPHbVr32s1k+e17AInUBhzxKKkUDicJKF39yzTShSklb1OL6DBER5z71SpkGLyl9IdMK9l6w==" - }, - "nanoFramework.System.IO.Streams": { - "type": "Direct", - "requested": "[1.1.38, 1.1.38]", - "resolved": "1.1.38", - "contentHash": "qEtu/lMDtr5kPKc939vO3uX8h+W0/+Qx2N3Zx005JxqGiL71e4ScecEyGPIp8v1MzRd9pkoxInUb6jOAh+eyXA==" - }, - "nanoFramework.System.Text": { - "type": "Direct", - "requested": "[1.2.37, 1.2.37]", - "resolved": "1.2.37", - "contentHash": "ORgRq0HSynSBhlXRTHdhzZiOdq/nRhdnX+DeIGw56y9OSc8dvqUz6elm97Jz+4WQ6ikpvs5PFGINAa35kBebwQ==" - }, "nanoFramework.TestFramework": { "type": "Direct", "requested": "[2.1.60, 2.1.60]", From 5526eb6f6c2b41a9b7c0fe7d783aa5d5e632d866 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 22:05:25 +0100 Subject: [PATCH 11/49] Remove un-needed packages. Something seems broken with the latest test framework (nuget) so CI build will fail. --- .../System.IO.FileSystem.Tests.nfproj | 12 ++++++------ .../System.IO.FileSystem.Tests/nano.runsettings | 17 +++++++++++++++++ .../System.IO.FileSystem.Tests/packages.config | 2 +- .../packages.lock.json | 6 +++--- 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 Tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index a73f5aa..ba4e32f 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -37,15 +37,15 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll - True + + ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.TestFramework.dll - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.UnitTestLauncher.exe + @@ -61,11 +61,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/nano.runsettings b/Tests/System.IO.FileSystem.Tests/nano.runsettings new file mode 100644 index 0000000..93ce85e --- /dev/null +++ b/Tests/System.IO.FileSystem.Tests/nano.runsettings @@ -0,0 +1,17 @@ + + + + + .\TestResults + 120000 + net48 + x64 + + + None + False + COM3 + + + + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index b23bb96..1ebb847 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 95ce2e7..67f9a72 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -10,9 +10,9 @@ }, "nanoFramework.TestFramework": { "type": "Direct", - "requested": "[2.1.60, 2.1.60]", - "resolved": "2.1.60", - "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" + "requested": "[2.1.71, 2.1.71]", + "resolved": "2.1.71", + "contentHash": "V2SYltqAwkw2ZSAZlyG515qIt2T3PL7v8UMF0GrknmTleA0HJ1qNHDXw4ymaV+RVrMexP9c27UuzQZBAKFxo9Q==" } } } From f17497d3dbab18ffa835a07f84b9205506ae44ae Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 22:39:55 +0100 Subject: [PATCH 12/49] Revert "Remove un-needed packages." This reverts commit 5526eb6f6c2b41a9b7c0fe7d783aa5d5e632d866. --- .../System.IO.FileSystem.Tests.nfproj | 12 ++++++------ .../System.IO.FileSystem.Tests/nano.runsettings | 17 ----------------- .../System.IO.FileSystem.Tests/packages.config | 2 +- .../packages.lock.json | 6 +++--- 4 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 Tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index ba4e32f..a73f5aa 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -37,15 +37,15 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll + True - ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe - @@ -61,11 +61,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/nano.runsettings b/Tests/System.IO.FileSystem.Tests/nano.runsettings deleted file mode 100644 index 93ce85e..0000000 --- a/Tests/System.IO.FileSystem.Tests/nano.runsettings +++ /dev/null @@ -1,17 +0,0 @@ - - - - - .\TestResults - 120000 - net48 - x64 - - - None - False - COM3 - - - - \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index 1ebb847..b23bb96 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 67f9a72..95ce2e7 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -10,9 +10,9 @@ }, "nanoFramework.TestFramework": { "type": "Direct", - "requested": "[2.1.71, 2.1.71]", - "resolved": "2.1.71", - "contentHash": "V2SYltqAwkw2ZSAZlyG515qIt2T3PL7v8UMF0GrknmTleA0HJ1qNHDXw4ymaV+RVrMexP9c27UuzQZBAKFxo9Q==" + "requested": "[2.1.60, 2.1.60]", + "resolved": "2.1.60", + "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" } } } From 7e899ad3ca0842c66c0ead183007187270985123 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 22:47:00 +0100 Subject: [PATCH 13/49] Fix deprecation warnings --- .../Primitives/FileAccessTests.cs | 6 ++-- .../Primitives/FileAttributesTests.cs | 32 +++++++++---------- .../Primitives/FileModeTests.cs | 12 +++---- .../Primitives/FileShareTests.cs | 12 +++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs index 339d475..9bb4ad4 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs @@ -11,9 +11,9 @@ public static class FileAccessTests [TestMethod] public static void ValueTest() { - Assert.Equal(1, (int)FileAccess.Read); - Assert.Equal(2, (int)FileAccess.Write); - Assert.Equal(3, (int)FileAccess.ReadWrite); + Assert.AreEqual(1, (int)FileAccess.Read); + Assert.AreEqual(2, (int)FileAccess.Write); + Assert.AreEqual(3, (int)FileAccess.ReadWrite); } } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index ef92541..40585d3 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -11,22 +11,22 @@ public static class FileAttributesTests [TestMethod] public static void ValueTest() { - Assert.Equal(0x0001, (int)FileAttributes.ReadOnly); - Assert.Equal(0x0002, (int)FileAttributes.Hidden); - Assert.Equal(0x0004, (int)FileAttributes.System); - Assert.Equal(0x0010, (int)FileAttributes.Directory); - Assert.Equal(0x0020, (int)FileAttributes.Archive); - Assert.Equal(0x0040, (int)FileAttributes.Device); - Assert.Equal(0x0080, (int)FileAttributes.Normal); - Assert.Equal(0x0100, (int)FileAttributes.Temporary); - Assert.Equal(0x0200, (int)FileAttributes.SparseFile); - Assert.Equal(0x0400, (int)FileAttributes.ReparsePoint); - Assert.Equal(0x0800, (int)FileAttributes.Compressed); - Assert.Equal(0x1000, (int)FileAttributes.Offline); - Assert.Equal(0x2000, (int)FileAttributes.NotContentIndexed); - Assert.Equal(0x4000, (int)FileAttributes.Encrypted); - Assert.Equal(0x8000, (int)FileAttributes.IntegrityStream); - Assert.Equal(0x20000, (int)FileAttributes.NoScrubData); + Assert.AreEqual(0x0001, (int)FileAttributes.ReadOnly); + Assert.AreEqual(0x0002, (int)FileAttributes.Hidden); + Assert.AreEqual(0x0004, (int)FileAttributes.System); + Assert.AreEqual(0x0010, (int)FileAttributes.Directory); + Assert.AreEqual(0x0020, (int)FileAttributes.Archive); + Assert.AreEqual(0x0040, (int)FileAttributes.Device); + Assert.AreEqual(0x0080, (int)FileAttributes.Normal); + Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); + Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); + Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); + Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); + Assert.AreEqual(0x1000, (int)FileAttributes.Offline); + Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); + Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); + Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); + Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs index 93856b6..b41318d 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs @@ -11,12 +11,12 @@ public static class FileModeTests [TestMethod] public static void ValueTest() { - Assert.Equal(1, (int)FileMode.CreateNew); - Assert.Equal(2, (int)FileMode.Create); - Assert.Equal(3, (int)FileMode.Open); - Assert.Equal(4, (int)FileMode.OpenOrCreate); - Assert.Equal(5, (int)FileMode.Truncate); - Assert.Equal(6, (int)FileMode.Append); + Assert.AreEqual(1, (int)FileMode.CreateNew); + Assert.AreEqual(2, (int)FileMode.Create); + Assert.AreEqual(3, (int)FileMode.Open); + Assert.AreEqual(4, (int)FileMode.OpenOrCreate); + Assert.AreEqual(5, (int)FileMode.Truncate); + Assert.AreEqual(6, (int)FileMode.Append); } } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index f2f9f5a..4dd430c 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -11,12 +11,12 @@ public static class FileShareTests [TestMethod] public static void ValueTest() { - Assert.Equal(0, (int)FileShare.None); - Assert.Equal(1, (int)FileShare.Read); - Assert.Equal(2, (int)FileShare.Write); - Assert.Equal(3, (int)FileShare.ReadWrite); - Assert.Equal(4, (int)FileShare.Delete); - Assert.Equal(0x10, (int)FileShare.Inheritable); + Assert.AreEqual(0, (int)FileShare.None); + Assert.AreEqual(1, (int)FileShare.Read); + Assert.AreEqual(2, (int)FileShare.Write); + Assert.AreEqual(3, (int)FileShare.ReadWrite); + Assert.AreEqual(4, (int)FileShare.Delete); + Assert.AreEqual(0x10, (int)FileShare.Inheritable); } } } From baf13851bb648a431a262769c2a93b1a53562bdb Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 17:09:00 +0100 Subject: [PATCH 14/49] Comment out unused attributes As nF does not (currently) use them. --- System.IO.FileSystem/FileAttributes.cs | 126 +++++++++--------- System.IO.FileSystem/FileShare.cs | 22 +-- .../Primitives/FileAttributesTests.cs | 22 +-- .../Primitives/FileShareTests.cs | 4 +- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 7b4661f..5fe250a 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -37,68 +37,68 @@ public enum FileAttributes /// Archive = 0x0020, - /// - /// Reserved for future use. - /// - Device = 0x0040, - - /// - /// The file is a standard file that has no special attributes. - /// This attribute is valid only if it is used alone. - /// Normal is supported on Windows, Linux, and macOS. - /// - Normal = 0x0080, - - /// - /// The file is temporary. - /// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. - /// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. - /// A temporary file should be deleted by the application as soon as it is no longer needed. - /// - Temporary = 0x0100, - - /// - /// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. - /// - SparseFile = 0x0200, - - /// - /// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. - /// ReparsePoint is supported on Windows, Linux, and macOS. - /// - ReparsePoint = 0x0400, - - /// - /// The file is compressed. - /// - Compressed = 0x0800, - - /// - /// The file is offline. The data of the file is not immediately available. - /// - Offline = 0x1000, - - /// - /// The file will not be indexed by the operating system's content indexing service. - /// - NotContentIndexed = 0x2000, - - /// - /// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. - /// For a directory, this means that encryption is the default for newly created files and directories. - /// - Encrypted = 0x4000, - - /// - /// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. - /// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. - /// - IntegrityStream = 0x8000, - - /// - /// The file or directory is excluded from the data integrity scan. - /// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. - /// - NoScrubData = 0x20000 + ///// + ///// Reserved for future use. + ///// + //Device = 0x0040, + + ///// + ///// The file is a standard file that has no special attributes. + ///// This attribute is valid only if it is used alone. + ///// Normal is supported on Windows, Linux, and macOS. + ///// + //Normal = 0x0080, + + ///// + ///// The file is temporary. + ///// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. + ///// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. + ///// A temporary file should be deleted by the application as soon as it is no longer needed. + ///// + //Temporary = 0x0100, + + ///// + ///// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. + ///// + //SparseFile = 0x0200, + + ///// + ///// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. + ///// ReparsePoint is supported on Windows, Linux, and macOS. + ///// + //ReparsePoint = 0x0400, + + ///// + ///// The file is compressed. + ///// + //Compressed = 0x0800, + + ///// + ///// The file is offline. The data of the file is not immediately available. + ///// + //Offline = 0x1000, + + ///// + ///// The file will not be indexed by the operating system's content indexing service. + ///// + //NotContentIndexed = 0x2000, + + ///// + ///// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. + ///// For a directory, this means that encryption is the default for newly created files and directories. + ///// + //Encrypted = 0x4000, + + ///// + ///// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. + ///// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. + ///// + //IntegrityStream = 0x8000, + + ///// + ///// The file or directory is excluded from the data integrity scan. + ///// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. + ///// + //NoScrubData = 0x20000 } } diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index 8a0ce21..9133d8f 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -40,16 +40,16 @@ public enum FileShare /// ReadWrite = 0x03, - /// - /// Open the file, but allow someone else to delete the file. - /// - Delete = 0x04, - /// - /// Whether the file handle should be inheritable by child processes. - /// - /// - /// Note this is not directly supported like this by nanoFramework. - /// - Inheritable = 0x10 + ///// + ///// Open the file, but allow someone else to delete the file. + ///// + //Delete = 0x04, + ///// + ///// Whether the file handle should be inheritable by child processes. + ///// + ///// + ///// Note this is not directly supported like this by nanoFramework. + ///// + //Inheritable = 0x10 } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index 40585d3..0c469db 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -16,17 +16,17 @@ public static void ValueTest() Assert.AreEqual(0x0004, (int)FileAttributes.System); Assert.AreEqual(0x0010, (int)FileAttributes.Directory); Assert.AreEqual(0x0020, (int)FileAttributes.Archive); - Assert.AreEqual(0x0040, (int)FileAttributes.Device); - Assert.AreEqual(0x0080, (int)FileAttributes.Normal); - Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); - Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); - Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); - Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); - Assert.AreEqual(0x1000, (int)FileAttributes.Offline); - Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); - Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); - Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); - Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); + //Assert.AreEqual(0x0040, (int)FileAttributes.Device); + //Assert.AreEqual(0x0080, (int)FileAttributes.Normal); + //Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); + //Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); + //Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); + //Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); + //Assert.AreEqual(0x1000, (int)FileAttributes.Offline); + //Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); + //Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); + //Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); + //Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index 4dd430c..b269504 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -15,8 +15,8 @@ public static void ValueTest() Assert.AreEqual(1, (int)FileShare.Read); Assert.AreEqual(2, (int)FileShare.Write); Assert.AreEqual(3, (int)FileShare.ReadWrite); - Assert.AreEqual(4, (int)FileShare.Delete); - Assert.AreEqual(0x10, (int)FileShare.Inheritable); + //Assert.AreEqual(4, (int)FileShare.Delete); + //Assert.AreEqual(0x10, (int)FileShare.Inheritable); } } } From 237a904b50b2eaba776324e959e4d74cdbfa6353 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 17:54:49 +0100 Subject: [PATCH 15/49] Minor fixes and comment improvements --- System.IO.FileSystem/FileAttributes.cs | 5 +++++ System.IO.FileSystem/FileShare.cs | 7 ++++++- System.IO.FileSystem/FileStream.cs | 2 +- .../Primitives/FileAttributesTests.cs | 2 ++ .../Primitives/FileShareTests.cs | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 5fe250a..bfddb52 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -37,6 +37,11 @@ public enum FileAttributes /// Archive = 0x0020, + + // NOTE: the following file attibutes are not currently supported + // in .NET nanoFramework so are left commented out. + // They are left as comments as should align with .NET if ever required. + ///// ///// Reserved for future use. ///// diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index 9133d8f..fbad963 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -7,7 +7,7 @@ namespace System.IO { /// /// Contains constants for controlling file sharing options while - /// opening files. You can specify what access other processes trying + /// opening files. You can specify what access other processes trying /// to open the same file concurrently can have. /// [Flags] @@ -40,6 +40,11 @@ public enum FileShare /// ReadWrite = 0x03, + + // NOTE: the following file attibutes are not currently supported + // in .NET nanoFramework so are left commented out. + // They are left as comments as should align with .NET if ever required. + ///// ///// Open the file, but allow someone else to delete the file. ///// diff --git a/System.IO.FileSystem/FileStream.cs b/System.IO.FileSystem/FileStream.cs index da36975..7021253 100644 --- a/System.IO.FileSystem/FileStream.cs +++ b/System.IO.FileSystem/FileStream.cs @@ -561,7 +561,7 @@ public override void WriteByte(byte value) /// /// Reads bytes from the file stream. /// - /// Bytes to read from the stream. + /// Bytes to read from the stream. public override int Read(SpanByte buffer) { throw new NotImplementedException(); diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index 0c469db..c9393fb 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -16,6 +16,8 @@ public static void ValueTest() Assert.AreEqual(0x0004, (int)FileAttributes.System); Assert.AreEqual(0x0010, (int)FileAttributes.Directory); Assert.AreEqual(0x0020, (int)FileAttributes.Archive); + + // NOTE: The following attributes are not currently supported by nF //Assert.AreEqual(0x0040, (int)FileAttributes.Device); //Assert.AreEqual(0x0080, (int)FileAttributes.Normal); //Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index b269504..e925d56 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -15,6 +15,8 @@ public static void ValueTest() Assert.AreEqual(1, (int)FileShare.Read); Assert.AreEqual(2, (int)FileShare.Write); Assert.AreEqual(3, (int)FileShare.ReadWrite); + + // NOTE: The following attributes are not currently supported by nF //Assert.AreEqual(4, (int)FileShare.Delete); //Assert.AreEqual(0x10, (int)FileShare.Inheritable); } From ac35f50d33cb1d6b7cf059f6e6473d97efeeffe7 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 18:33:39 +0100 Subject: [PATCH 16/49] Update azure-pipelines.yml run tests --- azure-pipelines.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 977787a..18f1266 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,10 +20,6 @@ trigger: - config/* - .github/* - tags: - include: - - v* - # PR always trigger build pr: autoCancel: true @@ -53,16 +49,8 @@ steps: - template: azure-pipelines-templates/class-lib-build.yml@templates parameters: sonarCloudProject: 'nanoframework_lib-System.IO.FileSystem' - -# update dependents -- template: azure-pipelines-templates/update-dependents.yml@templates - parameters: - ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: - waitBeforeUpdate: false - ${{ else }}: - waitBeforeUpdate: true - repositoriesToUpdate: | - nanoFramework.Logging + runUnitTests: true + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' # step from template @ nf-tools repo # report error From 9cc64dbfdf94aa29dd6e0b5ff1403dc2fa3a7d46 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 20:10:57 +0100 Subject: [PATCH 17/49] Add set check for file attributes. --- System.IO.FileSystem/File.cs | 10 +++++++++- azure-pipelines.yml | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/System.IO.FileSystem/File.cs b/System.IO.FileSystem/File.cs index 5c2a288..2e55b26 100644 --- a/System.IO.FileSystem/File.cs +++ b/System.IO.FileSystem/File.cs @@ -243,7 +243,15 @@ public static FileAttributes GetAttributes(string path) /// A bitwise combination of the enumeration values. public static void SetAttributes(string path, FileAttributes fileAttributes) { - SetAttributesNative(path, (byte)fileAttributes); + // TODO: better handle bitwise combinations + if ((byte)fileAttributes > 0x24) // nF definitely does not support it! + { + throw new NotSupportedException("Unexpected FileAttribute combination."); + } + else + { + SetAttributesNative(path, (byte)fileAttributes); + } } /// diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 18f1266..4888e86 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -52,6 +52,16 @@ steps: runUnitTests: true unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' +# # update dependents +# - template: azure-pipelines-templates/update-dependents.yml@templates +# parameters: +# ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: +# waitBeforeUpdate: false +# ${{ else }}: +# waitBeforeUpdate: true +# repositoriesToUpdate: | +# nanoFramework.Logging + # step from template @ nf-tools repo # report error - template: azure-pipelines-templates/discord-webhook-task.yml@templates From 93eddfdd545cfbd63003022c79bf9682301e1f55 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 20:35:08 +0100 Subject: [PATCH 18/49] Fixes for nuspec --- nanoFramework.System.IO.FileSystem.nuspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nanoFramework.System.IO.FileSystem.nuspec b/nanoFramework.System.IO.FileSystem.nuspec index 2136bb5..388c54b 100644 --- a/nanoFramework.System.IO.FileSystem.nuspec +++ b/nanoFramework.System.IO.FileSystem.nuspec @@ -21,6 +21,7 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check + @@ -32,7 +33,7 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check - + \ No newline at end of file From 45a417a6a39c21556b973db97024e607dcf39b88 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 20:41:04 +0100 Subject: [PATCH 19/49] Update version json --- version.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index f7851cc..a860d5b 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.1", + "version": "1.6", "assemblyVersion": { "precision": "build" }, @@ -10,7 +10,8 @@ }, "publicReleaseRefSpec": [ "^refs/heads/main$", - "^refs/heads/v\\d+(?:\\.\\d+)?$" + "^refs/heads/v\\d+(?:\\.\\d+)?$", + "^refs/tags/$" ], "cloudBuild": { "setAllVariables": true From 9d2e7a954ad2814f5d1accd3430b2c317c905ed5 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 21:04:20 +0100 Subject: [PATCH 20/49] Revert CI changes --- azure-pipelines.yml | 18 +++++++++--------- nanoFramework.System.IO.FileSystem.nuspec | 3 +-- version.json | 5 ++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4888e86..4ee8e4e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -52,15 +52,15 @@ steps: runUnitTests: true unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' -# # update dependents -# - template: azure-pipelines-templates/update-dependents.yml@templates -# parameters: -# ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: -# waitBeforeUpdate: false -# ${{ else }}: -# waitBeforeUpdate: true -# repositoriesToUpdate: | -# nanoFramework.Logging +# update dependents +- template: azure-pipelines-templates/update-dependents.yml@templates + parameters: + ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: + waitBeforeUpdate: false + ${{ else }}: + waitBeforeUpdate: true + repositoriesToUpdate: | + nanoFramework.Logging # step from template @ nf-tools repo # report error diff --git a/nanoFramework.System.IO.FileSystem.nuspec b/nanoFramework.System.IO.FileSystem.nuspec index 388c54b..2136bb5 100644 --- a/nanoFramework.System.IO.FileSystem.nuspec +++ b/nanoFramework.System.IO.FileSystem.nuspec @@ -21,7 +21,6 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check - @@ -33,7 +32,7 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check - + \ No newline at end of file diff --git a/version.json b/version.json index a860d5b..f7851cc 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.6", + "version": "1.1", "assemblyVersion": { "precision": "build" }, @@ -10,8 +10,7 @@ }, "publicReleaseRefSpec": [ "^refs/heads/main$", - "^refs/heads/v\\d+(?:\\.\\d+)?$", - "^refs/tags/$" + "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": { "setAllVariables": true From 1a3978b033037fc0960a96d4885b4d8aef872c51 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 21:12:00 +0100 Subject: [PATCH 21/49] Target nF only --- System.IO.FileSystem/File.cs | 10 +-- System.IO.FileSystem/FileAttributes.cs | 71 +------------------ System.IO.FileSystem/FileShare.cs | 19 +---- .../Primitives/FileAttributesTests.cs | 13 ---- .../Primitives/FileShareTests.cs | 4 -- 5 files changed, 3 insertions(+), 114 deletions(-) diff --git a/System.IO.FileSystem/File.cs b/System.IO.FileSystem/File.cs index 2e55b26..5c2a288 100644 --- a/System.IO.FileSystem/File.cs +++ b/System.IO.FileSystem/File.cs @@ -243,15 +243,7 @@ public static FileAttributes GetAttributes(string path) /// A bitwise combination of the enumeration values. public static void SetAttributes(string path, FileAttributes fileAttributes) { - // TODO: better handle bitwise combinations - if ((byte)fileAttributes > 0x24) // nF definitely does not support it! - { - throw new NotSupportedException("Unexpected FileAttribute combination."); - } - else - { - SetAttributesNative(path, (byte)fileAttributes); - } + SetAttributesNative(path, (byte)fileAttributes); } /// diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index bfddb52..2ef57f3 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -35,75 +35,6 @@ public enum FileAttributes /// /// This file is marked to be included in incremental backup operation. /// - Archive = 0x0020, - - - // NOTE: the following file attibutes are not currently supported - // in .NET nanoFramework so are left commented out. - // They are left as comments as should align with .NET if ever required. - - ///// - ///// Reserved for future use. - ///// - //Device = 0x0040, - - ///// - ///// The file is a standard file that has no special attributes. - ///// This attribute is valid only if it is used alone. - ///// Normal is supported on Windows, Linux, and macOS. - ///// - //Normal = 0x0080, - - ///// - ///// The file is temporary. - ///// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. - ///// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. - ///// A temporary file should be deleted by the application as soon as it is no longer needed. - ///// - //Temporary = 0x0100, - - ///// - ///// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. - ///// - //SparseFile = 0x0200, - - ///// - ///// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. - ///// ReparsePoint is supported on Windows, Linux, and macOS. - ///// - //ReparsePoint = 0x0400, - - ///// - ///// The file is compressed. - ///// - //Compressed = 0x0800, - - ///// - ///// The file is offline. The data of the file is not immediately available. - ///// - //Offline = 0x1000, - - ///// - ///// The file will not be indexed by the operating system's content indexing service. - ///// - //NotContentIndexed = 0x2000, - - ///// - ///// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. - ///// For a directory, this means that encryption is the default for newly created files and directories. - ///// - //Encrypted = 0x4000, - - ///// - ///// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. - ///// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. - ///// - //IntegrityStream = 0x8000, - - ///// - ///// The file or directory is excluded from the data integrity scan. - ///// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. - ///// - //NoScrubData = 0x20000 + Archive = 0x0020 } } diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index fbad963..73ce247 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -38,23 +38,6 @@ public enum FileShare /// is not specified, any request to open the file for writing or reading (by /// this process or another process) will fail until the file is closed. /// - ReadWrite = 0x03, - - - // NOTE: the following file attibutes are not currently supported - // in .NET nanoFramework so are left commented out. - // They are left as comments as should align with .NET if ever required. - - ///// - ///// Open the file, but allow someone else to delete the file. - ///// - //Delete = 0x04, - ///// - ///// Whether the file handle should be inheritable by child processes. - ///// - ///// - ///// Note this is not directly supported like this by nanoFramework. - ///// - //Inheritable = 0x10 + ReadWrite = 0x03 } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index c9393fb..fe51d2d 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -16,19 +16,6 @@ public static void ValueTest() Assert.AreEqual(0x0004, (int)FileAttributes.System); Assert.AreEqual(0x0010, (int)FileAttributes.Directory); Assert.AreEqual(0x0020, (int)FileAttributes.Archive); - - // NOTE: The following attributes are not currently supported by nF - //Assert.AreEqual(0x0040, (int)FileAttributes.Device); - //Assert.AreEqual(0x0080, (int)FileAttributes.Normal); - //Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); - //Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); - //Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); - //Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); - //Assert.AreEqual(0x1000, (int)FileAttributes.Offline); - //Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); - //Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); - //Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); - //Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index e925d56..c6b9803 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -15,10 +15,6 @@ public static void ValueTest() Assert.AreEqual(1, (int)FileShare.Read); Assert.AreEqual(2, (int)FileShare.Write); Assert.AreEqual(3, (int)FileShare.ReadWrite); - - // NOTE: The following attributes are not currently supported by nF - //Assert.AreEqual(4, (int)FileShare.Delete); - //Assert.AreEqual(0x10, (int)FileShare.Inheritable); } } } From c2e4e273db33fac4dfe02adf4db62f7c591b6b07 Mon Sep 17 00:00:00 2001 From: nfbot Date: Wed, 3 May 2023 01:44:31 +0100 Subject: [PATCH 22/49] Update 1 NuGet dependencies ***NO_CI*** --- System.IO.FileSystem/System.IO.FileSystem.nfproj | 8 ++++---- System.IO.FileSystem/packages.config | 2 +- System.IO.FileSystem/packages.lock.json | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/System.IO.FileSystem/System.IO.FileSystem.nfproj b/System.IO.FileSystem/System.IO.FileSystem.nfproj index 0a590cf..fd41d47 100644 --- a/System.IO.FileSystem/System.IO.FileSystem.nfproj +++ b/System.IO.FileSystem/System.IO.FileSystem.nfproj @@ -1,6 +1,6 @@ - + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ @@ -91,8 +91,8 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - - + + - + \ No newline at end of file diff --git a/System.IO.FileSystem/packages.config b/System.IO.FileSystem/packages.config index 8728a1d..1095e8a 100644 --- a/System.IO.FileSystem/packages.config +++ b/System.IO.FileSystem/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/System.IO.FileSystem/packages.lock.json b/System.IO.FileSystem/packages.lock.json index b6b9af4..8792413 100644 --- a/System.IO.FileSystem/packages.lock.json +++ b/System.IO.FileSystem/packages.lock.json @@ -28,9 +28,9 @@ }, "Nerdbank.GitVersioning": { "type": "Direct", - "requested": "[3.5.119, 3.5.119]", - "resolved": "3.5.119", - "contentHash": "x8k4zV6YKZA5Rr810439lG9NngdbyPtFv0QpIYz32m1Im59kvSbEHO8gKGZoNvsfZSquayjEDUCa8acbut372g==" + "requested": "[3.6.128, 3.6.128]", + "resolved": "3.6.128", + "contentHash": "zeA+Ho3XlPgt6P9MRALlkEvfOOzDQdNseV0xia/nSfC1lSrl0+gizlWyixaHvSYUw2ru7pBIKnK451bYOjPRjA==" } } } From 759da610c0c06733211bc71acce6eaf3217326d0 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 01:30:26 +0100 Subject: [PATCH 23/49] Add initial tests Using big brother implementation: https://github.com/dotnet/runtime/tree/main/src/libraries/System.IO.FileSystem.Primitives/tests --- .../FileAccessTests.cs | 22 ++++++ .../FileAttributesTests.cs | 36 +++++++++ .../FileModeTests.cs | 25 ++++++ .../FileShareTests.cs | 25 ++++++ .../Properties/AssemblyInfo.cs | 31 ++++++++ .../System.IO.FileSystem.Tests.nfproj | 77 +++++++++++++++++++ .../nano.runsettings | 16 ++++ .../packages.config | 8 ++ nanoFramework.System.IO.FileSystem.sln | 8 ++ 9 files changed, 248 insertions(+) create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings create mode 100644 System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs new file mode 100644 index 0000000..68005ac --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using nanoFramework.TestFramework; +using System.IO; +using System.IO.FileSystem; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileAccessTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(1, (int)FileAccess.Read); + Assert.Equal(2, (int)FileAccess.Write); + Assert.Equal(3, (int)FileAccess.ReadWrite); + } + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs new file mode 100644 index 0000000..7c2366c --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using nanoFramework.TestFramework; +using System.IO; +using System.IO.FileSystem; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileAttributesTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(0x0001, (int)FileAttributes.ReadOnly); + Assert.Equal(0x0002, (int)FileAttributes.Hidden); + Assert.Equal(0x0004, (int)FileAttributes.System); + Assert.Equal(0x0010, (int)FileAttributes.Directory); + Assert.Equal(0x0020, (int)FileAttributes.Archive); + Assert.Equal(0x0040, (int)FileAttributes.Device); + Assert.Equal(0x0080, (int)FileAttributes.Normal); + Assert.Equal(0x0100, (int)FileAttributes.Temporary); + Assert.Equal(0x0200, (int)FileAttributes.SparseFile); + Assert.Equal(0x0400, (int)FileAttributes.ReparsePoint); + Assert.Equal(0x0800, (int)FileAttributes.Compressed); + Assert.Equal(0x1000, (int)FileAttributes.Offline); + Assert.Equal(0x2000, (int)FileAttributes.NotContentIndexed); + Assert.Equal(0x4000, (int)FileAttributes.Encrypted); + Assert.Equal(0x8000, (int)FileAttributes.IntegrityStream); + Assert.Equal(0x20000, (int)FileAttributes.NoScrubData); + } + + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs new file mode 100644 index 0000000..de7788f --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO.FileSystem; +using System.IO; +using nanoFramework.TestFramework; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileModeTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(1, (int)FileMode.CreateNew); + Assert.Equal(2, (int)FileMode.Create); + Assert.Equal(3, (int)FileMode.Open); + Assert.Equal(4, (int)FileMode.OpenOrCreate); + Assert.Equal(5, (int)FileMode.Truncate); + Assert.Equal(6, (int)FileMode.Append); + } + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs new file mode 100644 index 0000000..d856784 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO.FileSystem; +using System.IO; +using nanoFramework.TestFramework; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class FileShareTests + { + [TestMethod] + public static void ValueTest() + { + Assert.Equal(0, (int)FileShare.None); + Assert.Equal(1, (int)FileShare.Read); + Assert.Equal(2, (int)FileShare.Write); + Assert.Equal(3, (int)FileShare.ReadWrite); + Assert.Equal(4, (int)FileShare.Delete); + Assert.Equal(0x10, (int)FileShare.Inheritable); + } + } +} diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a3735af --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright (c) 2021 nanoFramework contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj new file mode 100644 index 0000000..5c528c6 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -0,0 +1,77 @@ + + + + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ + + + + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 59af586e-78d2-451c-95b8-b3c0571cfd97 + Library + Properties + 512 + System.IO.FileSystem.Tests + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + + ..\..\..\packages\nanoFramework.CoreLibrary.1.12.0\lib\mscorlib.dll + + + ..\..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll + + + ..\..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll + + + ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.TestFramework.dll + + + ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.UnitTestLauncher.exe + + + ..\..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll + + + + + + + + + + + + + + + + + + + + Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. + + + + \ No newline at end of file diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings new file mode 100644 index 0000000..a7622c2 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings @@ -0,0 +1,16 @@ + + + + + 1 + .\TestResults + + 120000 + + Framework40 + + + None + False + + diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config new file mode 100644 index 0000000..4c5eef8 --- /dev/null +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.System.IO.FileSystem.sln b/nanoFramework.System.IO.FileSystem.sln index 87e4591..ad11f39 100644 --- a/nanoFramework.System.IO.FileSystem.sln +++ b/nanoFramework.System.IO.FileSystem.sln @@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "System.IO.FileSystem\tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -22,6 +24,12 @@ Global {94C34547-1E2B-4967-8D1F-F3359460BB6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {94C34547-1E2B-4967-8D1F-F3359460BB6D}.Release|Any CPU.Build.0 = Release|Any CPU {94C34547-1E2B-4967-8D1F-F3359460BB6D}.Release|Any CPU.Deploy.0 = Release|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Release|Any CPU.Build.0 = Release|Any CPU + {59AF586E-78D2-451C-95B8-B3C0571CFD97}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From d7bf1a193e6700b2cc6d5cd14ed05aaa8610f457 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 02:35:38 +0100 Subject: [PATCH 24/49] Remove unused usings. Add fixes to enums. --- System.IO.FileSystem/FileAttributes.cs | 77 +++++++++++++++++-- System.IO.FileSystem/FileShare.cs | 20 ++++- .../FileAccessTests.cs | 3 - .../FileModeTests.cs | 3 - .../FileShareTests.cs | 3 - 5 files changed, 87 insertions(+), 19 deletions(-) diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 1895e65..7b4661f 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -14,26 +14,91 @@ public enum FileAttributes /// /// The file is read-only. /// - ReadOnly = 0x1, + ReadOnly = 0x0001, /// /// The file is hidden, and thus is not included in an ordinary directory listing. /// - Hidden = 0x2, + Hidden = 0x0002, /// - /// The file is a system file. That is, the file is part of the operating system or is used exclusively by the operating system. + /// The file is a system file. + /// That is, the file is part of the operating system or is used exclusively by the operating system. /// - System = 0x4, + System = 0x0004, /// /// The file is a directory. /// - Directory = 0x10, + Directory = 0x0010, /// /// This file is marked to be included in incremental backup operation. /// - Archive = 0x20, + Archive = 0x0020, + + /// + /// Reserved for future use. + /// + Device = 0x0040, + + /// + /// The file is a standard file that has no special attributes. + /// This attribute is valid only if it is used alone. + /// Normal is supported on Windows, Linux, and macOS. + /// + Normal = 0x0080, + + /// + /// The file is temporary. + /// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. + /// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. + /// A temporary file should be deleted by the application as soon as it is no longer needed. + /// + Temporary = 0x0100, + + /// + /// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. + /// + SparseFile = 0x0200, + + /// + /// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. + /// ReparsePoint is supported on Windows, Linux, and macOS. + /// + ReparsePoint = 0x0400, + + /// + /// The file is compressed. + /// + Compressed = 0x0800, + + /// + /// The file is offline. The data of the file is not immediately available. + /// + Offline = 0x1000, + + /// + /// The file will not be indexed by the operating system's content indexing service. + /// + NotContentIndexed = 0x2000, + + /// + /// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. + /// For a directory, this means that encryption is the default for newly created files and directories. + /// + Encrypted = 0x4000, + + /// + /// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. + /// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. + /// + IntegrityStream = 0x8000, + + /// + /// The file or directory is excluded from the data integrity scan. + /// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. + /// + NoScrubData = 0x20000 } } diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index 88c957d..8a0ce21 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -17,27 +17,39 @@ public enum FileShare /// No sharing. Any request to open the file (by this process or another /// process) will fail until the file is closed. /// - None = 0, + None = 0x00, /// /// Allows subsequent opening of the file for reading. If this flag is not /// specified, any request to open the file for reading (by this process or /// another process) will fail until the file is closed. /// - Read = 1, + Read = 0x01, /// /// Allows subsequent opening of the file for writing. If this flag is not /// specified, any request to open the file for writing (by this process or /// another process) will fail until the file is closed. /// - Write = 2, + Write = 0x02, /// /// Allows subsequent opening of the file for writing or reading. If this flag /// is not specified, any request to open the file for writing or reading (by /// this process or another process) will fail until the file is closed. /// - ReadWrite = 3, + ReadWrite = 0x03, + + /// + /// Open the file, but allow someone else to delete the file. + /// + Delete = 0x04, + /// + /// Whether the file handle should be inheritable by child processes. + /// + /// + /// Note this is not directly supported like this by nanoFramework. + /// + Inheritable = 0x10 } } diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs index 68005ac..b0c7ccc 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs @@ -1,10 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using nanoFramework.TestFramework; -using System.IO; -using System.IO.FileSystem; namespace System.IO.FileSystem.Tests { diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs index de7788f..e79ed0c 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.IO.FileSystem; -using System.IO; using nanoFramework.TestFramework; namespace System.IO.FileSystem.Tests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs index d856784..2b8a32c 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.IO.FileSystem; -using System.IO; using nanoFramework.TestFramework; namespace System.IO.FileSystem.Tests From a498118ec4e87764a66962091f74d838363c5f3d Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 03:16:13 +0100 Subject: [PATCH 25/49] Move tests to Primitives --- .../{ => Primitives}/FileAccessTests.cs | 2 +- .../{ => Primitives}/FileAttributesTests.cs | 5 +---- .../{ => Primitives}/FileModeTests.cs | 2 +- .../{ => Primitives}/FileShareTests.cs | 2 +- .../System.IO.FileSystem.Tests.nfproj | 8 ++++---- 5 files changed, 8 insertions(+), 11 deletions(-) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileAccessTests.cs (91%) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileAttributesTests.cs (93%) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileModeTests.cs (93%) rename System.IO.FileSystem/tests/System.IO.FileSystem.Tests/{ => Primitives}/FileShareTests.cs (93%) diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 91% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs index b0c7ccc..339d475 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAccessTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs @@ -3,7 +3,7 @@ using nanoFramework.TestFramework; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileAccessTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 93% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index 7c2366c..ef92541 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileAttributesTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -1,12 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using nanoFramework.TestFramework; -using System.IO; -using System.IO.FileSystem; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileAttributesTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 93% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs index e79ed0c..93856b6 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileModeTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs @@ -3,7 +3,7 @@ using nanoFramework.TestFramework; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileModeTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 93% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs rename to System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index 2b8a32c..f2f9f5a 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/FileShareTests.cs +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -3,7 +3,7 @@ using nanoFramework.TestFramework; -namespace System.IO.FileSystem.Tests +namespace System.IO.FileSystem.Tests.Primitives { [TestClass] public static class FileShareTests diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index 5c528c6..2efd2c9 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -27,10 +27,10 @@ $(MSBuildProjectDirectory)\nano.runsettings - - - - + + + + From f3a6aed12cff2a737d4958e17aeed0f984050433 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 28 Jul 2022 03:24:53 +0100 Subject: [PATCH 26/49] Add folders for future tests. --- .../System.IO.FileSystem.Tests.nfproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index 2efd2c9..d733582 100644 --- a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -60,6 +60,13 @@ + + + + + + + From 6d57d64dc114b64084df83da0f81591dfb9c1de9 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 20:09:32 +0100 Subject: [PATCH 27/49] Move test folder to root --- nanoFramework.System.IO.FileSystem.sln | 2 +- .../System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs | 0 .../Primitives/FileAttributesTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileModeTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileShareTests.cs | 0 .../System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs | 0 .../System.IO.FileSystem.Tests.nfproj | 0 .../tests => tests}/System.IO.FileSystem.Tests/nano.runsettings | 0 .../tests => tests}/System.IO.FileSystem.Tests/packages.config | 0 9 files changed, 1 insertion(+), 1 deletion(-) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/nano.runsettings (100%) rename {System.IO.FileSystem/tests => tests}/System.IO.FileSystem.Tests/packages.config (100%) diff --git a/nanoFramework.System.IO.FileSystem.sln b/nanoFramework.System.IO.FileSystem.sln index ad11f39..86d22a5 100644 --- a/nanoFramework.System.IO.FileSystem.sln +++ b/nanoFramework.System.IO.FileSystem.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "System.IO.FileSystem\tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs rename to tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs rename to tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj rename to tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings b/tests/System.IO.FileSystem.Tests/nano.runsettings similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/nano.runsettings rename to tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config b/tests/System.IO.FileSystem.Tests/packages.config similarity index 100% rename from System.IO.FileSystem/tests/System.IO.FileSystem.Tests/packages.config rename to tests/System.IO.FileSystem.Tests/packages.config From 29167fba1862bd6da9ccd8ccd482f381410cba08 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 20:21:38 +0100 Subject: [PATCH 28/49] Update assembily info for tests. Update some nuget packages. --- .../Properties/AssemblyInfo.cs | 10 ++++------ .../System.IO.FileSystem.Tests.nfproj | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs index a3735af..3f7a4fd 100644 --- a/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs +++ b/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs @@ -5,12 +5,10 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyCopyright("Copyright (c) 2021 nanoFramework contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly: AssemblyTitle("nanoFramework.System.IO.FileSystem.Tests")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework.System.IO.FileSystem.Tests")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index d733582..f70a250 100644 --- a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -21,6 +21,8 @@ true UnitTest v1.0 + true + true @@ -34,8 +36,9 @@ - - ..\..\..\packages\nanoFramework.CoreLibrary.1.12.0\lib\mscorlib.dll + + ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll + True ..\..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll @@ -43,11 +46,13 @@ ..\..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll - - ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll + True - - ..\..\..\packages\nanoFramework.TestFramework.1.0.205\lib\nanoFramework.UnitTestLauncher.exe + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe + True ..\..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll @@ -79,6 +84,6 @@ Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. - + \ No newline at end of file From da5e2f1716f82be7e92a26b24c943f57bb2550bf Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:34:51 +0100 Subject: [PATCH 29/49] Fix build --- .runsettings | 15 ++++++++ System.IO.FileSystem/FileStream.cs | 4 ++ .../packages.lock.json | 37 +++++++++++++++++++ nanoFramework.System.IO.FileSystem.sln | 2 +- .../System.IO.FileSystem.Tests.nfproj | 30 ++++++--------- .../nano.runsettings | 16 -------- .../packages.config | 10 ++--- 7 files changed, 74 insertions(+), 40 deletions(-) create mode 100644 .runsettings create mode 100644 Tests/System.IO.FileSystem.Tests/packages.lock.json delete mode 100644 tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/.runsettings b/.runsettings new file mode 100644 index 0000000..e82b99e --- /dev/null +++ b/.runsettings @@ -0,0 +1,15 @@ + + + + + 1 + .\TestResults + 120000 + net48 + x64 + + + None + False + + \ No newline at end of file diff --git a/System.IO.FileSystem/FileStream.cs b/System.IO.FileSystem/FileStream.cs index 28fdc88..da36975 100644 --- a/System.IO.FileSystem/FileStream.cs +++ b/System.IO.FileSystem/FileStream.cs @@ -558,6 +558,10 @@ public override void WriteByte(byte value) [MethodImpl(MethodImplOptions.InternalCall)] private extern long GetLengthNative(string path, string fileName); + /// + /// Reads bytes from the file stream. + /// + /// Bytes to read from the stream. public override int Read(SpanByte buffer) { throw new NotImplementedException(); diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json new file mode 100644 index 0000000..93c1552 --- /dev/null +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -0,0 +1,37 @@ +{ + "version": 1, + "dependencies": { + ".NETnanoFramework,Version=v1.0": { + "nanoFramework.CoreLibrary": { + "type": "Direct", + "requested": "[1.14.2, 1.14.2]", + "resolved": "1.14.2", + "contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" + }, + "nanoFramework.Runtime.Events": { + "type": "Direct", + "requested": "[1.11.6, 1.11.6]", + "resolved": "1.11.6", + "contentHash": "xkltRh/2xKaZ9zmPHbVr32s1k+e17AInUBhzxKKkUDicJKF39yzTShSklb1OL6DBER5z71SpkGLyl9IdMK9l6w==" + }, + "nanoFramework.System.IO.Streams": { + "type": "Direct", + "requested": "[1.1.38, 1.1.38]", + "resolved": "1.1.38", + "contentHash": "qEtu/lMDtr5kPKc939vO3uX8h+W0/+Qx2N3Zx005JxqGiL71e4ScecEyGPIp8v1MzRd9pkoxInUb6jOAh+eyXA==" + }, + "nanoFramework.System.Text": { + "type": "Direct", + "requested": "[1.2.37, 1.2.37]", + "resolved": "1.2.37", + "contentHash": "ORgRq0HSynSBhlXRTHdhzZiOdq/nRhdnX+DeIGw56y9OSc8dvqUz6elm97Jz+4WQ6ikpvs5PFGINAa35kBebwQ==" + }, + "nanoFramework.TestFramework": { + "type": "Direct", + "requested": "[2.1.60, 2.1.60]", + "resolved": "2.1.60", + "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" + } + } + } +} \ No newline at end of file diff --git a/nanoFramework.System.IO.FileSystem.sln b/nanoFramework.System.IO.FileSystem.sln index 86d22a5..61c4ec4 100644 --- a/nanoFramework.System.IO.FileSystem.sln +++ b/nanoFramework.System.IO.FileSystem.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.IO.FileSystem.Tests", "Tests\System.IO.FileSystem.Tests\System.IO.FileSystem.Tests.nfproj", "{59AF586E-78D2-451C-95B8-B3C0571CFD97}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index f70a250..ed0ea99 100644 --- a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -25,9 +25,6 @@ true - - $(MSBuildProjectDirectory)\nano.runsettings - @@ -41,49 +38,46 @@ True - ..\..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll + ..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll - ..\..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll + ..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll + + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll True - + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe - True - ..\..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll + ..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll - - + - - - - - + - + - Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/tests/System.IO.FileSystem.Tests/nano.runsettings b/tests/System.IO.FileSystem.Tests/nano.runsettings deleted file mode 100644 index a7622c2..0000000 --- a/tests/System.IO.FileSystem.Tests/nano.runsettings +++ /dev/null @@ -1,16 +0,0 @@ - - - - - 1 - .\TestResults - - 120000 - - Framework40 - - - None - False - - diff --git a/tests/System.IO.FileSystem.Tests/packages.config b/tests/System.IO.FileSystem.Tests/packages.config index 4c5eef8..8a3e36a 100644 --- a/tests/System.IO.FileSystem.Tests/packages.config +++ b/tests/System.IO.FileSystem.Tests/packages.config @@ -1,8 +1,8 @@  - - - - - + + + + + \ No newline at end of file From 1b23cc8a7e2ac53d5c7a0692e3e5635128110245 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:44:08 +0100 Subject: [PATCH 30/49] Windows fix temp --- .../System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileModeTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileShareTests.cs | 0 .../System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs | 0 .../System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj | 0 {tests => TestsTemp}/System.IO.FileSystem.Tests/packages.config | 0 .../System.IO.FileSystem.Tests/packages.lock.json | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj (100%) rename {tests => TestsTemp}/System.IO.FileSystem.Tests/packages.config (100%) rename {Tests => TestsTemp}/System.IO.FileSystem.Tests/packages.lock.json (100%) diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs rename to TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs diff --git a/tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs rename to TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs diff --git a/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj similarity index 100% rename from tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj rename to TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj diff --git a/tests/System.IO.FileSystem.Tests/packages.config b/TestsTemp/System.IO.FileSystem.Tests/packages.config similarity index 100% rename from tests/System.IO.FileSystem.Tests/packages.config rename to TestsTemp/System.IO.FileSystem.Tests/packages.config diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/TestsTemp/System.IO.FileSystem.Tests/packages.lock.json similarity index 100% rename from Tests/System.IO.FileSystem.Tests/packages.lock.json rename to TestsTemp/System.IO.FileSystem.Tests/packages.lock.json From 93245b5c9e5f441e16a9a6c5bfea653aa75917e4 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:45:09 +0100 Subject: [PATCH 31/49] Windows fix folder case --- .../System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileModeTests.cs | 0 .../System.IO.FileSystem.Tests/Primitives/FileShareTests.cs | 0 .../System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs | 0 .../System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj | 0 {TestsTemp => Tests}/System.IO.FileSystem.Tests/packages.config | 0 .../System.IO.FileSystem.Tests/packages.lock.json | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/packages.config (100%) rename {TestsTemp => Tests}/System.IO.FileSystem.Tests/packages.lock.json (100%) diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs rename to Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs b/Tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs rename to Tests/System.IO.FileSystem.Tests/Properties/AssemblyInfo.cs diff --git a/TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj rename to Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj diff --git a/TestsTemp/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/packages.config rename to Tests/System.IO.FileSystem.Tests/packages.config diff --git a/TestsTemp/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json similarity index 100% rename from TestsTemp/System.IO.FileSystem.Tests/packages.lock.json rename to Tests/System.IO.FileSystem.Tests/packages.lock.json From 91824b2057d42101aaf0d0f63727a3a755fca886 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 21:58:22 +0100 Subject: [PATCH 32/49] Fix test package requirements. --- .../System.IO.FileSystem.nfproj | 6 ++++-- .../System.IO.FileSystem.Tests.nfproj | 12 ------------ .../System.IO.FileSystem.Tests/packages.config | 3 --- .../packages.lock.json | 18 ------------------ 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/System.IO.FileSystem/System.IO.FileSystem.nfproj b/System.IO.FileSystem/System.IO.FileSystem.nfproj index fd41d47..041a1f8 100644 --- a/System.IO.FileSystem/System.IO.FileSystem.nfproj +++ b/System.IO.FileSystem/System.IO.FileSystem.nfproj @@ -68,9 +68,8 @@ ..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - + ..\packages\nanoFramework.Runtime.Events.1.11.6\lib\nanoFramework.Runtime.Events.dll - True ..\packages\nanoFramework.System.Text.1.2.37\lib\nanoFramework.System.Text.dll @@ -81,6 +80,9 @@ True + + + diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index ed0ea99..a73f5aa 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -37,15 +37,6 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.Runtime.Events.1.10.0\lib\nanoFramework.Runtime.Events.dll - - - ..\..\packages\nanoFramework.System.Text.1.1.3\lib\nanoFramework.System.Text.dll - - - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll True @@ -53,9 +44,6 @@ ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe - - ..\..\packages\nanoFramework.System.IO.Streams.1.0.0\lib\System.IO.Streams.dll - diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index 8a3e36a..b23bb96 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,8 +1,5 @@  - - - \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 93c1552..95ce2e7 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -8,24 +8,6 @@ "resolved": "1.14.2", "contentHash": "j1mrz4mitl5LItvmHMsw1aHzCAfvTTgIkRxA0mhs5mSpctJ/BBcuNwua5j3MspfRNKreCQPy/qZy/D9ADLL/PA==" }, - "nanoFramework.Runtime.Events": { - "type": "Direct", - "requested": "[1.11.6, 1.11.6]", - "resolved": "1.11.6", - "contentHash": "xkltRh/2xKaZ9zmPHbVr32s1k+e17AInUBhzxKKkUDicJKF39yzTShSklb1OL6DBER5z71SpkGLyl9IdMK9l6w==" - }, - "nanoFramework.System.IO.Streams": { - "type": "Direct", - "requested": "[1.1.38, 1.1.38]", - "resolved": "1.1.38", - "contentHash": "qEtu/lMDtr5kPKc939vO3uX8h+W0/+Qx2N3Zx005JxqGiL71e4ScecEyGPIp8v1MzRd9pkoxInUb6jOAh+eyXA==" - }, - "nanoFramework.System.Text": { - "type": "Direct", - "requested": "[1.2.37, 1.2.37]", - "resolved": "1.2.37", - "contentHash": "ORgRq0HSynSBhlXRTHdhzZiOdq/nRhdnX+DeIGw56y9OSc8dvqUz6elm97Jz+4WQ6ikpvs5PFGINAa35kBebwQ==" - }, "nanoFramework.TestFramework": { "type": "Direct", "requested": "[2.1.60, 2.1.60]", From aba8cd798625db4dfd77c09c0e362397916a2e72 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 22:05:25 +0100 Subject: [PATCH 33/49] Remove un-needed packages. Something seems broken with the latest test framework (nuget) so CI build will fail. --- .../System.IO.FileSystem.Tests.nfproj | 12 ++++++------ .../System.IO.FileSystem.Tests/nano.runsettings | 17 +++++++++++++++++ .../System.IO.FileSystem.Tests/packages.config | 2 +- .../packages.lock.json | 6 +++--- 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 Tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index a73f5aa..ba4e32f 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -37,15 +37,15 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll - True + + ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.TestFramework.dll - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.UnitTestLauncher.exe + @@ -61,11 +61,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/nano.runsettings b/Tests/System.IO.FileSystem.Tests/nano.runsettings new file mode 100644 index 0000000..93ce85e --- /dev/null +++ b/Tests/System.IO.FileSystem.Tests/nano.runsettings @@ -0,0 +1,17 @@ + + + + + .\TestResults + 120000 + net48 + x64 + + + None + False + COM3 + + + + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index b23bb96..1ebb847 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 95ce2e7..67f9a72 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -10,9 +10,9 @@ }, "nanoFramework.TestFramework": { "type": "Direct", - "requested": "[2.1.60, 2.1.60]", - "resolved": "2.1.60", - "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" + "requested": "[2.1.71, 2.1.71]", + "resolved": "2.1.71", + "contentHash": "V2SYltqAwkw2ZSAZlyG515qIt2T3PL7v8UMF0GrknmTleA0HJ1qNHDXw4ymaV+RVrMexP9c27UuzQZBAKFxo9Q==" } } } From 318ca12662778327943bdeed4d3ab352d7628518 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 22:39:55 +0100 Subject: [PATCH 34/49] Revert "Remove un-needed packages." This reverts commit 5526eb6f6c2b41a9b7c0fe7d783aa5d5e632d866. --- .../System.IO.FileSystem.Tests.nfproj | 12 ++++++------ .../System.IO.FileSystem.Tests/nano.runsettings | 17 ----------------- .../System.IO.FileSystem.Tests/packages.config | 2 +- .../packages.lock.json | 6 +++--- 4 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 Tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index ba4e32f..a73f5aa 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -37,15 +37,15 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll + True - ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe - @@ -61,11 +61,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/nano.runsettings b/Tests/System.IO.FileSystem.Tests/nano.runsettings deleted file mode 100644 index 93ce85e..0000000 --- a/Tests/System.IO.FileSystem.Tests/nano.runsettings +++ /dev/null @@ -1,17 +0,0 @@ - - - - - .\TestResults - 120000 - net48 - x64 - - - None - False - COM3 - - - - \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index 1ebb847..b23bb96 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 67f9a72..95ce2e7 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -10,9 +10,9 @@ }, "nanoFramework.TestFramework": { "type": "Direct", - "requested": "[2.1.71, 2.1.71]", - "resolved": "2.1.71", - "contentHash": "V2SYltqAwkw2ZSAZlyG515qIt2T3PL7v8UMF0GrknmTleA0HJ1qNHDXw4ymaV+RVrMexP9c27UuzQZBAKFxo9Q==" + "requested": "[2.1.60, 2.1.60]", + "resolved": "2.1.60", + "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" } } } From 262392b1af1c6956892f418dede87139e6e55e16 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 24 Apr 2023 22:47:00 +0100 Subject: [PATCH 35/49] Fix deprecation warnings --- .../Primitives/FileAccessTests.cs | 6 ++-- .../Primitives/FileAttributesTests.cs | 32 +++++++++---------- .../Primitives/FileModeTests.cs | 12 +++---- .../Primitives/FileShareTests.cs | 12 +++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs index 339d475..9bb4ad4 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAccessTests.cs @@ -11,9 +11,9 @@ public static class FileAccessTests [TestMethod] public static void ValueTest() { - Assert.Equal(1, (int)FileAccess.Read); - Assert.Equal(2, (int)FileAccess.Write); - Assert.Equal(3, (int)FileAccess.ReadWrite); + Assert.AreEqual(1, (int)FileAccess.Read); + Assert.AreEqual(2, (int)FileAccess.Write); + Assert.AreEqual(3, (int)FileAccess.ReadWrite); } } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index ef92541..40585d3 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -11,22 +11,22 @@ public static class FileAttributesTests [TestMethod] public static void ValueTest() { - Assert.Equal(0x0001, (int)FileAttributes.ReadOnly); - Assert.Equal(0x0002, (int)FileAttributes.Hidden); - Assert.Equal(0x0004, (int)FileAttributes.System); - Assert.Equal(0x0010, (int)FileAttributes.Directory); - Assert.Equal(0x0020, (int)FileAttributes.Archive); - Assert.Equal(0x0040, (int)FileAttributes.Device); - Assert.Equal(0x0080, (int)FileAttributes.Normal); - Assert.Equal(0x0100, (int)FileAttributes.Temporary); - Assert.Equal(0x0200, (int)FileAttributes.SparseFile); - Assert.Equal(0x0400, (int)FileAttributes.ReparsePoint); - Assert.Equal(0x0800, (int)FileAttributes.Compressed); - Assert.Equal(0x1000, (int)FileAttributes.Offline); - Assert.Equal(0x2000, (int)FileAttributes.NotContentIndexed); - Assert.Equal(0x4000, (int)FileAttributes.Encrypted); - Assert.Equal(0x8000, (int)FileAttributes.IntegrityStream); - Assert.Equal(0x20000, (int)FileAttributes.NoScrubData); + Assert.AreEqual(0x0001, (int)FileAttributes.ReadOnly); + Assert.AreEqual(0x0002, (int)FileAttributes.Hidden); + Assert.AreEqual(0x0004, (int)FileAttributes.System); + Assert.AreEqual(0x0010, (int)FileAttributes.Directory); + Assert.AreEqual(0x0020, (int)FileAttributes.Archive); + Assert.AreEqual(0x0040, (int)FileAttributes.Device); + Assert.AreEqual(0x0080, (int)FileAttributes.Normal); + Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); + Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); + Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); + Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); + Assert.AreEqual(0x1000, (int)FileAttributes.Offline); + Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); + Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); + Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); + Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs index 93856b6..b41318d 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileModeTests.cs @@ -11,12 +11,12 @@ public static class FileModeTests [TestMethod] public static void ValueTest() { - Assert.Equal(1, (int)FileMode.CreateNew); - Assert.Equal(2, (int)FileMode.Create); - Assert.Equal(3, (int)FileMode.Open); - Assert.Equal(4, (int)FileMode.OpenOrCreate); - Assert.Equal(5, (int)FileMode.Truncate); - Assert.Equal(6, (int)FileMode.Append); + Assert.AreEqual(1, (int)FileMode.CreateNew); + Assert.AreEqual(2, (int)FileMode.Create); + Assert.AreEqual(3, (int)FileMode.Open); + Assert.AreEqual(4, (int)FileMode.OpenOrCreate); + Assert.AreEqual(5, (int)FileMode.Truncate); + Assert.AreEqual(6, (int)FileMode.Append); } } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index f2f9f5a..4dd430c 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -11,12 +11,12 @@ public static class FileShareTests [TestMethod] public static void ValueTest() { - Assert.Equal(0, (int)FileShare.None); - Assert.Equal(1, (int)FileShare.Read); - Assert.Equal(2, (int)FileShare.Write); - Assert.Equal(3, (int)FileShare.ReadWrite); - Assert.Equal(4, (int)FileShare.Delete); - Assert.Equal(0x10, (int)FileShare.Inheritable); + Assert.AreEqual(0, (int)FileShare.None); + Assert.AreEqual(1, (int)FileShare.Read); + Assert.AreEqual(2, (int)FileShare.Write); + Assert.AreEqual(3, (int)FileShare.ReadWrite); + Assert.AreEqual(4, (int)FileShare.Delete); + Assert.AreEqual(0x10, (int)FileShare.Inheritable); } } } From e3a3e484cd2c4966a8b819b581cdfca2eba780cc Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 17:09:00 +0100 Subject: [PATCH 36/49] Comment out unused attributes As nF does not (currently) use them. --- System.IO.FileSystem/FileAttributes.cs | 126 +++++++++--------- System.IO.FileSystem/FileShare.cs | 22 +-- .../Primitives/FileAttributesTests.cs | 22 +-- .../Primitives/FileShareTests.cs | 4 +- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 7b4661f..5fe250a 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -37,68 +37,68 @@ public enum FileAttributes /// Archive = 0x0020, - /// - /// Reserved for future use. - /// - Device = 0x0040, - - /// - /// The file is a standard file that has no special attributes. - /// This attribute is valid only if it is used alone. - /// Normal is supported on Windows, Linux, and macOS. - /// - Normal = 0x0080, - - /// - /// The file is temporary. - /// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. - /// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. - /// A temporary file should be deleted by the application as soon as it is no longer needed. - /// - Temporary = 0x0100, - - /// - /// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. - /// - SparseFile = 0x0200, - - /// - /// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. - /// ReparsePoint is supported on Windows, Linux, and macOS. - /// - ReparsePoint = 0x0400, - - /// - /// The file is compressed. - /// - Compressed = 0x0800, - - /// - /// The file is offline. The data of the file is not immediately available. - /// - Offline = 0x1000, - - /// - /// The file will not be indexed by the operating system's content indexing service. - /// - NotContentIndexed = 0x2000, - - /// - /// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. - /// For a directory, this means that encryption is the default for newly created files and directories. - /// - Encrypted = 0x4000, - - /// - /// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. - /// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. - /// - IntegrityStream = 0x8000, - - /// - /// The file or directory is excluded from the data integrity scan. - /// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. - /// - NoScrubData = 0x20000 + ///// + ///// Reserved for future use. + ///// + //Device = 0x0040, + + ///// + ///// The file is a standard file that has no special attributes. + ///// This attribute is valid only if it is used alone. + ///// Normal is supported on Windows, Linux, and macOS. + ///// + //Normal = 0x0080, + + ///// + ///// The file is temporary. + ///// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. + ///// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. + ///// A temporary file should be deleted by the application as soon as it is no longer needed. + ///// + //Temporary = 0x0100, + + ///// + ///// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. + ///// + //SparseFile = 0x0200, + + ///// + ///// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. + ///// ReparsePoint is supported on Windows, Linux, and macOS. + ///// + //ReparsePoint = 0x0400, + + ///// + ///// The file is compressed. + ///// + //Compressed = 0x0800, + + ///// + ///// The file is offline. The data of the file is not immediately available. + ///// + //Offline = 0x1000, + + ///// + ///// The file will not be indexed by the operating system's content indexing service. + ///// + //NotContentIndexed = 0x2000, + + ///// + ///// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. + ///// For a directory, this means that encryption is the default for newly created files and directories. + ///// + //Encrypted = 0x4000, + + ///// + ///// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. + ///// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. + ///// + //IntegrityStream = 0x8000, + + ///// + ///// The file or directory is excluded from the data integrity scan. + ///// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. + ///// + //NoScrubData = 0x20000 } } diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index 8a0ce21..9133d8f 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -40,16 +40,16 @@ public enum FileShare /// ReadWrite = 0x03, - /// - /// Open the file, but allow someone else to delete the file. - /// - Delete = 0x04, - /// - /// Whether the file handle should be inheritable by child processes. - /// - /// - /// Note this is not directly supported like this by nanoFramework. - /// - Inheritable = 0x10 + ///// + ///// Open the file, but allow someone else to delete the file. + ///// + //Delete = 0x04, + ///// + ///// Whether the file handle should be inheritable by child processes. + ///// + ///// + ///// Note this is not directly supported like this by nanoFramework. + ///// + //Inheritable = 0x10 } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index 40585d3..0c469db 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -16,17 +16,17 @@ public static void ValueTest() Assert.AreEqual(0x0004, (int)FileAttributes.System); Assert.AreEqual(0x0010, (int)FileAttributes.Directory); Assert.AreEqual(0x0020, (int)FileAttributes.Archive); - Assert.AreEqual(0x0040, (int)FileAttributes.Device); - Assert.AreEqual(0x0080, (int)FileAttributes.Normal); - Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); - Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); - Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); - Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); - Assert.AreEqual(0x1000, (int)FileAttributes.Offline); - Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); - Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); - Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); - Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); + //Assert.AreEqual(0x0040, (int)FileAttributes.Device); + //Assert.AreEqual(0x0080, (int)FileAttributes.Normal); + //Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); + //Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); + //Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); + //Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); + //Assert.AreEqual(0x1000, (int)FileAttributes.Offline); + //Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); + //Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); + //Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); + //Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index 4dd430c..b269504 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -15,8 +15,8 @@ public static void ValueTest() Assert.AreEqual(1, (int)FileShare.Read); Assert.AreEqual(2, (int)FileShare.Write); Assert.AreEqual(3, (int)FileShare.ReadWrite); - Assert.AreEqual(4, (int)FileShare.Delete); - Assert.AreEqual(0x10, (int)FileShare.Inheritable); + //Assert.AreEqual(4, (int)FileShare.Delete); + //Assert.AreEqual(0x10, (int)FileShare.Inheritable); } } } From e502f1d336af418360955e3bb1b36183441b1567 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 17:54:49 +0100 Subject: [PATCH 37/49] Minor fixes and comment improvements --- System.IO.FileSystem/FileAttributes.cs | 5 +++++ System.IO.FileSystem/FileShare.cs | 7 ++++++- System.IO.FileSystem/FileStream.cs | 2 +- .../Primitives/FileAttributesTests.cs | 2 ++ .../Primitives/FileShareTests.cs | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 5fe250a..bfddb52 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -37,6 +37,11 @@ public enum FileAttributes /// Archive = 0x0020, + + // NOTE: the following file attibutes are not currently supported + // in .NET nanoFramework so are left commented out. + // They are left as comments as should align with .NET if ever required. + ///// ///// Reserved for future use. ///// diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index 9133d8f..fbad963 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -7,7 +7,7 @@ namespace System.IO { /// /// Contains constants for controlling file sharing options while - /// opening files. You can specify what access other processes trying + /// opening files. You can specify what access other processes trying /// to open the same file concurrently can have. /// [Flags] @@ -40,6 +40,11 @@ public enum FileShare /// ReadWrite = 0x03, + + // NOTE: the following file attibutes are not currently supported + // in .NET nanoFramework so are left commented out. + // They are left as comments as should align with .NET if ever required. + ///// ///// Open the file, but allow someone else to delete the file. ///// diff --git a/System.IO.FileSystem/FileStream.cs b/System.IO.FileSystem/FileStream.cs index da36975..7021253 100644 --- a/System.IO.FileSystem/FileStream.cs +++ b/System.IO.FileSystem/FileStream.cs @@ -561,7 +561,7 @@ public override void WriteByte(byte value) /// /// Reads bytes from the file stream. /// - /// Bytes to read from the stream. + /// Bytes to read from the stream. public override int Read(SpanByte buffer) { throw new NotImplementedException(); diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index 0c469db..c9393fb 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -16,6 +16,8 @@ public static void ValueTest() Assert.AreEqual(0x0004, (int)FileAttributes.System); Assert.AreEqual(0x0010, (int)FileAttributes.Directory); Assert.AreEqual(0x0020, (int)FileAttributes.Archive); + + // NOTE: The following attributes are not currently supported by nF //Assert.AreEqual(0x0040, (int)FileAttributes.Device); //Assert.AreEqual(0x0080, (int)FileAttributes.Normal); //Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index b269504..e925d56 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -15,6 +15,8 @@ public static void ValueTest() Assert.AreEqual(1, (int)FileShare.Read); Assert.AreEqual(2, (int)FileShare.Write); Assert.AreEqual(3, (int)FileShare.ReadWrite); + + // NOTE: The following attributes are not currently supported by nF //Assert.AreEqual(4, (int)FileShare.Delete); //Assert.AreEqual(0x10, (int)FileShare.Inheritable); } From a3af1bdfb1ab70c4e9fb6d79f1d2f8fa24cad815 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 18:33:39 +0100 Subject: [PATCH 38/49] Update azure-pipelines.yml run tests --- azure-pipelines.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 977787a..18f1266 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,10 +20,6 @@ trigger: - config/* - .github/* - tags: - include: - - v* - # PR always trigger build pr: autoCancel: true @@ -53,16 +49,8 @@ steps: - template: azure-pipelines-templates/class-lib-build.yml@templates parameters: sonarCloudProject: 'nanoframework_lib-System.IO.FileSystem' - -# update dependents -- template: azure-pipelines-templates/update-dependents.yml@templates - parameters: - ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: - waitBeforeUpdate: false - ${{ else }}: - waitBeforeUpdate: true - repositoriesToUpdate: | - nanoFramework.Logging + runUnitTests: true + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' # step from template @ nf-tools repo # report error From 9e78cb3c2cd340b4db62851b142ddc4650d7885b Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 20:10:57 +0100 Subject: [PATCH 39/49] Add set check for file attributes. --- System.IO.FileSystem/File.cs | 10 +++++++++- azure-pipelines.yml | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/System.IO.FileSystem/File.cs b/System.IO.FileSystem/File.cs index 5c2a288..2e55b26 100644 --- a/System.IO.FileSystem/File.cs +++ b/System.IO.FileSystem/File.cs @@ -243,7 +243,15 @@ public static FileAttributes GetAttributes(string path) /// A bitwise combination of the enumeration values. public static void SetAttributes(string path, FileAttributes fileAttributes) { - SetAttributesNative(path, (byte)fileAttributes); + // TODO: better handle bitwise combinations + if ((byte)fileAttributes > 0x24) // nF definitely does not support it! + { + throw new NotSupportedException("Unexpected FileAttribute combination."); + } + else + { + SetAttributesNative(path, (byte)fileAttributes); + } } /// diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 18f1266..4888e86 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -52,6 +52,16 @@ steps: runUnitTests: true unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' +# # update dependents +# - template: azure-pipelines-templates/update-dependents.yml@templates +# parameters: +# ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: +# waitBeforeUpdate: false +# ${{ else }}: +# waitBeforeUpdate: true +# repositoriesToUpdate: | +# nanoFramework.Logging + # step from template @ nf-tools repo # report error - template: azure-pipelines-templates/discord-webhook-task.yml@templates From d02ae6757477ff9be889aa2bbed8617198e110b8 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 20:35:08 +0100 Subject: [PATCH 40/49] Fixes for nuspec --- nanoFramework.System.IO.FileSystem.nuspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nanoFramework.System.IO.FileSystem.nuspec b/nanoFramework.System.IO.FileSystem.nuspec index 2136bb5..388c54b 100644 --- a/nanoFramework.System.IO.FileSystem.nuspec +++ b/nanoFramework.System.IO.FileSystem.nuspec @@ -21,6 +21,7 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check + @@ -32,7 +33,7 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check - + \ No newline at end of file From 565fba3b535933f96b4c44111798c4ecd50f8942 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 20:41:04 +0100 Subject: [PATCH 41/49] Update version json --- version.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index f7851cc..a860d5b 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.1", + "version": "1.6", "assemblyVersion": { "precision": "build" }, @@ -10,7 +10,8 @@ }, "publicReleaseRefSpec": [ "^refs/heads/main$", - "^refs/heads/v\\d+(?:\\.\\d+)?$" + "^refs/heads/v\\d+(?:\\.\\d+)?$", + "^refs/tags/$" ], "cloudBuild": { "setAllVariables": true From fd05c8aad2ab82e3415afb7ac885b413748fa779 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 21:04:20 +0100 Subject: [PATCH 42/49] Revert CI changes --- azure-pipelines.yml | 18 +++++++++--------- nanoFramework.System.IO.FileSystem.nuspec | 3 +-- version.json | 5 ++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4888e86..4ee8e4e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -52,15 +52,15 @@ steps: runUnitTests: true unitTestRunsettings: '$(System.DefaultWorkingDirectory)\.runsettings' -# # update dependents -# - template: azure-pipelines-templates/update-dependents.yml@templates -# parameters: -# ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: -# waitBeforeUpdate: false -# ${{ else }}: -# waitBeforeUpdate: true -# repositoriesToUpdate: | -# nanoFramework.Logging +# update dependents +- template: azure-pipelines-templates/update-dependents.yml@templates + parameters: + ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }}: + waitBeforeUpdate: false + ${{ else }}: + waitBeforeUpdate: true + repositoriesToUpdate: | + nanoFramework.Logging # step from template @ nf-tools repo # report error diff --git a/nanoFramework.System.IO.FileSystem.nuspec b/nanoFramework.System.IO.FileSystem.nuspec index 388c54b..2136bb5 100644 --- a/nanoFramework.System.IO.FileSystem.nuspec +++ b/nanoFramework.System.IO.FileSystem.nuspec @@ -21,7 +21,6 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check - @@ -33,7 +32,7 @@ This package requires a target with System.IO.FileSystem v$nativeVersion$ (check - + \ No newline at end of file diff --git a/version.json b/version.json index a860d5b..f7851cc 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.6", + "version": "1.1", "assemblyVersion": { "precision": "build" }, @@ -10,8 +10,7 @@ }, "publicReleaseRefSpec": [ "^refs/heads/main$", - "^refs/heads/v\\d+(?:\\.\\d+)?$", - "^refs/tags/$" + "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": { "setAllVariables": true From 500da6086c53a6b3a1a485e7a676776f6fe50958 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 26 Apr 2023 21:12:00 +0100 Subject: [PATCH 43/49] Target nF only --- System.IO.FileSystem/File.cs | 10 +-- System.IO.FileSystem/FileAttributes.cs | 71 +------------------ System.IO.FileSystem/FileShare.cs | 19 +---- .../Primitives/FileAttributesTests.cs | 13 ---- .../Primitives/FileShareTests.cs | 4 -- 5 files changed, 3 insertions(+), 114 deletions(-) diff --git a/System.IO.FileSystem/File.cs b/System.IO.FileSystem/File.cs index 2e55b26..5c2a288 100644 --- a/System.IO.FileSystem/File.cs +++ b/System.IO.FileSystem/File.cs @@ -243,15 +243,7 @@ public static FileAttributes GetAttributes(string path) /// A bitwise combination of the enumeration values. public static void SetAttributes(string path, FileAttributes fileAttributes) { - // TODO: better handle bitwise combinations - if ((byte)fileAttributes > 0x24) // nF definitely does not support it! - { - throw new NotSupportedException("Unexpected FileAttribute combination."); - } - else - { - SetAttributesNative(path, (byte)fileAttributes); - } + SetAttributesNative(path, (byte)fileAttributes); } /// diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index bfddb52..2ef57f3 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -35,75 +35,6 @@ public enum FileAttributes /// /// This file is marked to be included in incremental backup operation. /// - Archive = 0x0020, - - - // NOTE: the following file attibutes are not currently supported - // in .NET nanoFramework so are left commented out. - // They are left as comments as should align with .NET if ever required. - - ///// - ///// Reserved for future use. - ///// - //Device = 0x0040, - - ///// - ///// The file is a standard file that has no special attributes. - ///// This attribute is valid only if it is used alone. - ///// Normal is supported on Windows, Linux, and macOS. - ///// - //Normal = 0x0080, - - ///// - ///// The file is temporary. - ///// A temporary file contains data that is needed while an application is executing but is not needed after the application is finished. - ///// File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage. - ///// A temporary file should be deleted by the application as soon as it is no longer needed. - ///// - //Temporary = 0x0100, - - ///// - ///// The file is a sparse file. Sparse files are typically large files whose data consists of mostly zeros. - ///// - //SparseFile = 0x0200, - - ///// - ///// The file contains a reparse point, which is a block of user-defined data associated with a file or a directory. - ///// ReparsePoint is supported on Windows, Linux, and macOS. - ///// - //ReparsePoint = 0x0400, - - ///// - ///// The file is compressed. - ///// - //Compressed = 0x0800, - - ///// - ///// The file is offline. The data of the file is not immediately available. - ///// - //Offline = 0x1000, - - ///// - ///// The file will not be indexed by the operating system's content indexing service. - ///// - //NotContentIndexed = 0x2000, - - ///// - ///// The file or directory is encrypted. For a file, this means that all data in the file is encrypted. - ///// For a directory, this means that encryption is the default for newly created files and directories. - ///// - //Encrypted = 0x4000, - - ///// - ///// The file or directory includes data integrity support. When this value is applied to a file, all data streams in the file have integrity support. - ///// When this value is applied to a directory, all new files and subdirectories within that directory, by default, include integrity support. - ///// - //IntegrityStream = 0x8000, - - ///// - ///// The file or directory is excluded from the data integrity scan. - ///// When this value is applied to a directory, by default, all new files and subdirectories within that directory are excluded from data integrity. - ///// - //NoScrubData = 0x20000 + Archive = 0x0020 } } diff --git a/System.IO.FileSystem/FileShare.cs b/System.IO.FileSystem/FileShare.cs index fbad963..73ce247 100644 --- a/System.IO.FileSystem/FileShare.cs +++ b/System.IO.FileSystem/FileShare.cs @@ -38,23 +38,6 @@ public enum FileShare /// is not specified, any request to open the file for writing or reading (by /// this process or another process) will fail until the file is closed. /// - ReadWrite = 0x03, - - - // NOTE: the following file attibutes are not currently supported - // in .NET nanoFramework so are left commented out. - // They are left as comments as should align with .NET if ever required. - - ///// - ///// Open the file, but allow someone else to delete the file. - ///// - //Delete = 0x04, - ///// - ///// Whether the file handle should be inheritable by child processes. - ///// - ///// - ///// Note this is not directly supported like this by nanoFramework. - ///// - //Inheritable = 0x10 + ReadWrite = 0x03 } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs index c9393fb..fe51d2d 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileAttributesTests.cs @@ -16,19 +16,6 @@ public static void ValueTest() Assert.AreEqual(0x0004, (int)FileAttributes.System); Assert.AreEqual(0x0010, (int)FileAttributes.Directory); Assert.AreEqual(0x0020, (int)FileAttributes.Archive); - - // NOTE: The following attributes are not currently supported by nF - //Assert.AreEqual(0x0040, (int)FileAttributes.Device); - //Assert.AreEqual(0x0080, (int)FileAttributes.Normal); - //Assert.AreEqual(0x0100, (int)FileAttributes.Temporary); - //Assert.AreEqual(0x0200, (int)FileAttributes.SparseFile); - //Assert.AreEqual(0x0400, (int)FileAttributes.ReparsePoint); - //Assert.AreEqual(0x0800, (int)FileAttributes.Compressed); - //Assert.AreEqual(0x1000, (int)FileAttributes.Offline); - //Assert.AreEqual(0x2000, (int)FileAttributes.NotContentIndexed); - //Assert.AreEqual(0x4000, (int)FileAttributes.Encrypted); - //Assert.AreEqual(0x8000, (int)FileAttributes.IntegrityStream); - //Assert.AreEqual(0x20000, (int)FileAttributes.NoScrubData); } } diff --git a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs index e925d56..c6b9803 100644 --- a/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs +++ b/Tests/System.IO.FileSystem.Tests/Primitives/FileShareTests.cs @@ -15,10 +15,6 @@ public static void ValueTest() Assert.AreEqual(1, (int)FileShare.Read); Assert.AreEqual(2, (int)FileShare.Write); Assert.AreEqual(3, (int)FileShare.ReadWrite); - - // NOTE: The following attributes are not currently supported by nF - //Assert.AreEqual(4, (int)FileShare.Delete); - //Assert.AreEqual(0x10, (int)FileShare.Inheritable); } } } From dbc5fd6d352a33715261bfe3ec7afd88b8b2d7a3 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 8 May 2023 20:00:49 +0100 Subject: [PATCH 44/49] Update test nuget Seems broken locally, but does build! --- .../System.IO.FileSystem.Tests.nfproj | 11 +++++++---- .../System.IO.FileSystem.Tests/nano.runsettings | 17 +++++++++++++++++ .../System.IO.FileSystem.Tests/packages.config | 2 +- .../packages.lock.json | 6 +++--- 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 Tests/System.IO.FileSystem.Tests/nano.runsettings diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index a73f5aa..1cbf8b3 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -4,6 +4,9 @@ $(MSBuildExtensionsPath)\nanoFramework\v1.0\ + + $(MSBuildProjectDirectory)\nano.runsettings + @@ -37,15 +40,15 @@ ..\..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll True - - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.TestFramework.dll - True + + ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.TestFramework.dll - ..\..\packages\nanoFramework.TestFramework.2.1.60\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.2.1.71\lib\nanoFramework.UnitTestLauncher.exe + diff --git a/Tests/System.IO.FileSystem.Tests/nano.runsettings b/Tests/System.IO.FileSystem.Tests/nano.runsettings new file mode 100644 index 0000000..e593478 --- /dev/null +++ b/Tests/System.IO.FileSystem.Tests/nano.runsettings @@ -0,0 +1,17 @@ + + + + + .\TestResults + 120000 + net48 + x64 + + + None + False + + + + + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.config b/Tests/System.IO.FileSystem.Tests/packages.config index b23bb96..1ebb847 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.config +++ b/Tests/System.IO.FileSystem.Tests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/System.IO.FileSystem.Tests/packages.lock.json b/Tests/System.IO.FileSystem.Tests/packages.lock.json index 95ce2e7..67f9a72 100644 --- a/Tests/System.IO.FileSystem.Tests/packages.lock.json +++ b/Tests/System.IO.FileSystem.Tests/packages.lock.json @@ -10,9 +10,9 @@ }, "nanoFramework.TestFramework": { "type": "Direct", - "requested": "[2.1.60, 2.1.60]", - "resolved": "2.1.60", - "contentHash": "YiZgZUdihLKQyYWlv9udYydyI/OKLz5Xhu/rBkQS2M4+zR3WMhLAVUkQJuPoFFYp7rRHFqCpxrn1+zKQC8El/g==" + "requested": "[2.1.71, 2.1.71]", + "resolved": "2.1.71", + "contentHash": "V2SYltqAwkw2ZSAZlyG515qIt2T3PL7v8UMF0GrknmTleA0HJ1qNHDXw4ymaV+RVrMexP9c27UuzQZBAKFxo9Q==" } } } From a1e2e3ce61e04f244f1bf45c16bb9c3a029e8d17 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 8 May 2023 20:11:22 +0100 Subject: [PATCH 45/49] part revert pipeline change --- azure-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4ee8e4e..1ff0e03 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,10 @@ trigger: - config/* - .github/* + tags: + include: + - v* + # PR always trigger build pr: autoCancel: true From 6746cf6b38e9586d212dbe20f4ddaec5bf488465 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 8 May 2023 20:47:51 +0100 Subject: [PATCH 46/49] Fixes for latest test nuget. --- .../System.IO.FileSystem.Tests.nfproj | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index 1cbf8b3..e7f7e31 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -64,11 +64,4 @@ - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - - - \ No newline at end of file From 726d4c1681b14ec57aab5cc5e7151aca8ebc41e5 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 8 May 2023 21:19:58 +0100 Subject: [PATCH 47/49] Add write file test skeleton. --- .../System.IO.FileSystem.Tests.nfproj | 5 +-- .../WriteFileTests.cs | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Tests/System.IO.FileSystem.Tests/WriteFileTests.cs diff --git a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj index e7f7e31..68e729d 100644 --- a/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj +++ b/Tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.nfproj @@ -4,9 +4,9 @@ $(MSBuildExtensionsPath)\nanoFramework\v1.0\ - + $(MSBuildProjectDirectory)\nano.runsettings - + @@ -34,6 +34,7 @@ + diff --git a/Tests/System.IO.FileSystem.Tests/WriteFileTests.cs b/Tests/System.IO.FileSystem.Tests/WriteFileTests.cs new file mode 100644 index 0000000..ab246d4 --- /dev/null +++ b/Tests/System.IO.FileSystem.Tests/WriteFileTests.cs @@ -0,0 +1,35 @@ + + +using nanoFramework.TestFramework; +using System.Diagnostics; +using System; +using System.IO; +using System.Threading; + +namespace System.IO.FileSystem.Tests +{ + [TestClass] + public static class WriteFileTests + { + [TestMethod] + public static void FileStreamSeek() + { + //var drive = "I:" + //var stream = new FileStream($"{drive}\testdata.bin", FileMode.Create, FileAccess.Write); + //var firstData = new byte[] { 1, 2, 3 }; + //stream.Write(firstData, 0, firstData.Length); + //var secondData = new byte[] { 6, 7, 8 }; + //stream.Write(secondData, 0, secondData.Length); + //firstData = new byte[] { 0, 2, 3 }; + //stream.Seek(0, SeekOrigin.Begin); + //stream.Write(firstData, 0, firstData.Length); + //stream.Dispose(); + + //var data = new FileStream($"{drive}\testdata.bin", FileMode.Open, FileAccess.Read); + //Console.WriteLine(data.Length.ToString()); + //data.Dispose(); + Console.WriteLine("TODO: TEST SHOULD INCLUDE ME!"); + } + + } +} From 8e51d34f6f8cbd8a784988ccddd6f84ae8cb2286 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 8 May 2023 21:51:23 +0100 Subject: [PATCH 48/49] Add some minor comment improvements. --- System.IO.FileSystem/Directory.cs | 2 +- System.IO.FileSystem/File.cs | 8 ++++---- System.IO.FileSystem/FileStream.cs | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/System.IO.FileSystem/Directory.cs b/System.IO.FileSystem/Directory.cs index a93155a..1e6da96 100644 --- a/System.IO.FileSystem/Directory.cs +++ b/System.IO.FileSystem/Directory.cs @@ -17,7 +17,7 @@ public static class Directory /// /// Determines a list of available logical drives. /// - /// String[] of available drives, ex. "D:\\" + /// A String[] of available storage drive letters." public static string[] GetLogicalDrives() { return GetLogicalDrivesNative(); diff --git a/System.IO.FileSystem/File.cs b/System.IO.FileSystem/File.cs index 5c2a288..97736a9 100644 --- a/System.IO.FileSystem/File.cs +++ b/System.IO.FileSystem/File.cs @@ -66,7 +66,7 @@ public static void Copy( using (FileStream writer = new FileStream(destFileName, writerMode, FileAccess.Write)) { long fileLength = reader.Length; - //writer.SetLength(fileLength); + ////writer.SetLength(fileLength); byte[] buffer = new byte[_defaultCopyBufferSize]; @@ -198,12 +198,12 @@ public static void Move( #pragma warning restore S112 // General exceptions should never be thrown } - // TODO: File Handling missing + // FIXME: File Handling missing // Check the volume of files if (Path.GetPathRoot(sourceFileName) != Path.GetPathRoot(destFileName)) { - // Cross Volume move (FAT_FS move not working) + // FIXME: Cross Volume move (FAT_FS move not working) Copy(sourceFileName, destFileName); Delete(sourceFileName); } @@ -249,7 +249,7 @@ public static void SetAttributes(string path, FileAttributes fileAttributes) /// /// Determines the time of the last write/modification to file under given path. /// - /// + /// The path to the file. /// Time of the last write/modification. /// Logical drive or a file under given path does not exist. public static DateTime GetLastWriteTime(string path) diff --git a/System.IO.FileSystem/FileStream.cs b/System.IO.FileSystem/FileStream.cs index 7021253..4b917a2 100644 --- a/System.IO.FileSystem/FileStream.cs +++ b/System.IO.FileSystem/FileStream.cs @@ -297,7 +297,7 @@ public FileStream( } /// - /// Destructor + /// Destructor. /// ~FileStream() { @@ -345,7 +345,7 @@ protected override void Dispose(bool disposing) /// public override void Flush() { - // Already everything flushed/sync after every Read/Write operation, nothing to do here. + // Everything is flushed/sync already after every Read/Write operation, nothing to do here. } /// @@ -378,7 +378,7 @@ public override int Read( if (buffer.Length < offset + count) { - throw new IndexOutOfRangeException("Buffer size is smaller then offset + byteCount."); + throw new IndexOutOfRangeException("Buffer size is smaller than 'offset' + 'byteCount'."); } // Create buffer for read Data @@ -405,7 +405,7 @@ public override int Read( } /// - /// Reads a byte from the file and advances the read position one byte. + /// Reads a byte from the file and advances the read position by one byte. /// /// public override int ReadByte() From e87eb14bd01d99b0ed206f6a017797adc4132e07 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 8 May 2023 22:18:06 +0100 Subject: [PATCH 49/49] Re-align FileAttribures Allows quicker intergration. --- System.IO.FileSystem/Directory.cs | 2 +- System.IO.FileSystem/File.cs | 4 ++-- System.IO.FileSystem/FileAttributes.cs | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/System.IO.FileSystem/Directory.cs b/System.IO.FileSystem/Directory.cs index 1e6da96..9c3e7d1 100644 --- a/System.IO.FileSystem/Directory.cs +++ b/System.IO.FileSystem/Directory.cs @@ -82,7 +82,7 @@ public static string[] GetFiles(string path) /// /// List directories from the specified folder. /// - /// + /// The specified folder. /// /// When this method completes successfully, it returns an array of absolute paths to the subfolders in the specified directory. /// diff --git a/System.IO.FileSystem/File.cs b/System.IO.FileSystem/File.cs index 97736a9..a81356a 100644 --- a/System.IO.FileSystem/File.cs +++ b/System.IO.FileSystem/File.cs @@ -215,7 +215,7 @@ public static void Move( } /// - /// Gets the FileAttributes of the file on the path. + /// Gets the of the file on the path. /// /// The path to the file. /// The FileAttributes of the file on the path. @@ -237,7 +237,7 @@ public static FileAttributes GetAttributes(string path) } /// - /// Sets the specified FileAttributes of the file on the specified path. + /// Sets the specified of the file on the specified path. /// /// The path to the file. /// A bitwise combination of the enumeration values. diff --git a/System.IO.FileSystem/FileAttributes.cs b/System.IO.FileSystem/FileAttributes.cs index 2ef57f3..7d1b271 100644 --- a/System.IO.FileSystem/FileAttributes.cs +++ b/System.IO.FileSystem/FileAttributes.cs @@ -14,27 +14,27 @@ public enum FileAttributes /// /// The file is read-only. /// - ReadOnly = 0x0001, + ReadOnly = 0x01, // FIXME: should be uint 0x0001, to align with .Net. /// /// The file is hidden, and thus is not included in an ordinary directory listing. /// - Hidden = 0x0002, + Hidden = 0x02, // FIXME: should be uint 0x0002, to align with .Net. /// /// The file is a system file. /// That is, the file is part of the operating system or is used exclusively by the operating system. /// - System = 0x0004, + System = 0x04, // FIXME: should be uint 0x0004, to align with .Net. /// /// The file is a directory. /// - Directory = 0x0010, + Directory = 0x10, // FIXME: should be uint 0x0010, to align with .Net. /// /// This file is marked to be included in incremental backup operation. /// - Archive = 0x0020 + Archive = 0x20 // FIXME: should be uint 0x0010, to align with .Net. } }