Patch osx tests

This commit is contained in:
caesay
2023-12-26 00:46:31 +00:00
parent c066373257
commit 35339eaa46
4 changed files with 16 additions and 7 deletions

View File

@@ -109,7 +109,7 @@ jobs:
path: src/Rust/target/release path: src/Rust/target/release
- name: Build .NET - name: Build .NET
run: dotnet build -c Release run: dotnet build -c Release /p:PackRustAssets=true
- name: Upload Package Artifacts - name: Upload Package Artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@@ -22,14 +22,16 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Debug'"> <ItemGroup Condition="'$(Configuration)' == 'Debug'">
<None Include="..\Rust\target\debug\update.exe" CopyToOutputDirectory="Always" /> <None Include="..\Rust\target\debug\update" CopyToOutputDirectory="Always" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
<None Include="..\Rust\target\debug\setup.exe" CopyToOutputDirectory="Always" /> <None Include="..\Rust\target\debug\update.exe" CopyToOutputDirectory="Always" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<None Include="..\Rust\target\debug\setup.exe" CopyToOutputDirectory="Always" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<None Include="..\..\vendor\rcedit.exe" CopyToOutputDirectory="Always" /> <None Include="..\..\vendor\rcedit.exe" CopyToOutputDirectory="Always" />
<None Include="..\..\vendor\signtool.exe" CopyToOutputDirectory="Always" /> <None Include="..\..\vendor\signtool.exe" CopyToOutputDirectory="Always" />
<None Include="..\..\Squirrel.entitlements" CopyToOutputDirectory="Always" /> <None Include="..\..\Squirrel.entitlements" CopyToOutputDirectory="Always" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'"> <ItemGroup Condition="'$(PackRustAssets)' == 'true'">
<None Include="..\Rust\target\release\updatemac" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\update.exe" Pack="true" PackagePath="vendor" /> <None Include="..\Rust\target\release\update.exe" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\setup.exe" Pack="true" PackagePath="vendor" /> <None Include="..\Rust\target\release\setup.exe" Pack="true" PackagePath="vendor" />
<None Include="..\..\vendor\rcedit.exe" Pack="true" PackagePath="vendor" /> <None Include="..\..\vendor\rcedit.exe" Pack="true" PackagePath="vendor" />

View File

@@ -182,6 +182,10 @@ namespace Squirrel
throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name"); throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name");
} }
if (filename.IndexOfAny(new[] { '\"', '/', '\\', '<', '>', '|', '\0' }) > -1) {
throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name");
}
long size = Int64.Parse(m.Groups[3].Value); long size = Int64.Parse(m.Groups[3].Value);
return new ReleaseEntry(m.Groups[1].Value, filename, size, baseUrl, query, stagingPercentage); return new ReleaseEntry(m.Groups[1].Value, filename, size, baseUrl, query, stagingPercentage);
} }

View File

@@ -24,7 +24,7 @@ namespace Squirrel.Tests
_output = output; _output = output;
} }
[Theory] [SkippableTheory]
[InlineData("file.txt", "file.txt")] [InlineData("file.txt", "file.txt")]
[InlineData("file", "file")] [InlineData("file", "file")]
[InlineData("/file", "\\file")] [InlineData("/file", "\\file")]
@@ -33,12 +33,13 @@ namespace Squirrel.Tests
[InlineData("C:/AnApp/file/", "C:\\AnApp\\file")] [InlineData("C:/AnApp/file/", "C:\\AnApp\\file")]
public void PathIsNormalized(string input, string expected) public void PathIsNormalized(string input, string expected)
{ {
Skip.IfNot(SquirrelRuntimeInfo.IsWindows);
var exp = Path.GetFullPath(expected); var exp = Path.GetFullPath(expected);
var normal = Utility.NormalizePath(input); var normal = Utility.NormalizePath(input);
Assert.Equal(exp, normal); Assert.Equal(exp, normal);
} }
[Theory] [SkippableTheory]
[InlineData("C:\\AnApp", "C:\\AnApp\\file.exe", true)] [InlineData("C:\\AnApp", "C:\\AnApp\\file.exe", true)]
[InlineData("C:\\AnApp\\", "C:\\AnApp\\file.exe", true)] [InlineData("C:\\AnApp\\", "C:\\AnApp\\file.exe", true)]
[InlineData("C:\\AnApp", "C:\\AnApp\\sub\\dir\\file.exe", true)] [InlineData("C:\\AnApp", "C:\\AnApp\\sub\\dir\\file.exe", true)]
@@ -50,6 +51,7 @@ namespace Squirrel.Tests
[InlineData("AnAppThree", "AnAppThree\\file.exe", true)] [InlineData("AnAppThree", "AnAppThree\\file.exe", true)]
public void FileIsInDirectory(string directory, string file, bool isIn) public void FileIsInDirectory(string directory, string file, bool isIn)
{ {
Skip.IfNot(SquirrelRuntimeInfo.IsWindows);
var fileInDir = Utility.IsFileInDirectory(file, directory); var fileInDir = Utility.IsFileInDirectory(file, directory);
Assert.Equal(isIn, fileInDir); Assert.Equal(isIn, fileInDir);
} }
@@ -172,13 +174,14 @@ namespace Squirrel.Tests
Assert.Equal(result, Utility.FileIsLikelyPEImage(input)); Assert.Equal(result, Utility.FileIsLikelyPEImage(input));
} }
[Theory] [SkippableTheory]
[InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", true)] [InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", true)]
[InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)] [InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)]
[InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)] [InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)]
[InlineData("foo.png", "C:\\Users\\bob\\temp\\pkgPath", false)] [InlineData("foo.png", "C:\\Users\\bob\\temp\\pkgPath", false)]
public void IsFileTopLevelInPackageTest(string input, string packagePath, bool result) public void IsFileTopLevelInPackageTest(string input, string packagePath, bool result)
{ {
Skip.IfNot(SquirrelRuntimeInfo.IsWindows);
Assert.Equal(result, Utility.IsFileTopLevelInPackage(input, packagePath)); Assert.Equal(result, Utility.IsFileTopLevelInPackage(input, packagePath));
} }