diff options
author | Kenneth Pouncey <kjpou@pt.lu> | 2019-10-16 05:59:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-16 05:59:55 +0300 |
commit | 2b4790a1f3be0ba846d42e128a3b9a4c21c276b9 (patch) | |
tree | 280b57a010a2b59ddf976932b692f3a9eea1d3d1 /sdks | |
parent | 2ddcf8cf161f8827a6ce51a3b87c6a289563c7b6 (diff) |
[wasm][tests] WASM Safari browser tests (#16816)
* Add support for tests via safari browser
* Run safari browser tests on CI for Mac lanes
* Update to fix syntax error using UNAME to `if [[ ${CI_TAGS} == *'osx-amd64'* ]];`
* Fix syntax error with `if`
Diffstat (limited to 'sdks')
-rw-r--r-- | sdks/wasm/Makefile | 4 | ||||
-rw-r--r-- | sdks/wasm/tests/browser/karma.conf.js | 2 | ||||
-rw-r--r-- | sdks/wasm/tests/browser/package.json | 4 | ||||
-rw-r--r-- | sdks/wasm/tests/browser/src/BrowserTestSuite/core-bindings-spec.js | 264 |
4 files changed, 183 insertions, 91 deletions
diff --git a/sdks/wasm/Makefile b/sdks/wasm/Makefile index 7ce79f4591e..cf5ddfd932d 100644 --- a/sdks/wasm/Makefile +++ b/sdks/wasm/Makefile @@ -537,6 +537,10 @@ run-browser-tests: $(BROWSER_TEST)/.stamp-browser-test-suite run-browser-threads-tests: $(BROWSER_TEST_THREADS)/.stamp-browser-test-threads-suite (cd $(BROWSER_TEST_THREADS) && npm test) +run-browser-safar-tests: $(BROWSER_TEST)/.stamp-browser-test-suite + (cd $(BROWSER_TEST) && npm run testsafari) + + clean: clean-browser-tests $(RM) -r *.o $(RM) -r ./obj diff --git a/sdks/wasm/tests/browser/karma.conf.js b/sdks/wasm/tests/browser/karma.conf.js index 0d391d3bccc..14a57a49b14 100644 --- a/sdks/wasm/tests/browser/karma.conf.js +++ b/sdks/wasm/tests/browser/karma.conf.js @@ -39,7 +39,7 @@ module.exports = function(config) { //load karma-jasmine-dom and karma-jasmine frameworks: ['jasmine-dom','jasmine','mocha', 'chai', 'websocket-server'], //load karma-chrome-launcher - browsers: ['ChromeHeadless', 'NoSandBoxHeadless'], + browsers: ['ChromeHeadless', 'NoSandBoxHeadless', 'SafariNative'], customLaunchers: { NoSandBoxHeadless: { base: 'ChromeHeadless', diff --git a/sdks/wasm/tests/browser/package.json b/sdks/wasm/tests/browser/package.json index 6df308c5a06..80d09f9ebcc 100644 --- a/sdks/wasm/tests/browser/package.json +++ b/sdks/wasm/tests/browser/package.json @@ -5,7 +5,8 @@ "main": "karma.conf.js", "scripts": { "test": "karma start --single-run --browsers NoSandBoxHeadless karma.conf.js", - "test:keep-alive": "karma start --browsers ChromeHeadless karma.conf.js" + "test:keep-alive": "karma start --browsers ChromeHeadless karma.conf.js", + "testsafari": "karma start --single-run --browsers SafariNative karma.conf.js" }, "author": "", "license": "ISC", @@ -21,6 +22,7 @@ "karma-junit-reporter": "^1.2.0", "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.5", + "karma-safarinative-launcher": "^1.1.0", "karma-websocket-server": "^1.0.0", "mocha": "^5.2.0", "puppeteer": "^1.11.0" diff --git a/sdks/wasm/tests/browser/src/BrowserTestSuite/core-bindings-spec.js b/sdks/wasm/tests/browser/src/BrowserTestSuite/core-bindings-spec.js index 8c9926dde72..f8b5fbb35ae 100644 --- a/sdks/wasm/tests/browser/src/BrowserTestSuite/core-bindings-spec.js +++ b/sdks/wasm/tests/browser/src/BrowserTestSuite/core-bindings-spec.js @@ -199,95 +199,181 @@ describe("The WebAssembly Core Bindings Test Suite",function(){ }, DEFAULT_TIMEOUT); - it('BindingTestSuite: Should return new Uint8ClampedArray from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - - var clamped = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint8ClampedArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); - assert.equal(clamped.length, 50, "result does not match length of 50."); - assert.equal(Object.prototype.toString.call(clamped), "[object Uint8ClampedArray]", "TypedArray is not of type Uint8ClampedArray" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Uint8Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint8ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); - assert.equal(arr.length, 50, "result does not match length of 50."); - assert.equal(Object.prototype.toString.call(arr), "[object Uint8Array]", "TypedArray is not of type Uint8Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Uint16Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint16ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); - assert.equal(arr.length, 25, "result does not match length of 25."); - assert.equal(Object.prototype.toString.call(arr), "[object Uint16Array]", "TypedArray is not of type Uint16Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Uint32Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint32ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); - assert.equal(arr.length, 10, "result does not match length of 10."); - assert.equal(Object.prototype.toString.call(arr), "[object Uint32Array]", "TypedArray is not of type Uint32Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Int8Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Int8ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); - assert.equal(arr.length, 50, "result does not match length of 50."); - assert.equal(Object.prototype.toString.call(arr), "[object Int8Array]", "TypedArray is not of type Int8Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Int16Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Int16ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); - assert.equal(arr.length, 20, "result does not match length of 20."); - assert.equal(Object.prototype.toString.call(arr), "[object Int16Array]", "TypedArray is not of type Int16Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Int32Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Int32ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); - assert.equal(arr.length, 10, "result does not match length of 10."); - assert.equal(Object.prototype.toString.call(arr), "[object Int32Array]", "TypedArray is not of type Int32Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Float32Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Float32ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); - assert.equal(arr.length, 10, "result does not match length of 10."); - assert.equal(Object.prototype.toString.call(arr), "[object Float32Array]", "TypedArray is not of type Float32Array" ) - - }, DEFAULT_TIMEOUT); - - it('BindingTestSuite: Should return new Float64Array from a SharedArrayBuffer.', () => { - //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file - var _document = karmaHTML.corebindingsspec.document; - - var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Float64ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); - assert.equal(arr.length, 5, "result does not match length of 5."); - assert.equal(Object.prototype.toString.call(arr), "[object Float64Array]", "TypedArray is not of type Float64Array" ) - }, DEFAULT_TIMEOUT); + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Uint8ClampedArray from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + it('BindingTestSuite: Should return new Uint8ClampedArray from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") {} + + else { + var _document = karmaHTML.corebindingsspec.document; + + + var clamped = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint8ClampedArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); + assert.equal(clamped.length, 50, "result does not match length of 50."); + assert.equal(Object.prototype.toString.call(clamped), "[object Uint8ClampedArray]", "TypedArray is not of type Uint8ClampedArray" ) + } + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Uint8Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + + it('BindingTestSuite: Should return new Uint8Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint8ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); + assert.equal(arr.length, 50, "result does not match length of 50."); + assert.equal(Object.prototype.toString.call(arr), "[object Uint8Array]", "TypedArray is not of type Uint8Array" ) + + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Uint16Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + + it('BindingTestSuite: Should return new Uint16Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint16ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); + assert.equal(arr.length, 25, "result does not match length of 25."); + assert.equal(Object.prototype.toString.call(arr), "[object Uint16Array]", "TypedArray is not of type Uint16Array" ) + + }, DEFAULT_TIMEOUT); + + it('BindingTestSuite: Should return new Uint32Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Uint32ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); + assert.equal(arr.length, 10, "result does not match length of 10."); + assert.equal(Object.prototype.toString.call(arr), "[object Uint32Array]", "TypedArray is not of type Uint32Array" ) + + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Int8Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + + it('BindingTestSuite: Should return new Int8Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Int8ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(50)]); + assert.equal(arr.length, 50, "result does not match length of 50."); + assert.equal(Object.prototype.toString.call(arr), "[object Int8Array]", "TypedArray is not of type Int8Array" ) + + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Int16Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + it('BindingTestSuite: Should return new Int16Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Int16ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); + assert.equal(arr.length, 20, "result does not match length of 20."); + assert.equal(Object.prototype.toString.call(arr), "[object Int16Array]", "TypedArray is not of type Int16Array" ) + + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Int32Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + it('BindingTestSuite: Should return new Int32Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Int32ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); + assert.equal(arr.length, 10, "result does not match length of 10."); + assert.equal(Object.prototype.toString.call(arr), "[object Int32Array]", "TypedArray is not of type Int32Array" ) + + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Float32Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + it('BindingTestSuite: Should return new Float32Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Float32ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); + assert.equal(arr.length, 10, "result does not match length of 10."); + assert.equal(Object.prototype.toString.call(arr), "[object Float32Array]", "TypedArray is not of type Float32Array" ) + + }, DEFAULT_TIMEOUT); + } + + if (typeof SharedArrayBuffer === "undefined") + { + xit('BindingTestSuite: Should return new Float32Array from a SharedArrayBuffer.', () => { + }, DEFAULT_TIMEOUT); + } + else { + it('BindingTestSuite: Should return new Float64Array from a SharedArrayBuffer.', () => { + //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file + if (typeof SharedArrayBuffer === "undefined") + this.skip(); + + var _document = karmaHTML.corebindingsspec.document; + + var arr = _document.Module.BINDING.call_static_method("[BindingsTestSuite]BindingsTestSuite.Program:Float64ArrayFromSharedArrayBuffer", [new SharedArrayBuffer(40)]); + assert.equal(arr.length, 5, "result does not match length of 5."); + assert.equal(Object.prototype.toString.call(arr), "[object Float64Array]", "TypedArray is not of type Float64Array" ) + }, DEFAULT_TIMEOUT); + } it('BindingTestSuite: Should return Sum of two int values from Function.Call.', () => { //karmaHTML.corebindingsspec.document gives the access to the Document object of 'http-spec.html' file |