mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-14 17:43:19 +01:00
Merge branch 'master' into dev
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
cd /D "%~dp0"
|
||||
cd %1
|
||||
cd tests\DMAPI\LongRunning
|
||||
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -Command "(New-Guid).Guid | Out-File resource.txt; Add-Content -Path resource.txt -Value 'aljsdhfjahsfkjnsalkjdfhskljdackmcnvxkljhvkjsdanv,jdshlkufhklasjeFDhfjkalhdkjlfhalksfdjh'"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "$1/tests/DMAPI/LongRunning"
|
||||
|
||||
tr -dc A-Za-z0-9 </dev/urandom | head -c 13 > resource.txt
|
||||
echo -e '\naljsdhfjahsfkjnsalkjdfhskljdackmcnvxkljhvkjsdanv,jdshlkufhklasjeFDhfjkalhdkjlfhalksfdjh\n' >> resource.txt
|
||||
@@ -28,11 +28,13 @@
|
||||
if(!length(channels))
|
||||
FailTest("Expected some chat channels!")
|
||||
|
||||
var/test_str = "aljsdhfjahsfkjnsalkjdfhskljdackmcnvxkljhvkjsdanv,jdshlkufhklasjeFDhfjkalhdkjlfhalksfdjh"
|
||||
var/res_contents = file2text('resource.txt') // we need a .rsc to be generated
|
||||
var/res = file('resource.txt')
|
||||
if(!res)
|
||||
FailTest("Failed to resource!")
|
||||
|
||||
if(!findtext(res_contents, test_str))
|
||||
FailTest("Failed to resource? Did not find magic: [res_contents]")
|
||||
var/res_contents = file2text(res) // we need a .rsc to be generated
|
||||
if(!res_contents)
|
||||
FailTest("Failed to resource? No contents!")
|
||||
|
||||
if(!fexists("[DME_NAME].rsc"))
|
||||
FailTest("Failed to create .rsc!")
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
if(!length(channels))
|
||||
FailTest("Expected some chat channels!")
|
||||
|
||||
var/test_str = "aljsdhfjahsfkjnsalkjdfhskljdackmcnvxkljhvkjsdanv,jdshlkufhklasjeFDhfjkalhdkjlfhalksfdjh"
|
||||
var/self_contents = file2text(file('Test.dm')) // we need a .rsc to be generated
|
||||
|
||||
if(!(test_str in self_contents))
|
||||
@@ -13,6 +13,7 @@ using Tgstation.Server.Client;
|
||||
using Tgstation.Server.Client.Components;
|
||||
using Tgstation.Server.Common.Extensions;
|
||||
using Tgstation.Server.Host.IO;
|
||||
using Tgstation.Server.Host.System;
|
||||
|
||||
namespace Tgstation.Server.Tests.Live.Instance
|
||||
{
|
||||
@@ -116,6 +117,19 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
|
||||
await using var memoryStream2 = new MemoryStream(Encoding.UTF8.GetBytes("bbb"));
|
||||
await configurationClient.Write(staticFile2, memoryStream2, cancellationToken);
|
||||
|
||||
var shellScriptExtension = new PlatformIdentifier().IsWindows ? ".bat" : ".sh";
|
||||
var scriptName = $"PreCompile-GenerateRandomResource{shellScriptExtension}";
|
||||
var resourcingScript = new ConfigurationFileRequest
|
||||
{
|
||||
Path = $"/EventScripts/{scriptName}"
|
||||
};
|
||||
|
||||
await using var readStream = ioManager.GetFileStream($"../../../../DMAPI/LongRunning/{scriptName}", false);
|
||||
await configurationClient.Write(
|
||||
resourcingScript,
|
||||
readStream,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
return ValueTaskExtensions.WhenAll(
|
||||
|
||||
@@ -394,13 +394,17 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
KillDD(true);
|
||||
var jobTcs = new TaskCompletionSource();
|
||||
var killTaskStarted = new TaskCompletionSource();
|
||||
var killTask = Task.Run(() =>
|
||||
var killThread = new Thread(() =>
|
||||
{
|
||||
killTaskStarted.SetResult();
|
||||
while (!jobTcs.Task.IsCompleted)
|
||||
KillDD(false);
|
||||
}, cancellationToken);
|
||||
})
|
||||
{
|
||||
Priority = ThreadPriority.AboveNormal
|
||||
};
|
||||
|
||||
killThread.Start();
|
||||
try
|
||||
{
|
||||
await killTaskStarted.Task;
|
||||
@@ -410,7 +414,7 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
finally
|
||||
{
|
||||
jobTcs.SetResult();
|
||||
await killTask;
|
||||
killThread.Join();
|
||||
}
|
||||
|
||||
// these can also happen
|
||||
@@ -1133,9 +1137,11 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
Assert.AreEqual(ddPort, daemonStatus.CurrentPort);
|
||||
|
||||
// Try killing the DD process to ensure it gets set to the restoring state
|
||||
bool firstTime = true;
|
||||
do
|
||||
{
|
||||
KillDD(true);
|
||||
KillDD(firstTime);
|
||||
firstTime = false;
|
||||
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
|
||||
daemonStatus = await instanceClient.DreamDaemon.Read(cancellationToken);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LongRunning", "LongRunning"
|
||||
tests\DMAPI\LongRunning\long_running_test.dme = tests\DMAPI\LongRunning\long_running_test.dme
|
||||
tests\DMAPI\LongRunning\long_running_test_copy.dme = tests\DMAPI\LongRunning\long_running_test_copy.dme
|
||||
tests\DMAPI\LongRunning\long_running_test_rooted.dme = tests\DMAPI\LongRunning\long_running_test_rooted.dme
|
||||
tests\DMAPI\LongRunning\resource.txt = tests\DMAPI\LongRunning\resource.txt
|
||||
tests\DMAPI\LongRunning\PreCompile-GenerateRandomResource.bat = tests\DMAPI\LongRunning\PreCompile-GenerateRandomResource.bat
|
||||
tests\DMAPI\LongRunning\PreCompile-GenerateRandomResource.sh = tests\DMAPI\LongRunning\PreCompile-GenerateRandomResource.sh
|
||||
tests\DMAPI\LongRunning\Test.dm = tests\DMAPI\LongRunning\Test.dm
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
||||
Reference in New Issue
Block a user