mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-07 04:55:00 +03:00
Fix empty latency tests and Linux startup errors (#10335)
* Fix overflow when speed tests have no eligible profiles * Preserve core executable permissions in Debian packages * Avoid requesting an icon refresh before view initialization
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace ServiceLib.Tests.Common;
|
||||
|
||||
public class UnixFileModeTests
|
||||
{
|
||||
[Test]
|
||||
public async Task AlreadyExecutableSystemBinary_ShouldNotRequireOwnership()
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// /bin/sh is executable but owned by root on the Unix CI runners.
|
||||
// A regular user must not need chmod permission just to launch it.
|
||||
var mode = File.GetUnixFileMode("/bin/sh");
|
||||
await Utils.SetUnixFileMode("/bin/sh").Should().BeTrue();
|
||||
await File.GetUnixFileMode("/bin/sh").Should().BeEqualTo(mode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task NonExecutableOwnedFile_ShouldGainExecuteBitsWithoutLosingOtherPermissions()
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var path = Path.GetTempFileName();
|
||||
try
|
||||
{
|
||||
var mode = UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.GroupRead;
|
||||
File.SetUnixFileMode(path, mode);
|
||||
|
||||
await Utils.SetUnixFileMode(path).Should().BeTrue();
|
||||
await File.GetUnixFileMode(path).Should().BeEqualTo(mode | UnixFileMode.UserExecute | UnixFileMode.GroupExecute | UnixFileMode.OtherExecute);
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user