Skip to content

Commit

Permalink
Revert "[wasm] Add a new wasm-js testsuite to run js-api tests"
Browse files Browse the repository at this point in the history
This reverts commit a12203c.

Reason for revert: Breaks isolate_tests

https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux%20-%20builder/36777

Original change's description:
> [wasm] Add a new wasm-js testsuite to run js-api tests
> 
> These changes were necessary to run with the new style of jsapi tests
> introduced in WebAssembly/spec#883.
> 
> Change-Id: I4629dd48d595ed97ed0607dec9e7d9808c706a7e
> Reviewed-on: https://chromium-review.googlesource.com/c/1277724
> Commit-Queue: Ben Smith <[email protected]>
> Reviewed-by: Andreas Haas <[email protected]>
> Reviewed-by: Michael Achenbach <[email protected]>
> Reviewed-by: Mathias Bynens <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#56745}

[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]

Change-Id: I2edd0ca94cb5990322571879c81671fa835f3ecd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1286526
Reviewed-by: Bill Budge <[email protected]>
Commit-Queue: Bill Budge <[email protected]>
Cr-Commit-Position: refs/heads/master@{#56746}
  • Loading branch information
Bill Budge authored and Commit Bot committed Oct 17, 2018
1 parent a12203c commit 5c5dd02
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
/test/mozilla/data
/test/test262/data
/test/test262/harness
/test/wasm-js/data
/test/wasm-js
/test/wasm-spec-tests/tests
/test/wasm-spec-tests/tests.tar.gz
/third_party/*
Expand Down
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ deps = {
Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'a245b955fe9cd620081ed267fae303c88d033fef',
'v8/tools/luci-go':
Var('chromium_url') + '/chromium/src/tools/luci-go.git' + '@' + '445d7c4b6a4f10e188edb395b132e3996b127691',
'v8/test/wasm-js/data':
Var('chromium_url') + '/external/github.com/WebAssembly/spec.git' + '@' + 'cf67a477d2d802329640ef4e6461e4c180d8f910',
'v8/test/wasm-js':
Var('chromium_url') + '/external/github.com/WebAssembly/spec.git' + '@' + 'db9cd40808a90ecc5f4a23e88fb375c8f60b8d52',
}

recursedeps = [
Expand Down
3 changes: 0 additions & 3 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ group("gn_all") {
"mozilla:v8_mozilla",
"preparser:v8_preparser",
"test262:v8_test262",
"wasm-js:v8_wasm_js",
"wasm-spec-tests:v8_wasm_spec_tests",
"webkit:v8_webkit",
]
Expand Down Expand Up @@ -81,7 +80,6 @@ group("v8_bot_default") {
"mkgrokdump:mkgrokdump",
"preparser:v8_preparser",
"unittests:unittests",
"wasm-js:v8_wasm_js",
"wasm-spec-tests:v8_wasm_spec_tests",
"webkit:v8_webkit",
]
Expand All @@ -101,7 +99,6 @@ group("v8_default") {
"mkgrokdump:mkgrokdump",
"preparser:v8_preparser",
"unittests:unittests",
"wasm-js:v8_wasm_js",
"wasm-spec-tests:v8_wasm_spec_tests",
]
}
Expand Down
139 changes: 139 additions & 0 deletions test/mjsunit/wasm/jsapi-harness.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// TODO(eholk): Once we have stable test IDs, use those as the key instead.
// See https://github.com/WebAssembly/spec/issues/415
//
// Flags: --expose-wasm --allow-natives-syntax

const known_failures = {
// Enter failing tests like follows:
// "'WebAssembly.Instance.prototype.exports' accessor property":
// 'https://bugs.chromium.org/p/v8/issues/detail?id=5507',
};

let failures = [];
let unexpected_successes = [];

let last_promise = new Promise((resolve, reject) => { resolve(); });

function test(func, description) {
let maybeErr;
try { func(); }
catch(e) { maybeErr = e; }
if (typeof maybeErr !== 'undefined') {
var known = "";
if (known_failures[description]) {
known = " (known)";
}
print(`${description}: FAIL${known}. ${maybeErr}`);
failures.push(description);
} else {
if (known_failures[description]) {
unexpected_successes.push(description);
}
print(`${description}: PASS.`);
}
}

function promise_test(func, description) {
last_promise = last_promise.then(func)
.then(_ => {
if (known_failures[description]) {
unexpected_successes.push(description);
}
print(`${description}: PASS.`);
})
.catch(err => {
var known = "";
if (known_failures[description]) {
known = " (known)";
}
print(`${description}: FAIL${known}. ${err}`);
failures.push(description);
});
}

let assert_true = assertEquals.bind(null, true);
let assert_false = assertEquals.bind(null, false);

function same_value(x, y) {
if (y !== y) {
// NaN case
return x!==x;
}
if (x === 0 && y === 0) {
// Distinguish +0 and -0
return 1/x === 1/y;
}
return x === y;
}

let assert_equals = function(expected, found, description) {
if (typeof found != typeof expected) {
assert_true(false, "assert_equals", description,
"expected (" + typeof expected + ") ${expected} but got (" +
typeof found + ") ${found}", {expected:expected, found:found});
}
assert_true(same_value(found, expected), "assert_equals", description,
"expected ${expected} but got ${found}",
{expected:expected, found:found});
}

let assert_not_equals = function(expected, found, description) {
assert_true(!same_value(found, expected), "assert_not_equals", description,
"got disallowed value ${found}", {found:found});
}

function assert_unreached(description) {
throw new Error(`unreachable:\n${description}`);
}

function assertErrorMessage(f, ctor, test) {
try { f(); }
catch (e) {
assert_true(e instanceof ctor, "expected exception " + ctor.name + ", got " + e);
return;
}
assert_true(false, "expected exception " + ctor.name + ", no exception thrown");
};

load("test/wasm-js/test/harness/wasm-constants.js");
load("test/wasm-js/test/harness/wasm-module-builder.js");
load("test/wasm-js/test/js-api/jsapi.js");

assertPromiseResult(last_promise, _ => {
if (failures.length > 0) {
let unexpected = false;
print("Some tests FAILED:");
for (let i in failures) {
if (known_failures[failures[i]]) {
print(` ${failures[i]} [KNOWN: ${known_failures[failures[i]]}]`);
} else {
print(` ${failures[i]}`);
unexpected = true;
}
}
if (unexpected_successes.length > 0) {
unexpected = true;
print("");
print("Unexpected successes:");
for(let i in unexpected_successes) {
print(` ${unexpected_successes[i]}`);
}
print("Some tests SUCCEEDED but were known failures. If you've fixed " +
"the bug, please remove the test from the known failures list.")
}
if (unexpected) {
print("\n");
print(" #############################################################");
print(" # #");
print(" # Unexpected outcome. Did you forget to run 'gclient sync'? #");
print(" # #");
print(" #############################################################");
print("\n");
assertUnreachable("Unexpected outcome");
}
}
});
17 changes: 0 additions & 17 deletions test/wasm-js/BUILD.gn

This file was deleted.

30 changes: 0 additions & 30 deletions test/wasm-js/LICENSE.testharness

This file was deleted.

74 changes: 0 additions & 74 deletions test/wasm-js/testcfg.py

This file was deleted.

16 changes: 0 additions & 16 deletions test/wasm-js/testharness-after.js

This file was deleted.

Loading

0 comments on commit 5c5dd02

Please sign in to comment.