aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2021-04-19 11:46:34 +0200
committerMiguel Costa <miguel.costa@qt.io>2021-04-20 09:25:05 +0000
commit1309412fb51a05b1b7aa82f183f715900b594b65 (patch)
treeb9af8295fd201abc406c7f96bfa3454de1171f8a /src
parentc23943d12d142f26b06526c20fe62f85e6289c9b (diff)
Reset macros between test sessions
The C# macros loaded in QtVSTest during a test session will be removed after that session is over. Previously, macros would remain loaded, which caused errors and unexpected behavior. A test session is defined as starting when a test client connects to the QtVSTest local socket, and ending when that client disconnects. Change-Id: I965d3a6c68e85e77cb9e61ea680ca005c148dc8a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qtvstest/Macro.cs5
-rw-r--r--src/qtvstest/MacroServer.cs3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/qtvstest/Macro.cs b/src/qtvstest/Macro.cs
index a8a1bebf..a264036d 100644
--- a/src/qtvstest/Macro.cs
+++ b/src/qtvstest/Macro.cs
@@ -949,6 +949,11 @@ namespace QtVsTest.Macros
return macro;
}
+ public static void Reset()
+ {
+ Macros.Clear();
+ }
+
bool GenerateResultFuncs(StringBuilder csharp)
{
csharp.Append(
diff --git a/src/qtvstest/MacroServer.cs b/src/qtvstest/MacroServer.cs
index a7341845..a6c31308 100644
--- a/src/qtvstest/MacroServer.cs
+++ b/src/qtvstest/MacroServer.cs
@@ -76,6 +76,9 @@ namespace QtVsTest.Macros
while (!Loop.Token.IsCancellationRequested) {
using (var pipe = new NamedPipeServerStream(pipeName, PipeDirection.InOut)) {
+ // Clean-up previous macro session
+ Macro.Reset();
+
await pipe.WaitForConnectionAsync(Loop.Token);
if (Loop.Token.IsCancellationRequested)
break;