Commit 73281702 authored by dusan.simicic's avatar dusan.simicic Committed by Commit bot

[test] Clear unhandled scheduled exceptions from ValueSerializerTest

This patch adds destructor to ValueSerializerTest test fixture class
which reset unhandled scheduled exceptions thrown from the current test.
In some cases unhandled scheduled exceptions from current test (eg.
from one test from ValueSerializerTestWithWasm test case) produce that
Context::New(isolate()) from next test's constructor returns NULL.

This error is easily reproduced when unittest file (compiled for ARM or
MIPS simulator) is directly executed (not by tools/run_tests.py script),
so all tests are executed together. When the script is used, each test
from ValueSerializerTestWithWasm test case is separately executed and
unhandled exception from one test doesn't efect to another test from
the same test case.

BUG=

Review-Url: https://codereview.chromium.org/2644083002
Cr-Commit-Position: refs/heads/master@{#42547}
parent 7425b1f2
......@@ -54,6 +54,17 @@ class ValueSerializerTest : public TestWithIsolate {
.ToChecked();
}
host_object_constructor_template_ = function_template;
isolate_ = reinterpret_cast<i::Isolate*>(isolate());
}
~ValueSerializerTest() {
// In some cases unhandled scheduled exceptions from current test produce
// that Context::New(isolate()) from next test's constructor returns NULL.
// In order to prevent that, we added destructor which will clear scheduled
// exceptions just for the current test from test case.
if (isolate_->has_scheduled_exception()) {
isolate_->clear_scheduled_exception();
}
}
const Local<Context>& serialization_context() {
......@@ -256,6 +267,7 @@ class ValueSerializerTest : public TestWithIsolate {
Local<Context> serialization_context_;
Local<Context> deserialization_context_;
Local<FunctionTemplate> host_object_constructor_template_;
i::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(ValueSerializerTest);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment