Version 5.3.4: Updated test code for V8ScriptEngine script interruption crash fix.

This commit is contained in:
ClearScript 2013-07-10 10:25:11 -04:00
Родитель bb907f56a6
Коммит c24c7ac12c
7 изменённых файлов: 30 добавлений и 37 удалений

Просмотреть файл

@ -63,5 +63,5 @@
#pragma once #pragma once
#define CLEARSCRIPT_VERSION_STRING "5.3.3.0" #define CLEARSCRIPT_VERSION_STRING "5.3.4.0"
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,3,3,0 #define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,3,4,0

Просмотреть файл

@ -73,5 +73,5 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("ClearScriptTest")] [assembly: InternalsVisibleTo("ClearScriptTest")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.3.3.0")] [assembly: AssemblyVersion("5.3.4.0")]
[assembly: AssemblyFileVersion("5.3.3.0")] [assembly: AssemblyFileVersion("5.3.4.0")]

Просмотреть файл

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© Microsoft Corporation")] [assembly: AssemblyCopyright("© Microsoft Corporation")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.3.3.0")] [assembly: AssemblyVersion("5.3.4.0")]
[assembly: AssemblyFileVersion("5.3.3.0")] [assembly: AssemblyFileVersion("5.3.4.0")]

Просмотреть файл

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© Microsoft Corporation")] [assembly: AssemblyCopyright("© Microsoft Corporation")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.3.3.0")] [assembly: AssemblyVersion("5.3.4.0")]
[assembly: AssemblyFileVersion("5.3.3.0")] [assembly: AssemblyFileVersion("5.3.4.0")]

Просмотреть файл

@ -146,43 +146,36 @@ namespace Microsoft.ClearScript.Test
[TestMethod, TestCategory("BugFix")] [TestMethod, TestCategory("BugFix")]
public void BugFix_V8_ScriptInterruptCrash() public void BugFix_V8_ScriptInterruptCrash()
{ {
// A V8 fatal error on a background thread may not kill the process, so a single run is // run the test several times to verify post-interrupt engine functionality
// inconclusive. It will kill the V8 runtime, however, causing subsequent runs to fail.
for (var iteration = 0; iteration < 16; iteration++) for (var iteration = 0; iteration < 16; iteration++)
{ {
var context = new PropertyBag(); var context = new PropertyBag();
engine.AddHostObject("context", context); engine.AddHostObject("context", context);
var startEvent = new ManualResetEventSlim(false); using (var startEvent = new ManualResetEventSlim(false))
var thread = new Thread(() =>
{ {
context["startEvent"] = startEvent; context["startEvent"] = startEvent;
context["counter"] = 0;
try var interrupted = false;
var thread = new Thread(() =>
{ {
engine.Execute( try
@" {
for (var i = 0; i < 10000000; i++ ) engine.Execute("while (true) { context.startEvent.Set(); }");
{ }
context.counter++; catch (ScriptInterruptedException)
context.startEvent.Set(); {
} interrupted = true;
"); }
} });
catch (ScriptInterruptedException)
{
}
});
thread.Start(); thread.Start();
startEvent.Wait(); startEvent.Wait();
engine.Interrupt(); engine.Interrupt();
thread.Join(); thread.Join();
Assert.IsTrue(interrupted);
var counter = (int)context["counter"]; }
Assert.IsTrue((counter > 0) && (counter < 10000000));
} }
} }

Просмотреть файл

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© Microsoft Corporation")] [assembly: AssemblyCopyright("© Microsoft Corporation")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.3.3.0")] [assembly: AssemblyVersion("5.3.4.0")]
[assembly: AssemblyFileVersion("5.3.3.0")] [assembly: AssemblyFileVersion("5.3.4.0")]

Просмотреть файл

@ -1 +1 @@
<# var version = new Version(5, 3, 3, 0); #> <# var version = new Version(5, 3, 4, 0); #>