Skip to content

Commit b0c2122

Browse files
committed
Added tests for spawning (open) a subprocess in traditional bridge without breaking protocol
1 parent efd5697 commit b0c2122

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Diff for: HarmonyCore.Test/Bridge/BasicBridge.dbl

+11
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ namespace HarmonyCore.Test.Bridge
135135
Console.WriteLine("Calling GetAllCustomers")
136136
data customers = await context.GetAllCustomers()
137137

138+
Console.WriteLine("Calling Spawn Test")
139+
data spawnResult = await context.Arbitrario_Spawn()
140+
138141
try
139142
begin
140143
Console.WriteLine("Calling Exception Test")
@@ -498,6 +501,14 @@ namespace HarmonyCore.Test.Bridge
498501
mreturn new ArbitrarioReturnType() { ReturnCode = returnCode, IntList = ((@IEnumerable<int>)resultTpl.Item2[4]).ToList(), StringList = ((@IEnumerable<string>)resultTpl.Item2[5]).ToList() }
499502
endmethod
500503

504+
public async method Arbitrario_Spawn, @Task<ArbitrarioReturnType>
505+
proc
506+
data intArray = new int[#] {5, 4, 3, 2, 1 }
507+
data resultTpl = await CallMethod("Arbitrario.MethodWithParameters", 5, "SPAWN", new string[#] { "this", "is", "strings" }, (@object)intArray, new string[0])
508+
data returnCode = ArgumentHelper.Argument<int>(0, resultTpl)
509+
mreturn new ArbitrarioReturnType() { ReturnCode = returnCode, IntList = ((@IEnumerable<int>)resultTpl.Item2[4]).ToList(), StringList = ((@IEnumerable<string>)resultTpl.Item2[5]).ToList() }
510+
endmethod
511+
501512
public async method Arbitrario_MethodWithParameters, @Task<ArbitrarioReturnType>
502513
proc
503514
data intArray = new int[#] {5, 4, 3, 2, 1 }

Diff for: TraditionalBridge.Test/Methods/arbitrario.dbl

+16
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,23 @@ namespace TraditionalBridge.Test.Methods
1515
endparams
1616
record
1717
stringElement, @string
18+
tmp, a255
1819
proc
20+
if(stringValue == "SPAWN")
21+
begin
22+
Logger.Instance.Log("spawning a bad process")
23+
open(133, I, "|dbr fred.dbl")
24+
do forever
25+
begin
26+
reads(133, tmp, WAIT: Q_WAIT) [$ERR_EOF=done]
27+
nextloop
28+
done,
29+
exitloop
30+
end
31+
32+
close(133)
33+
end
34+
1935
;;test that we can recover from total runtime failure
2036
if(stringValue == "STOP NOW!!!")
2137
STOP

0 commit comments

Comments
 (0)