Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2479043003: [wasm] fix TestInterruptLoop for Big Endian platform (Closed)
Patch Set: workaround to avoid using const_cast Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-module.cc
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
index 458fc1a9e4fd65b4b9127832e282411310870b0f..45a66957f6aa912fa033ebb06af308b8915bfa13 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -419,13 +419,17 @@ class InterruptThread : public v8::base::Thread {
static void OnInterrupt(v8::Isolate* isolate, void* data) {
int32_t* m = reinterpret_cast<int32_t*>(data);
// Set the interrupt location to 0 to break the loop in {TestInterruptLoop}.
- m[interrupt_location_] = interrupt_value_;
+ int32_t* ptr = &m[interrupt_location_];
+ WriteLittleEndianValue<int32_t>(ptr, interrupt_value_);
}
virtual void Run() {
// Wait for the main thread to write the signal value.
- while (memory_[0] != signal_value_) {
- }
+ int32_t val = 0;
+ do {
+ val = memory_[0];
+ val = ReadLittleEndianValue<int32_t>(&val);
+ } while (val != signal_value_);
isolate_->RequestInterrupt(&OnInterrupt, const_cast<int32_t*>(memory_));
}
@@ -489,8 +493,9 @@ TEST(TestInterruptLoop) {
thread.Start();
testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr,
ModuleOrigin::kWasmOrigin);
+ int32_t val = memory_array[InterruptThread::interrupt_location_];
CHECK_EQ(InterruptThread::interrupt_value_,
- memory_array[InterruptThread::interrupt_location_]);
+ ReadLittleEndianValue<int32_t>(&val));
}
TEST(Run_WasmModule_GrowMemoryInIf) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698