Merge branch 'dev' into SignalR

This commit is contained in:
Jordan Dominion
2023-10-29 14:32:09 -04:00
14 changed files with 57 additions and 30 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<TgsCommonLibraryVersion>7.0.0</TgsCommonLibraryVersion>
<TgsApiLibraryVersion>11.1.2</TgsApiLibraryVersion>
<TgsClientVersion>13.0.0</TgsClientVersion>
<TgsDmapiVersion>6.6.0</TgsDmapiVersion>
<TgsDmapiVersion>6.6.1</TgsDmapiVersion>
<TgsInteropVersion>5.6.2</TgsInteropVersion>
<TgsHostWatchdogVersion>1.4.0</TgsHostWatchdogVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
+1 -1
View File
@@ -1,6 +1,6 @@
// tgstation-server DMAPI
#define TGS_DMAPI_VERSION "6.6.0"
#define TGS_DMAPI_VERSION "6.6.1"
// All functions and datums outside this document are subject to change with any version and should not be relied on.
+4
View File
@@ -11,6 +11,10 @@ TGS_DEFINE_AND_SET_GLOBAL(tgs, null)
src.event_handler = event_handler
src.version = version
/datum/tgs_api/proc/TerminateWorld()
del(world)
sleep(1) // https://www.byond.com/forum/post/2894866
/datum/tgs_api/latest
parent_type = /datum/tgs_api/v5
+5 -5
View File
@@ -73,7 +73,7 @@
if(cached_json["apiValidateOnly"])
TGS_INFO_LOG("Validating API and exiting...")
Export(TGS4_COMM_VALIDATE, list(TGS4_PARAMETER_DATA = "[minimum_required_security_level]"))
del(world)
TerminateWorld()
security_level = cached_json["securityLevel"]
chat_channels_json_path = cached_json["chatChannelsJson"]
@@ -188,7 +188,7 @@
requesting_new_port = TRUE
if(!world.OpenPort(0)) //open any port
TGS_ERROR_LOG("Unable to open random port to retrieve new port![TGS4_PORT_CRITFAIL_MESSAGE]")
del(world)
TerminateWorld()
//request a new port
export_lock = FALSE
@@ -196,16 +196,16 @@
if(!new_port_json)
TGS_ERROR_LOG("No new port response from server![TGS4_PORT_CRITFAIL_MESSAGE]")
del(world)
TerminateWorld()
var/new_port = new_port_json[TGS4_PARAMETER_DATA]
if(!isnum(new_port) || new_port <= 0)
TGS_ERROR_LOG("Malformed new port json ([json_encode(new_port_json)])![TGS4_PORT_CRITFAIL_MESSAGE]")
del(world)
TerminateWorld()
if(new_port != world.port && !world.OpenPort(new_port))
TGS_ERROR_LOG("Unable to open port [new_port]![TGS4_PORT_CRITFAIL_MESSAGE]")
del(world)
TerminateWorld()
requesting_new_port = FALSE
while(export_lock)
+1 -1
View File
@@ -51,7 +51,7 @@
if(runtime_information[DMAPI5_RUNTIME_INFORMATION_API_VALIDATE_ONLY])
TGS_INFO_LOG("DMAPI validation, exiting...")
del(world)
TerminateWorld()
version = new /datum/tgs_version(runtime_information[DMAPI5_RUNTIME_INFORMATION_SERVER_VERSION])
security_level = runtime_information[DMAPI5_RUNTIME_INFORMATION_SECURITY_LEVEL]
@@ -784,8 +784,6 @@ namespace Tgstation.Server.Host.Components.Session
case BridgeCommandType.Startup:
apiValidationStatus = ApiValidationStatus.BadValidationRequest;
// This business is is cancelled until this BYOND bug is resolved: https://www.byond.com/forum/post/2894866
#if FALSE
if (apiValidationSession)
{
var proceedTcs = new TaskCompletionSource<bool>();
@@ -795,9 +793,6 @@ namespace Tgstation.Server.Host.Components.Session
if (!firstValidationRequest)
return BridgeError("Startup bridge request was repeated!");
}
#else
postValidationShutdownTask = Task.CompletedTask;
#endif
if (parameters.Version == null)
return BridgeError("Missing dmApiVersion field!");
@@ -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
+6 -4
View File
@@ -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!")
-8
View File
@@ -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))
+1
View File
@@ -32,3 +32,4 @@
text2file(reason, "test_fail_reason.txt")
world.log << "Terminating..."
del(world)
sleep(1) // https://www.byond.com/forum/post/2894866
@@ -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);
}
+2 -1
View File
@@ -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