Always close test process after performing a test
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Tue, 3 Apr 2018 16:54:49 +0000 (19:54 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Tue, 3 Apr 2018 16:54:49 +0000 (19:54 +0300)
tests/runner/Runner.cs

index e43a0d188608777256d383f3405a46f06376ad59..175b51562eecf812b0471f55ae18547af0dc4886 100644 (file)
@@ -81,6 +81,7 @@ namespace Runner
 
             public void Close()
             {
+                process.StandardInput.WriteLine("-gdb-exit");
                 process.StandardInput.Close();
                 if (!process.WaitForExit(5))
                 {
@@ -316,19 +317,28 @@ namespace Runner
 
             ProcessInfo processInfo = new ProcessInfo(debuggerCommand, output);
 
-            // Globals, to use inside test case
-            TestCaseGlobals globals = new TestCaseGlobals(
-                processInfo,
-                lines,
-                data.srcFilePath,
-                data.dllPath,
-                output
-            );
-
-            script.RunAsync(globals).Wait();
+            try
+            {
+                // Globals, to use inside test case
+                TestCaseGlobals globals = new TestCaseGlobals(
+                    processInfo,
+                    lines,
+                    data.srcFilePath,
+                    data.dllPath,
+                    output
+                );
 
-            // Finish process
-            processInfo.Close();
+                script.RunAsync(globals).Wait();
+            }
+            catch (Exception e)
+            {
+                throw e;
+            }
+            finally
+            {
+                // Finish process
+                processInfo.Close();
+            }
         }
     }
 }